MAKAP - 1.00 MAKAP is a utility for accessing Bridgeware capture files. The primary uses of MAKAP are: Reading capture files: MAKAP can read and display data within a capture file. This can be useful when developing Warehouse scripts to process capture files or diagnosing script problems. Writing capture files: MAKAP can write records to capture files to simulate files created by Bridgeware. This is useful to test that Warehouse scripts can handle unusual data conditions. Copying capture files: MAKAP can copy capture files with a new header format in the target. This can be useful if you have capture files that have a different header than a Warehouse script is expecting. The operation of MAKAP is controlled by a configuration file. The name of the configuration file is specified on the command line. Example: MAKAP MYCFG RUN MAKAP;INFO="MYCFG" When MAKAP is run the lines of the configuration file are processed. A configuration file is setup for a specific task, such as reading or writing a capture file. MAKAP Configuration file commands (case insensitive): Database access commands: BASE Opens database for dataset layouts. SCHEMA Uses schema file for dataset layouts. SHOW Shows layout of dataset. LIST Shows databases. Capture file access commands: CAPTURE [] Specifies target capture file. OPENCAP [] Specifies source capture file. CAPMODE [ ] Specifies header format. Flags for CAPMODE, CAPTURE, COPYCAP and OPENCAP are: REGHDR Specifies regular header. EXTHDR Specifies extended header. YYYY Specifies YYYY header dates. YY Specifies YY header dates. RECNUM Specifies record nubmer in header. Commands for accessing variables: DEFINE [,..] : Defines work variable(s). SET MSG. = Sets header field value. SET REC. = Sets record field value. SET UPD. = Sets update field value. SET = Sets value of variable. READ Reads from db and fills REC and UPD. PRINT . Displays value of variable Commands to write to capture file: INSERT Writes INSERT record to capture file. UPDATE Writes UPDATE record to capture file. DELETE Writes DELETE record to capture file. COPYCAP [ ] Copes all records from source. Commands for displaying a capture file: PRINTCAP [START=s] [RECS=n] Reads and displays capture records. PAGELENGTH length Sets page length. Default is 0. PAGEWIDTH width Sets page width. Default is 78. OUTPUT Sets output file. MAKAP Expressions: Operators in order of precedence: 1. () Parenthesis [n] Element n of array [*] All elements of array Type cast (start:len) Item subset 2. - Unary negative + Unary positive 3. * Multiplication / Division Modulus 5. + Addition - Subtraction || String concatenation Expression examples: 1. SET MSG.SEQ = "001000" 2. SET REC.NAME = REC.FNAME || REC.LNAME 3. SET REC.AMTS[*] = 0 MAKAP Data Types: E2 16-bit IEEE floating point (Unsupported) E4 32-bit IEEE floating point (Unsupported) I1,J1,K1 16-bit binary integer I2,J2,K2 32-bit binary integer I4,J4,K4 64-bit binary integer Pn Packed decimal number R2 16-bit HP3000 floating point (Unsupported) R4 32-bit HP3000 floating point (Unsupported) Un,Xn Character data Zn Zoned decimal number Creating Configuration Files Configuration files are maintained in any text editor. They must be unnumbered files. Lines beginning with a pound sign (#) are considered comments. A :FILE equation may be used to override file names in the configuration files. This eliminates the need to change the configuration file simply to access a different capture file. It may be easier to use if you wrap the :FILE equation and the run of MAKAP in a command file. Reading capture files A configuration file to read and display a capture file can be made by using the following commands in the configuration file: 1. Use BASE or SCHEMA commands to indicate the layout of datasets within the capture file. If you use a SCHEMA command, you must also indicate the correct file, group and account of the database represented by the schema. 2. Use the OPENCAP command to open the capture file for reading and specify header options used in the capture file. The file will not display correctly unless the header options specified exactly match the header actually in the capture file. 3. If printing to the screen, the configuration file should have a PAGELENGTH 23 command so that the display is stopped after 23 lines of output. If printing to a file, an OUTPUT command be used to indicate the output file and a PAGEWIDTH command may needed to print wider lines. 4. The PRINTCAP command is then used to display the capture file. You may wish to use the START=s and RECS=n parameters to control the start and number of records displayed. 5. After the configuration file is made, it may be convenient to create a command file to access the configuration file. Sample configuration file to display a capture file to the screen: ######################################################## # Reads and displays from CAPFILE. Use a :FILE equation # to point to the actual capture file. BASE MACORD.MACSDATA.SGADEV PASSWD 5 OPENCAP CAPFILE YYYY EXTHDR PAGEWIDTH 78 PAGELENGTH 23 PRINTCAP Sample MPE/iX command file to print command file using MKCONF: PARM CAPFPARM=*,CFG=MKCCONF IF "!CAPFPARM" = "*" ECHO Must specify capture file name. ESCAPE ENDIF FILE CAPFILE=!CAPFPARM RUN MAKAP;INFO="!CFG" Writing capture files A configuration file to write insert, update and delete records can be made by using the following commands in the configuration file: 1. Use a BASE command to open the database represented in the capture file. 2. Use a CAPTURE command to open the capture file for writing and specify header options used in the capture file. 3. Use a READ command to read data from the database into variables that can be modified with the SET command. The READ command fills the record variables with actual values from the database so every field does not require a SET. 4. Modify the variables using SET statements. "SET REC." sets a value in the data record to be written to the capture file. "SET UPD." sets a value in the update record to be written to the capture file. "SET MSG." sets a value in the header part of the record to be written to the capture file. 5. Use an INSERT, DELETE, or UPDATE command to write a record to the capture file. 6. Repeat steps 4 and 5 setting values and writing to the capture file until all test cases have been covered. Sample configuration file to write a capture file: BASE MACORD.MACSDATA.SGADEV PASSWD 5 CAPTURE ORDCAPF YYYY EXTHDR ######################################################## # Case 1: SV_MACORD_ORDER-HEADER insert, update, delete read order-header set rec.CUST-EDP = 63201 set rec.DIVISION = "00" set rec.COMPANY = "00" set rec.FULL-ORDER-NO = "123456780012" set rec.SOURCE = "1705 1010" insert set upd.COMPANY = "01" set upd.DIVISION = "00" set upd.SOURCE = "1708 1004" update delete Copying capture files A configuration file to copy a capture file can be made by using the following commands in the configuration file: 1. Use a CAPTURE command to open the target capture file for writing and specify header options used in the target capture file. 2. Use a COPYCAP command to open the source capture file and specify header options used in the capture file. The file will not be copied correctly unless the header options specified exactly match the header actually in the capture file. After the source capture file is opened, all of the records are copied to the target capture file while making any necessary changes to the header in each record. Sample configuration file to copy a capture file: ######################################################## # Reads from OCAP001 and writes to ORDCAPF adding an # extended header to the target. CAPTURE ORDCAPF YYYY COPYCAP OCAP0001 YYYY EXTHDR