The Audit Stamp [in this case] is the first 36 bytes of the physical record. MAGEC does not require it to be the (cont.) *first* 36 bytes, but most users define it that way for consistency. It might be a good idea if you followed that same (cont.) procedure when defining files with Audit Stamps. The Audit Stamp Element **must** be defined if the DCL definition specifies that this Data Class has an Audit Stamp, (cont.) otherwise you will likely get a DB Error 99 (DB99) or Error 22 (DB22) at run-time when accessing this Data (cont.) Class. It is not necessary for you to define any Data Items (DIT's) for the Audit Stamp Element; MAGEC will use the predefined (cont.) standard definition for it. All Audit Stamps have an identical definition. It is defined in the library member ELT00-C (cont.) on the MAGEC library. To look at it you can enter the command: LBRSEE ELT00-C   ``` ELTADD VAD00 Enter data to be ADDED ** M A G E C Data Element Definition Data Dictionary Maintenance Element (Segment)= VAD00 data-class .................................. Description: MAGEC Audit Stamp_________________ test production Displacement: 0____ 0____ Length: 36___ 36___ DEVELOPER AUTH. - BATCH : 0 DEVELOPER AUTH. - ONLINE: 0 Employee having temporary Exclusive Control: 18_______ ``` Figure 08 — Element Definition Screen To avoid unnecessary I/O overhead ordinarily associated with dictionary-driven systems, MAGEC loads compressed images (cont.) of the dictionary data associated with file definitions and security into main memory. It uses highly optimized search (cont.) algorithms to access that data. The data is originally loaded into memory when your online system is first brought up, (cont.) or whenever the first transaction to MAGEC is sensed. You can cause MAGEC to reload this data dynamically in order to (cont.) put new or changed definitions into effect immediately. In order to tell MAGEC to refresh its in-memory images of the data definitions from the ones stored on the dictionary files, you must use the **LOAD command. Do this:** Key in the command: **LOAD as shown, press ENTER. You can key in the command "**LOAD" from any screen. You do not need to first press the CLEAR key or blank out the other data on the screen, it will be ignored by the **LOAD program. Next we must define the Data Items (DIT's) for the VAD01 Element. We will first use the batch MAGECLBR utility to (cont.) populate the dictionary from an "old" COBOL definition, then we will use the online DITxxx functions to put the (cont.) finishing touches on the definitions. Exit MAGEC and go into your text editor. **Do this:** Press PF15 to exit MAGEC. ``` **LOAD Data ADDED to Database ** M A G E C Data Element Definition Data Dictionary Maintenance Element (Segment)= VAD00 data-class MAGEC Vacation Dummy File Description: MAGEC Audit Stamp test production Displacement: 00000 00000 Length: 00036 00036 DEVELOPER AUTH. - BATCH : 0 DEVELOPER AUTH. - ONLINE: 0 Employee having temporary Exclusive Control: 18 TO MAKE YOUR CHANGE EFFECTIVE IMMEDIATELY DO NOT FORGET **LOAD !!! ``` Figure 09 — **LOAD Command # Data Item Definition ## MAGECLBR Refer to the "Offline Utilities" chapter of your MAGEC manual for the proper JCL with which to execute MAGECLBR. JCL (cont.) varies from one operating environment to another; however, the control card formats for MAGECLBR are the same in all (cont.) environments. If you are doing this project on a PC with the Realia, or Micro Focus Cobol version of MAGEC then you will find the (cont.) "JCL" in the member named \MAGxx\JCL\MAGLBREX.BAT and the control cards (and data cards) will be placed into the (cont.) \MAGxx\MAGECLBR.RDR member. You can access either of these using any PC editor. Many MAGEC users like the PC (cont.) implementations of SPF which are available with the MAGEC system. In the above PC direcory names, \MAGxx stands for (cont.) \MAGEC or \MAGMF, depending on which Cobol compiler is in use. Do this:** Key the control cards as shown below and submit. **Note:** The ****TRM**** control card tells MAGECLBR to trim off the prefix "VDF-" from the datanames. MAGECLBR will (cont.) automatically add a prefix of "VAD01-" as it adds the definitions to the dictionary. The first item is named "ELEMENT", which is another MAGEC standard. If you are using one of your own old COBOL definitions as input to MAGECLBR you should change the name of the first (group) item to "ELEMENT". If your Cobol level numbers begin with numbers less than 04, MAGECLBR will bump the COBOL level numbers up so that they (cont.) start with level 04 and above. This is because the data definitions will be included into the TWA under a level-03 item (cont.) (TWA-DB-DATA). The date field is defined as simply X(6). Later we will tell MAGEC that this field is a date by setting the "Edit Type", MAGEC will then generate the appropriate breakdown (YY, MM, DD) automatically. **** **Note:** The **-MAGECDEL** card is to delete any pre-existing DIT definitions for the VAD01 Element (if they exist). (cont.) If they do not exist [as in the first time you do this project on a newly installed system] then you should omit the (cont.) **-MAGECDEL** control card. The Cobol definitions in the example (Figure 10) are in standard Cobol format and indented to Cobol norms (column 8, (cont.) column 12, etc.). Virtually all valid Cobol definitions are acceptable; however, level-66 and level-77 items are not (cont.) supported. Level-88 is supported. You should always review the generated definitions online to verify that they are (cont.) correct and to add finishing touches (such as: Domain definitions, patterns edits, table validations, narrative (cont.) descriptions, etc.). Always **check the "printout"** for error or warning messages, as well. -MAGECDEL DIT VAD01 **-MAGECADD DIT VAD01 **TRM**VDF-   01  VDF-ELEMENT.   02  VDF-KEY.   03  VDF-EMPNUM  PIC 9(9).   03  FILLER  PIC X(9).   02  VDF-DATE-HIRED  PIC X(6).   02  VDF-EARNED-VACATION  PIC S9(05)V9(02) COMP-3.   02  VDF-TAKEN-VACATION  PIC S9(05)V9(02) COMP-3.   02  VDF-EARNED-SICK-DAYS  PIC S9(05)V9(02) COMP-3.   02  VDF-TAKEN-SICK-DAYS  PIC S9(05)V9(02) COMP-3.   02  VDF-EARNED-COMP-DAYS  PIC S9(05)V9(02) COMP-3.   02  VDF-TAKEN-COMP-DAYS  PIC S9(05)V9(02) COMP-3.   02  VDF-COMMENT  PIC X(00050) OCCURS 3 TIMES. Note:** The -MAGECDEL card is needed only if there are existing DIT's for this element. It should not be used if there are none. Figure 10 — MAGECLBR Control Cards When you submit the MAGLBREX jobstream, the MAGECLBR program will read the input Cobol definition and will generate (cont.) Data Item definitions (DIT's) into the dictionary for you. This is faster than manually entering each one online, (cont.) though you could accomplish the same thing that way. To submit MAGLBREX on a mainframe insert the control card(s) and data cards into the jobstream (named MAGLBREX) and (cont.) submit it. On a PC the control cards must be placed into a text file (usually named \MAGxx\MAGECLBR.RDR), the SET (cont.) SYS006 command in the .BAT file named MAGECLBR.BAT must specify the input file name (\MAGxx\MAGECLBR.RDR) and you must (cont.) type the command "MAGLBREX" at the DOS prompt, or select the MAGECLBR icon from your Windows or OS/2 control panel. You (cont.) can refer to the "Offline Utilities" chapter of the *Programmer's Reference Guide* for more (cont.) information. You should check the output listing from MAGECLBR to be sure that it completed correctly. If it did not, correct any errors and rerun. To "get back into MAGEC": **Do this:** Use "TS01" to re-enter MAGEC. **Do this:** Log on as Employee# 18, Password: ALEE. Next we will look at the generated definitions online. When MAGECLBR adds the DIT definitions from your input Cobol definition it must take defaults and make determinations (cont.) regarding the attributes of each data item based upon the Cobol PICTURE clause alone. These default attributes will, in (cont.) all cases, operate; however, they may not always produce the most aesthetically pleasing results. It is a common practice for MAGEC users to first use the MAGECLBR utility to accomplish the "grunt work" and then to (cont.) refine the DIT definitions online using the "DITCHG" function. This enables them to specify such things as a Prompt (cont.) (heading) literal and data formatting and editing rules to produce better looking screens and reports with a minimum of (cont.) effort by the application developers. **Do this:** Key the command: DITLST VAD01, press ENTER. The screen will return to you with the Data Items for VAD01 listed and showing the level numbers and PICTURE's. You can (cont.) now cursor-select any item by moving the cursor down to it's line and pressing ENTER to see it (or PF4 if you wish to (cont.) change it). Notice that the Cobol level numbers have been adjusted to comply with the MAGEC standard. ``` DITLST VAD01 END of LIST PF5=Restart/PF7=Backward ** M A G E C DATA ITEM LIST seq# Lvl . . . Data-Name . . . . . . . PICTURE Domain Name 000010 04 VAD01 ELEMENT X(00198) 000020 05 VAD01 KEY X(00018) 000030 06 VAD01 EMPNUM 9(09) 000040 06 VAD01 FILLER X(00009) 000050 05 VAD01 DATE-HIRED X(00006) 000060 05 VAD01 EARNED-VACATION S9(05)V9(02) COMP-3 000070 05 VAD01 TAKEN-VACATION S9(05)V9(02) COMP-3 000080 05 VAD01 EARNED-SICK-DAYS S9(05)V9(02) COMP-3 000090 05 VAD01 TAKEN-SICK-DAYS S9(05)V9(02) COMP-3 000100 05 VAD01 EARNED-COMP-DAYS S9(05)V9(02) COMP-3 000110 05 VAD01 TAKEN-COMP-DAYS S9(05)V9(02) COMP-3 000120 05 VAD01 COMMENT X(00050) ++++ 12 Records Scanned, 12 Displayed so far - Page 1 ++++ KEY 1 = ELT / MODE / SEQ# Press PF13 for Hardcopy You may Position the CURSOR on an item and Press ENTER to "SEE" it (Browsing Forward) or Press PF4 to "CHG" it ``` Note:** The DITLST display is a typical browse, except that it shows DIT records for only the specified Element, (cont.) stopping when it reaches the last DIT for that Element. As a typical browse, it supports cursor-selection to transfer (cont.) to a SEE or a CHG function for the selected item. Figure 11 — DITLST Screen We would now like to modify the specifications for the DATE-HIRED data item. It was defined as a simple PIC X(6) field (cont.) by MAGECLBR, we will alter that specification to tell MAGEC that this is actually a YYMMDD date field which we wish to (cont.) have displayed on the screen(s) and report(s) in the format MM/DD/YY. This will also tell MAGEC to automatically (cont.) validate any data entered into the screen(s) to update this field to ensure that it is a valid date. It will also tell (cont.) MAGEC to automatically present to the application program(s) the Julian equivalent and Day-of-Week code for the (cont.) Gregorian date on the screen. These help the applications programmers to add their own custom editing more easily, i.e. (cont.) to verify that the date is not a weekend day, etc. Cursor-select the DATE-HIRED field for update. **Do this:** Position the cursor to the line where VAD01 DATE-HIRED is listed and press PF4. The screen will now show all the specifications for the selected field. You can overtype any of the specs and press ENTER to change them. **Note:** By positioning the cursor to a line on the DITLST screen, then pressing PF4, you will have selected that item (cont.) for a CHG function. If instead of PF4, ENTER was pressed, then you will have selected that item for viewing, which is a (cont.) SEE function. To then alter data on the screen you would need to key "CHG" over the "SEE" of "DITSEE" in the function (cont.) area of the screen. ``` DITCHG VAD01/T/000050 ** M A G E C D a t a I t e m Element MAGEC Vacation Dummy data Field Seq#: 000050 Mode T Level: Data Name: Sig Dec Sign: Usage: 05 VAD01 DATE-HIRED PIC 9( 00 )V9( 00 ) EditType: U Tbl: 000 Req: Lgth: PIC X( 00006 ) Just: Occurs: 00000 Depending On: Redefines: 88-Val/Pattern: Prompt: Domain Name: DataBase Identifier: Data Item Narrative: Displacement / Length: ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ ________________________________________________________________________________ Press PF4 for browse (LOC) screen Press PF13 for Hardcopy Press PF16 to Copy field to buffer Press PF17 to Paste data from buffer Press PF2 for field-level HELP Press PF24 for Pop-up Short List ``` Figure 12 — DITCHG Screen Change the Edit Type** as shown to specify this field as being a date. An Edit Type of "M" indicates that it is to be (cont.) displayed on the screen and on reports in the MM/DD/YY format, it is stored on the file in the YYMMDD (cont.) format. Also, enter a **Prompt** for the field. The prompt will be used as the "heading" for this field on reports and as the (cont.) screen prompt for online displays and updates. If you do not specify a Prompt then MAGEC will generate one (as best it (cont.) can) using the COBOL dataname as its basis. **Do this:** Key in the Edit Type, Prompt,and Narrative as shown, press ENTER. Next: https://magec.com/DOC/markdown/data04.md.txt