--- title: "data_main" original_file: "data_main" generated: "2026-08-17 11:14:24" --- **   05 VAD01-KEY. 06 06 VAD01-EMPNUM  PIC 9(09). 07 06 VAD01-FILLER PIC X(00009). 08 05 VAD01-DATE-HIRED. 09 06 VAD01-DATE-HIRED-YY PIC XX. 10 06 VAD01-DATE-HIRED-MM PIC XX. 11 06 VAD01-DATE-HIRED-DD PIC XX. 12 05 VAD01-EARNED-VACATION PIC S9(05)V9(02) COMP-3. 13 05 VAD01-TAKEN-VACATION PIC S9(05)V9(02) COMP-3. 14 05 VAD01-EARNED-SICK-DAYS PIC S9(05)V9(02) COMP-3. 15 Move CURSOR to a line, use ERASE EOF to Delete it -or- PF20 to Insert After it Semicolon (;) is the TAB Character Asterisk (*) in col. 1 = suppress upcase ```** Figure 16 -- Copybook in Library ** NOTE: ** Now it is time to actually create and initialize your new file. If you are using a mainframe computer to do this (cont.) project you may wish to skip this step since there is little new to be learned from it. On a PC it is very easy to (cont.) create the file using the MAGINIT batch utility provided with MAGEC, therefore, you should go ahead and create (cont.) it. If you are using a mainframe you must execute IDCAMS with the appropriate control cards to DEFINE a cluster. Then you can execute MAGINIT to (cont.) initialize the file. Initialization is necesssary before you can access the file from CICS (or other TP Monitors). It (cont.) consists of opening the file "for output", writing a record to it, closing the file and (optionally) re-opening the (cont.) file and deleting the "initialization record". The JCL to execute MAGINIT is shown in the "Offline Utilities" chapter. You simply specify the new file using the DD (cont.) (or DLBL) for "NEWFILE". There are no control cards. If you are doing the project on a PC then you can simply execute (cont.) MAGINIT to both create and initialize the new file. At the DOS prompt, key the command "MAGINIT". The program will ask (cont.) you for the Data Class to be initialized, respond with "VAD" (excluding the quotes). | ``` **     DO THIS: Execute IDCAMS, then Submit MAGINIT.     ```** If you are using MAGEC on a PC with the Realia Cobol or Micro Focus Cobol compiler then the file MAGINIT.BAT is the jobstream you execute to both (cont.) create and initialize your new file. This file can be found in your \MAGEC\JCL (for Realia) or \MAGMF\JCL (for Micro (cont.) Focus) directory (depending on which Cobol compiler is installed) | ``` **     DO THIS: At the DOS prompt type the command MAGINIT VAD.     ```** ** NOTE: ** Appendix A of this tutorial tells you how to delete all of your work. You may wish to do the steps in Appendix A after you complete this project in order to clean up for the next student. # Database Utility ## DBDITO MAGEC includes a useful online utility program which allows you to do any database operation right from the screen. You (cont.) can display data, update data, add data, and delete data. You can enter in either character or in hexadecimal format. (cont.) Data is displayed in both formats simultaneously. | ``` **     DO THIS: Return to MAGEC via the "TS01" command and log on (if necessary).     ```** Once in MAGEC you must log on again (if you are told to do so), then you can use the online DBDITO utility. | ``` **     DO THIS: Key the command: DBDITO and press ENTER.     ```** The screen will look like the figure shown below. You can press, the HELP key (PF1, F1 on a PC) for instructions on how to use the DBDITO function. DBDITO is a very handy tool for debuggers, developers, and database administrators. It can help you in many ways: It can be used to find and correct bad records on a file It can be used to teach newcomers how the MAGEC database commands work It can be used to test your new/altered file definitions It can be used to create test data It can be used to un-delete records (if they are pseudodeleted) *In the wrong hands*, it can produce great damage. It is important that your security officer maintain tight control over access to this powerful function ** NOTE: ** Figure 17 (below) is shown for EBCDIC systems. If you are doing the project on an ASCII machine (i.e. IBM PC or PS/2) you will see different hexadecimal codes corresponding to the display characters. The DBDITO display shows each display character with the hexadecimal value below it in vertical format. The SPACE character is X'40' in EBCDIC and it is X'20' in ASCII. | ``` **  DBDITO ___________________________ M A G E C DATABASE UTILITY CMD _____ FILE ___ KEY _____ RTN CDE DBID ___ ELEMENTS __________________________________________________ START RECORD DISPLAY AT ____ ...................................................................... 4444444444444444444444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 ...................................................................... 4444444444444444444444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 ...................................................................... 4444444444444444444444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 ...................................................................... 4444444444444444444444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 Press PF1 for Instructions ```** Figure 17 -- DBDITO Screen You can enter the MAGEC database commands right on the screen using DBDITO. You will see the results of the commands immediately. | ``` **     DO THIS: Key in the LOCKY command as shown below, press ENTER.     ```** The LOCKY command does a generic key "start browse". The **key valu****e** will be taken from the "data area" of the screen (where character/hex is displayed over/under). | ``` ** DBDITO Command: ```** The **FILE **portion of the command is where you specify the Data Class. In the **KEY** portion you specify the name of the key. In the **ELEMENTS** area you list the Elements you wish to read. Commands which begin with "LOC" (such as LOCKY) only return the key value which was found. For more information on the (cont.) DB commands, you can refer to Appendix B of this chapter, and the "Database Administration" chapter. ** NOTE: ** The data is displayed in character/hex (over/under) format. If you were using DBDITO to update the data, you could (cont.) enter in either character or hexadecimal, or in a combination of the two. To enter data in hexadecimal, you must type a (cont.) dot (.) in the character position and the desired hex code in the two rows below the dot. If the character row (top (cont.) row) contains any character other than a dot, DBDITO will accept it as the desired character and will compute its (cont.) hexadecimal value and display it below. If the character row contains a dot, DBDITO will compute the character value (cont.) for the hexadecimal code and will display it in the character row above the hex code. If the character is not (cont.) displayable on a 3270, DBDITO will display a dot in that position. Spaces are displayed as dots, (cont.) also. Type a dot in the character position if you want MAGEC to accept your input in hexadecimal below for that character. If (cont.) the character position is any character other than a dot, MAGEC will accept the character, ignoring the hexadecimal (cont.) value below it. | ``` **  DBDITO ___________________________ M A G E C DATABASE UTILITY CMD LOCKY FILE VAD KEY VADK1 RTN CDE DBID ___ ELEMENTS VAD01_____________________________________________ START RECORD DISPLAY AT 0001 ...................................................................... 0000000000000000004444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 ...................................................................... 4444444444444444444444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 ...................................................................... 4444444444444444444444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 ...................................................................... 4444444444444444444444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 Press PF1 for Instructions ```** ** NOTE: ** The DBDITO display shows character values on the first line and hex values velow in orver-under format. The hex values (cont.) are shown in EBCDIC or ASCII, based upon which environment you are running in. This example shows the EBCDIC display (cont.) (HEX '40' for spaces). FIgure 18 -- DBDITO Screen If there are no records on the file you will receive a message saying NO RECORD FOUND on the bottom of the screen. This (cont.) is a normal circumstance if you access the file immediately following its initializtion (using MAGINIT). In mainframe (cont.) environments the MAGINIT program can be modified to either leave one record (the initialization record) on the file, or (cont.) to delete it. It is often convenient in a CICS environement to leave the initialization record on the file -- it can be (cont.) deleted using any CICS program or using DBDITO. The screen will be displayed showing the found key value from the file in the data area. It is shown in character/hex, (cont.) over/under format. The figure shown below shows how the display might look. It shows the hexadecimal values in EBCDIC, (cont.) as they might appear on a mainframe. On a PC you would see a similar screen with ASCII. DBDITO displays the character (cont.) value on the top line of each row of data, unless the character is non-displayable. Then it displays a dot (.) in that (cont.) position. If you wanted to update the data you could key in the changes in character format on the top line, or in hex in the (cont.) lines below. If you wish to update by keying in hex you must be sure that the character (top) line contains a dot in (cont.) the positions where you want your hex entry to be taken. This allows you to key both character and hex into one (cont.) screenful of data, saving keystrokes and translation difficulties. On the bottom of the screen DBDITO displays the (cont.) access method and error messages (translation of the return code) if appropriate. The DB command to update a record is "UPDAT". A list of the DB commands may be found in Appendix B of this tutorial. (cont.) For additional detailed information on the DB commands (also referred to as MAGECIO commands) please refer to the (cont.) "Database Administration" chapter . | ``` **     DO THIS: See below.     ```** | ``` **  DBDITO ___________________________ M A G E C DATABASE UTILITY CMD LOCKY FILE VAD KEY VADK1 RTN CDE DBID ___ ELEMENTS VAD01 START RECORD DISPLAY AT 0001 XXXXXXXXXXXXXXXXXX.................................................... EEEEEEEEEEEEEEEEEE4444444444444444444444444444444444444444444444444444 77777777777777777700000000000000000000000000000000000000000000000000000 ...................................................................... 4444444444444444444444444444444444444444444444444444444444444444444444 0000000000000000000000000000000000000000000000000000000000000000000000 Next: https://magec.com/DOC/markdown/data02.md.txt