![]() |
SimoZAPS Data Convert, Compare or Hex-View http://www.simotime.com Copyright © 1987-2010 SimoTime Enterprises All Rights Reserved |
| Table of Contents | Version 09.05.17 |
When working in a shared systems environment it is quite often necessary to view, modify, convert or compare the content and format of data files. This is especially true when moving source code, JCL or control files between the mainframe, an application server and the PC. The ability to quickly convert the format and modify the content between ASCII and EBCDIC is a requirement. The ability to view or dump the content of a file in a hexadecimal display format can also be very helpful. When testing an application it is quite useful to be able to compare the contents of two data files and to select the information to be compared within a record.
In many circumstances these tasks are repetitive and run as transparent, automated processes. In this environment it is more important to be able to create a callable program or batch file than it is to have a graphical user interface that may require some human interaction during the execution process. The techniques used to do data file conversion or comparison must be able to execute on a Windows platform, a UNIX platform or the mainframe.
SimoZAPS is a collection of utility programs that are designed to fill this niche. SimoZAPS provides the following capabilities.
| 1. | View the contents of a file in hexadecimal format with translation to EBCDIC or ASCII whenever possible. Scan a file and find information based on a user-submitted argument. The find argument may be specified in ASCII, EBCDIC or Hexadecimal format. Patch bytes of information within a file based on a user submitted patch value. The patch information may be specified in ASCII, EBCDIC or HEX. |
| 2. | Generate COBOL programs that will convert data files on the mainframe, a Windows platform with Micro Focus or a UNIX platform with Micro Focus. Provide for the conversion of file format, record format and record content changes. Convert between ASCII and EBCDIC encoded formats at the field level while maintaining numeric encoded fields (packed or binary). |
| 3. | Generate a COBOL program that will compare the contents of two files. |
| 4. | Read an ASCII/Text file and create an EBCDIC, 80-byte, fixed record length file. |
| 5. | Read an EBCDIC, 80-byte, fixed record length file and create an ASCII/Text file. |
| 6. | Read an ASCII file of mixed case and create an ASCII file of all upper case. |
| 7. | Read an ASCII file of mixed case and create an ASCII file of all lower case. |
| 8. | Read a COBOL source program and create a new file with case formatting. |
| 9. | Read an ASCII/Text file and create a new ASCII/Text file allowing include, omit and global changes to the individual records. |
In most cases SimoZAPS does not change the input file. It creates a copy of the file that contains the modifications. The PATCH function of HEXCESS makes changes directly to the specified file name.
SimoZAPS does not actually do the data conversion or comparison, it generates COBOL source code (or programs) that will be used to do the data conversion or comparison. This technique has two advantages.
1. The COBOL source code may be compiled and executed on a Windows or UNIX platform using Micro Focus COBOL or on the mainframe using IBM COBOL/2 or a later version.
2. The generated COBOL source code may be changed to meet unique or specialized
processing requirements.
SimoZAPS requires approximately 1.1M of disk space. Windows/2000, Windows/NT or Windows/98 is the required operating system. The SimoZAPS program, this documentation, the Installation Verification Procedures (IVP's) and examples are provided in a zip'ed file. Additional information about acquiring SimoZAPS may be obtained from http://www.simotime.com/evaltek2.htm
To install SimoZAPS create a directory as follows.
C:\>md simolibr C:\>cd SimoLIBR C:\SIMOLIBR>md DataWrk1 C:\SIMOLIBR>md HTML C:\SIMOLIBR>md LOGS C:\SIMOLIBR>pkunzip simozaps.zip
Note: If the target install directory for SimoLIBR is changed it will be necessary to modify the ZAPSREC1.CMD, ZAPSREC2.CMD and the IVP.CMD's to access the new directory structure. Also, the modified SimoLIBR directory should be added to the path statement.
SimoZAPS contains a suite of Installation Verification Programs (IVP's). Their primary purpose is to verify that SimoZAPS has been properly installed. Their secondary purpose is to serve as sample programs.
The following is an overview of the IVP's.
| Program | Description |
| IVP4HEX1 | Use the HEXCESS VIEW function to display the contents of a file in Hexadecimal with an EBCDIC and ASCII interpretation. |
| IVP4HEX2 | Use the HEXCESS FIND function to find text strings within a file and display the contents of the matching segment in Hexadecimal with an EBCDIC and ASCII interpretation. |
| IVP4HEX3 | Use the HEXCESS PATCH function to patch a 1 to 32 byte area within a file. |
| IVP4GFC1 | Use the GENERATE function to read a SEQUENTIAL, 80-byte, fixed, EBCDIC file and create an ASCII/CRLF, 80-byte, variable, ASCII file. Note: this function does not do the actual conversion. This function generates (or creates) the COBOL source code for a program that will do the conversion. |
| IVP4GFC2 | Use the GENERATE function to read a SEQUENTIAL, 80-byte, fixed, EBCDIC file and create an INDEXED, 256-byte, variable, ASCII file with key position at 1 for a key length of 6. Note: this function does not do the actual conversion. This function generates (or creates) the COBOL source code for a program that will do the conversion. |
| IVP4GFC3 | Use the GENERATE function to read a SEQUENTIAL, 80-byte, fixed, EBCDIC file and create a SEQUENTIAL, 80-byte, fixed, ASCII file. Note: this function does not do the actual conversion. This function generates (or creates) the COBOL source code for a program that will do the conversion. |
| IVP4GFC4 | Use the GENERATE function to read an ASCII/CRLF, 80-byte, variable, ASCII file and create an INDEXED, 80-byte, variable, EBCDIC file. Note: this function does not do the actual conversion. This function generates (or creates) the COBOL source code for a program that will do the conversion. |
| IVP4ZAP1 | Use the MODIFY function to do a global replace of a text string in a single file or multiple files using a list of file names. |
| IVP4ZAP2 | Use the MODIFY function to create a batch file that will rename all the members in a directory using lower case characters. |
| IVP4ZAP3 | Use the FormatCOBOL function to format a COBOL source member. |
The following three procedures will demonstrate the uses of the View, Find and Patch functions of SimoZAPS.
The following command ( IVP4HEX1.CMD) will run the HEXCESS VIEW function to verify that SimoZAPS is installed and working.
C:\SIMOLIBR> ivp4hex1
The content of the IVP4HEX1.CMD file is as follows.
@echo OFF rem * rem * This procedure will read the HELLO.CBL file and produce rem * a SYSLOG.TXT file that contains hexadecimal display rem * information with an EBCDIC and ASCII translation when rem * possible. The information is also displayed on the screen. rem * echo * IVP4HEX1 Starting the VIEW function of HEXCESS set syslog=syslog.txt if exist syslog.txt erase syslog.txt run SimoZAPS HEXCESS hello.cbl view=129 stop=256 echo * echo * IVP4HEX1 The SYSLOG is displayed in a separate window, echo * IVP4HEX1 to continue... close the SYSLOG window. notepad syslog.txt echo * IVP4HEX1 Thank you for using HEXCESS by SimoTime Enterprises
Refer to The HEXCESS View Function for a more detailed description of the preceding process.
The following command ( IVP4HEX2.CMD)will run the HEXCESS FIND function to verify that SimoZAPS is installed and working.
C:\SIMOLIBR> ivp4hex2
The content of the IVP4HEX2.CMD file is as follows.
@echo OFF rem * rem * This procedure will read the HELLO.CBL file and produce rem * a SYSLOG.TXT file that contains hexadecimal display rem * information with an EBCDIC and ASCII translation when rem * possible. The information is also displayed on the screen. rem * The information displayed is selected based on the search rem * argument of the FIND function. rem * echo * IVP4HEX2 Starting the FIND function of HEXCESS set syslog=syslog.txt if exist syslog.txt erase syslog.txt run SimoZAPS HEXCESS hello.cbl find=1 len=8 ascii=division echo * echo * IVP4HEX2 The SYSLOG is displayed in a separate window, echo * IVP4HEX2 to continue... close the SYSLOG window. notepad syslog.txt echo * IVP4HEX2 Thank you for using HEXCESS by SimoTime Enterprises
Refer to The HEXCESS Find Function for a more detailed description of the preceding process.
The following command ( IVP4HEX3.CMD)will run the HEXCESS PATCH function to verify that SimoZAPS is installed and working.
C:\SIMOLIBR> ivp4hex3
The content of the IVP4HEX3.CMD file is as follows.
@echo OFF rem * rem * This procedure will read the HELLO.CBL file and modify or rem * patch the file directly. This is one of the functions that rem * does NOT create a new file. Therefore, make a backup copy rem * of the file prior to making any changes that use the rem * patch function. rem * echo * IVP4HEX3 Starting the PATCH function of HEXCESS set syslog=syslog.txt if exist syslog.txt erase syslog.txt run SimoZAPS HEXCESS hello.cbl patch=1 len=6 hex=303132333435 echo * echo * IVP4HEX3 The SYSLOG is displayed in a separate window, echo * IVP4HEX3 to continue... close the SYSLOG window. notepad syslog.txt echo * IVP4HEX3 Thank you for using HEXCESS by SimoTime Enterprises
Refer to the The HEXCESS Patch Function for a more detailed description of the preceding process.
The GENERATE function will generate (or create) the source code for a program that will do a file conversion. The following four Installation Verification Procedures (IVP's) are provided to verify proper installation of SimoZAPS and the proper configuration for the GENERATE function. Detailed information about the IVP's is provided in the Using SimoZAPS section.
The following command ( Ivp4Gfc1.CMD) will run the GENERATE function to create the COBOL source code for doing a file conversion from an EBCDIC Sequential file to an ASCII Text file.
C:\SIMOLIBR> Ivp4Gfc1
Refer to Generate a File Conversion Program for a more detailed description of the preceding process.
The following command ( Ivp4Gfc2.CMD) will run the GENERATE function to create the COBOL source code for doing a file conversion from an EBCDIC Sequential file to an ASCII Indexed file.
C:\SIMOLIBR> ivp4gfc2
Refer to Generate a File Conversion Program for a more detailed description of the preceding process.
The following command ( Ivp4Gfc3.CMD) will run the GENERATE function to create the COBOL source code for doing a file conversion from an EBCDIC Sequential file to an ASCII Indexed file.
C:\SIMOLIBR> ivp4gfc3
Refer to Generate a File Conversion Program for a more detailed description of the preceding process.
The following command ( Ivp4Gfc4.CMD) will run the GENERATE function to create the COBOL source code for doing a file conversion from an ASCII Text file to an EBCDIC Indexed file.
C:\SIMOLIBR> ivp4gfc4
Refer to Generate a File Conversion Program for a more detailed description of the preceding process.
The following command ( Ivp4Gfc5.CMD) will run the GENERATE function to create the COBOL source code for doing a file conversion from an ASCII Text file to an EBCDIC Indexed file. This IVP uses a random add and update approach for adding or updating records to the output file.
C:\SIMOLIBR> ivp4gfc5
Refer to Generate a File Conversion Program for a more detailed description of the preceding process.
The GENERATE function will generate (or create) the source code for a program that will do a file comparison of two files at the record level. The following Installation Verification Procedure (IVP) is provided to verify proper installation of SimoZAPS and the proper configuration for the GENERATE function for Data File Comparison. Detailed information about the IVP's is provided in the Using SimoZAPS section. The following command will run the IVP for the Data File Compare function.
C:\SIMOLIBR> IvpZfcG1
The following is the Window's Commandl file (IvpZfcG1.CMD) that executes the IVP.
@echo OFF
setlocal
set PostNote=c:\SimoLIBR\LOGS\SimoTime.LOG
set JobStatus=0000
set ShowCode=SHOW
rem *
call :PostNote "************************************************************IvpZfcG1.CMD"
call :PostNote "Starting JobName IvpZfcG1, User is %USERNAME%"
echo ************************************************************
echo * This program is provided by: *
echo * SimoTime Enterprises, LLC *
echo * (C) Copyright 1987-2010 All Rights Reserved *
echo * Web Site URL: http://www.simotime.com *
echo * e-mail: helpdesk@simotime.com *
echo ************************************************************
echo * Text: Read a control file, Create a COBOL data file
echo * comparison program..
echo * Author: SimoTime Enterprises
echo * Version: 04.07.23
echo *
rem *
rem *
call :PostNote "************************************************************"
call :PostNote "* This step will create the HTML documentation based on *"
call :PostNote "* the copy file that defines the record structure. *"
rem *
call Rec1HTML c:\SimoLIBR\ITEMCB01.CPY c:\SimoLIBR\HTML\ITEMMAST.HTM IBM NOPAUSE
if ERRORLEVEL = 1 goto :EojNOK
call :PostNote "* The HTML document has been created. *"
rem *
call :PostNote "************************************************************"
call :PostNote "* This step will generate the COBOL program that compares *"
call :PostNote "* two data files. If a difference is encountered the delta *"
call :PostNote "* information will be displayed and written to a log file. *"
rem *
call ZapsCOMP c:\SimoLIBR\IvpZfcT1.txt c:\SimoLIBR\DataWrk1\IvpZcpC1.CBL
if ERRORLEVEL = 1 goto :EojNOK
call :PostNote "* The COBOL comparison program has been generated. *"
rem *
goto :EojAok
rem *
rem ****************************************************************
rem * Display the message and write to the log file using ECHO.
rem * The ~ causes the leading/trailing double-quotes to be removed.
rem *
:PostNote
@echo OFF
echo %date% %time% %~1 >> %PostNote%
echo %~1
goto :EOF
rem * The preceding :EOF causes a return to caller within this CMD.
rem *
rem *********************************************************************
:EojNOK
call :PostNote "ABENDING JobName IvpZfcG1, User is %USERNAME%"
pause
rem *
rem *********************************************************************
:EojAOK
call :PostNote "Finished JobName IvpZfcG1, User is %USERNAME%"
echo * Thank you for using the GENERATE function by SimoTime Enterprises
pause
rem *
:End
The following command ( Ivp4Zap1.CMD) will run the MODIFY function to verify that SimoZAPS is installed and working.
C:\SIMOLIBR> ivp4zap1
Refer to The MODIFY Function, Changing a Text String for a more detailed description of the preceding process.
The following command ( Ivp4Zap2.CMD) will run the MODIFY function to verify that SimoZAPS is installed and working.
C:\SIMOLIBR> ivp4zap2
Refer to The MODIFY Function, Member Names in Lower Case for a more detailed description of the preceding process.
The following command ( Ivp4Zap3.CMD) will run the FormatCOBOL function to verify that SimoZAPS is installed and working.
C:\SIMOLIBR> ivp4zap3
Refer to The FormatCOBOL Function, Format a COBOL Program for Case Consistency for a more detailed description of the preceding process.
SimoZAPS is divided into five functional areas. The following table is a quick summary of the functional areas.
| Function | Description | ||||
| HexCess | This function will read a file and produce a new file containing hexadecimal dump information. The new file (SYSLOG) is ASCII/Text. In addition to the hexadecimal format the SYSLOG includes an EBCDIC and ASCII translation when possible. | ||||
| Generate |
|
||||
| Translate | This function provides for simple translation between ASCII/Text and EBCDIC/80-byte files. Both the content (ASCII or EBCDIC) and file format (variable-text and fixed-80-byte) are converted. | ||||
| Modify | This function provides the capability of copying an ASCII/Text file. The content of the output file may be modified in the process. Individual records may be included or deleted based on their content. Also, individual records that are being copied may be modified using such keywords as insert, append, replace and more. | ||||
| FormatCOBOL | This function simply provides a consistent use of upper and lower case for COBOL source code. Many times we work with COBOL code that has evolved over a number of years and the use of upper and lower case varies widely. With the consistent use of upper/lower case it makes the code easier to read and understand. |
The functions provided by SimoZAPS are described in more detail in the following sections.
The hexadecimal access function (HEXCESS) provides a "VIEW" capability (or hexadecimal dump) of a file in hexadecimal format. When possible the EBCDIC and ASCII characters are displayed. The hexadecimal view information is displayed and written to a SYSLOG file. The starting and stopping positions may be specified.
HEXCESS provides a "FIND" capability. A search argument may be specified and the input file is read until a data match is found. Once a data match is found the 128 byte section of the file containing the match is displayed and written to the SYSLOG file.
HEXCESS provides a "PATCH" capability. A data string of a maximum of thirty-two (32) bytes may be specified on the command line. This data string will be written at the position specified within the file.
The HEXCESS function of SimoZAPS is run from the command line as follows.
C:\> run SIMOZAPS HEXCESS filename Keyword=parameter ...
VIEW=start-position STOP=stop-position
FIND=start-position LENGTH=nnn ASCII=xxx
EBCDIC=xxx
HEX=xxxx
PATCH=start-position LENGTH=nnn ASCII=xxx
EBCDIC=xxx
HEX=xxxx
The following is a summary of the keyword=parameters capabilities provided by SimoZAPS and the HEXCESS function.
| Run | Function | filename |
|
|||||||||
| SIMOZAPS | HEXCESS | filename |
|
|||||||||
| SIMOZAPS | HEXCESS | filename |
|
|||||||||
| SIMOZAPS | HEXCESS | filename |
|
HEXCESS includes three installation verification procedures (IVP's) that also serve as examples.
The IVP4HEX1.BAT does a simple hexadecimal view. The information is displayed to the screen and written to the SYSLOG file. The following shows the content of the batch file.
@echo OFF rem * rem * This procedure will read the HELLO.CBL file and produce rem * a SYSLOG.TXT file that contains hexadecimal display rem * information with an EBCDIC and ASCII translation when rem * possible. The information is also displayed on the screen. rem * echo * IVP4HEX1 Starting the VIEW function of HEXCESS set syslog=syslog.txt if exist syslog.txt erase syslog.txt run SimoZAPS HEXCESS hello.cbl view=129 stop=256 echo * echo * IVP4HEX1 The SYSLOG is displayed in a separate window, echo * IVP4HEX1 to continue... close the SYSLOG window. notepad syslog.txt echo * IVP4HEX1 Thank you for using HEXCESS by SimoTime Enterprises
The following is the hexadecimal dump information that is displayed and written to the SYSLOG.
* Hexcess2 hello.cbl view 129 stop 256 * Hexcess2 Starting at 000000000129 * Hexcess2 Stopping at 000000000256 * Hexcess2 File size 000000002287 Position Hex..... ........ ........ ........ ebcdic.......... ascii........... 000000129 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ **************** 000000145 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ **************** 000000161 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A0D0A ................ **************.. 000000177 20202020 20202A0D 0A202020 2020202A ................ *.. * 000000193 20534F55 52434520 4D4F4455 4C452048 ..|.....(|..<... SOURCE MODULE H 000000209 454C4C4F 2E43424C 0D0A2020 20202020 .<<|...<........ ELLO.CBL.. 000000225 2A0D0A20 20202020 202A2A2A 2A2A2A2A ................ *.. ******* 000000241 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ **************** * Hexcess2 Program-is-ENDING...
The IVP4HEX2.BAT does a find and dump when a match is found. The match process is not case sensitive. the the argument for the FIND is specified in upper case it will find text string matches that are upper. lower or mixed case. For example, a FIND argument of 'ABC' would find a match for 'ABC', 'abc', or 'aBc'.
The hexadecimal find information is displayed to the screen and written to the SYSLOG file. The following shows the content of the batch file.
@echo OFF rem * rem * This procedure will read the HELLO.CBL file and produce rem * a SYSLOG.TXT file that contains hexadecimal display rem * information with an EBCDIC and ASCII translation when rem * possible. The information is also displayed on the screen. rem * The information displayed is selected based on the search rem * argument of the FIND function. rem * echo * IVP4HEX2 Starting the FIND function of HEXCESS set syslog=syslog.txt if exist syslog.txt erase syslog.txt run SimoZAPS HEXCESS hello.cbl find=1 len=8 ascii=division echo * echo * IVP4HEX2 The SYSLOG is displayed in a separate window, echo * IVP4HEX2 to continue... close the SYSLOG window. notepad syslog.txt echo * IVP4HEX2 Thank you for using HEXCESS by SimoTime Enterprises
The following is the hexadecimal find information that is displayed and written to the SYSLOG.
* Hexcess2 hello.cbl find 1 length 8 ascii division * Hexcess2 Find from 000000000001 * Hexcess2 Length is 000000000008 * Hexcess2 Find ASCII division * Hexcess2 File size 000000002287 * Hexcess2 Hit Position 000000000023 * Hex-Find Starting... Dump Length = 0128 Position Hex..... ........ ........ ........ ebcdic.......... ascii........... 000000007 20494445 4E544946 49434154 494F4E20 ....+........|+. IDENTIFICATION 000000023 44495649 53494F4E 2E0D0A20 20202020 ......|+........ DIVISION... 000000039 20205052 4F475241 4D2D4944 2E202020 ..&.|...(....... PROGRAM-ID. 000000055 2048454C 4C4F2E0D 0A202020 20202020 ...<<|.......... HELLO... 000000071 41555448 4F522E20 20202020 2020204D ....|..........( AUTHOR. M 000000087 49434841 454C2053 494D4D4F 4E532E0D .....<...((|+... ICHAEL SIMMONS.. 000000103 0A202020 2020202A 2A2A2A2A 2A2A2A2A ................ . ********* 000000119 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ **************** * Hex-Find Complete... Dump Length = 0128 * Hexcess2 Hit Position 000000000825 * Hex-Find Starting... Dump Length = 0128 Position Hex..... ........ ........ ........ ebcdic.......... ascii........... 000000809 20202020 454E5649 524F4E4D 454E5420 .....+...|+(.+.. ENVIRONMENT 000000825 44495649 53494F4E 2E0D0A20 20202020 ......|+........ DIVISION... 000000841 202A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ *************** 000000857 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ **************** 000000873 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ **************** 000000889 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ **************** 000000905 2A2A0D0A 20202020 20202A0D 0A202020 ................ **.. *.. 000000921 20202020 44415441 20444956 4953494F ...............| DATA DIVISIO * Hex-Find Complete... Dump Length = 0128 * Hexcess2 Hit Position 000000000930 * Hex-Find Starting... Dump Length = 0128 Position Hex..... ........ ........ ........ ebcdic.......... ascii........... 000000914 202A0D0A 20202020 20202044 41544120 ................ *.. DATA 000000930 44495649 53494F4E 2E0D0A20 20202020 ......|+........ DIVISION... 000000946 2020574F 524B494E 472D5354 4F524147 ...|...+....|... WORKING-STORAG 000000962 45205345 4354494F 4E2E0D0A 20202020 .......|+....... E SECTION... 000000978 20202A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ ************** 000000994 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A20 ................ *************** 000001010 20202020 20202020 20202020 20202020 ................ 000001026 20202020 20202020 20202020 20202020 ................ * Hex-Find Complete... Dump Length = 0128 * Hexcess2 Hit Position 000000001777 * Hex-Find Starting... Dump Length = 0128 Position Hex..... ........ ........ ........ ebcdic.......... ascii........... 000001761 20202020 20205052 4F434544 55524520 ......&.|....... PROCEDURE 000001777 44495649 53494F4E 2E0D0A0D 0A202020 ......|+........ DIVISION..... 000001793 20202020 20202020 50655266 4F724D20 ........&...|.(. PeRfOrM 000001809 506F5374 2D436F50 79526947 68542E0D &?....?&`....... PoSt-CoPyRiGhT.. 000001825 0A0D0A20 20202020 20202020 20207045 ................ ... pE 000001841 72466F52 6D204469 53704C61 592D4865 ..?._.....</.... rFoRm DiSpLaY-He 000001857 4C6C4F2D 576F526C 442E0D0A 0D0A2020 >%|..?.%........ LlO-WoRlD..... 000001873 20202020 20202020 20474F42 41434B2E ..........|..... GOBACK. * Hex-Find Complete... Dump Length = 0128 * Hexcess2 Find Count 000000000004 * Hexcess2 Program-is-ENDING...
The IVP4HEX3.BAT does a patch and dump using the specified data string from the command line. The hexadecimal dump information is displayed to the screen and written to the SYSLOG file. The following shows the content of the batch file.
Please note: The hexadecimal values specified by the HEX keyword will need to match with the output
@echo OFF rem * rem * This procedure will read the HELLO.CBL file and modify or rem * patch the file directly. This is one of the functions that rem * does NOT create a new file. Therefore, make a backup copy rem * of the file prior to making any changes that use the rem * patch function. rem * echo * IVP4HEX3 Starting the PATCH function of HEXCESS set syslog=syslog.txt if exist syslog.txt erase syslog.txt run SimoZAPS HEXCESS hello.cbl patch=1 len=6 hex=303132333435 echo * echo * IVP4HEX3 The SYSLOG is displayed in a separate window, echo * IVP4HEX3 to continue... close the SYSLOG window. notepad syslog.txt echo * IVP4HEX3 Thank you for using HEXCESS by SimoTime Enterprises
The following is the hexadecimal dump information that is displayed and written to the SYSLOG.
* Hexcess2 hello.cbl patch 1 length 6 hex 303132333435 * Hexcess2 Patching at 000000000001 * Hexcess2 Length is 000000000006 * Hexcess2 Patch HEX 303132333435 * Hexcess2 File size 000000002287 * HexPatch Starting... Dump Length = 0128 Position Hex..... ........ ........ ........ ebcdic.......... ascii........... 000000001 30313233 34352049 44454E54 49464943 ..........+..... 012345 IDENTIFIC 000000017 4154494F 4E204449 56495349 4F4E2E0D ...|+.......|+.. ATION DIVISION.. 000000033 0A202020 20202020 50524F47 52414D2D ........&.|...(. . PROGRAM- 000000049 49442E20 20202048 454C4C4F 2E0D0A20 .........<<|.... ID. HELLO... 000000065 20202020 20204155 54484F52 2E202020 ..........|..... AUTHOR. 000000081 20202020 204D4943 4841454C 2053494D .....(.....<...( MICHAEL SIM 000000097 4D4F4E53 2E0D0A20 20202020 202A2A2A (|+............. MONS... *** 000000113 2A2A2A2A 2A2A2A2A 2A2A2A2A 2A2A2A2A ................ **************** * HexPatch Complete... Dump Length = 0128 * Hexcess2 Program-is-ENDING...
The Mainframe Express (MFE) and Net Express products from Micro Focus offer excellent program development environments that run on the PC. Both products have an "Options" capability that provides for the integration of programs and other development tools. This section describes how to integrate the Hex-Dump capabilities of SimoZAPS into either the MFE or Net Express desktop. It is assumed that SimoZAPS has been installed in the C:\SIMOLIBR directory.
If all you want to do is a Hex-Dump of PC files the SIMOZAPS.EXE member is all that is needed. It was originally designed to run from a PC Command Line as a batch process. Using the ZAPSHEX1.CMD file makes it a simple process to add the Hex-Dump capability to the MFE or Net Express toolbar.
The following shows the content of the ZAPSHEX1.CMD file.
@echo OFF
set JobStatus=0000
set SYSLOG=c:\SimoLIBR\LOGS\ZapsDump.LOG
rem *
call SimoNote "*******************************************************ZapsHex1"
call SimoNote "Starting JobName ZapsHex1"
rem *
run simozaps hexcess %1 view=%2 stop=%3
if errorlevel = 1 set JobStatus=0001
if not "%JobStatus%" == "0000" goto :EojNOK
rem *
echo * ZapsHex1 The HexDump Information is displayed in separate window using Notepad,
echo * ZapsHex1 please close the separate Notepad window to end the task.
START notepad %SYSLOG%
rem *
:EojAOK
call SimoNote "Finished JobName ZapsHex1"
goto :End
:EojNOK
call SimoNote "ABENDING JobName ZapsHex1"
call SimoNote "ABENDING Message JobStatus %JobStatus%"
goto :End
:End
if not "%4" == "nopause" pause
Note: depending on the version of Windows you are running the pause statement may or may-not be required.
From the toolbar of the desktop for MFE or Net Express select Options, then select Customize IDE from the drop-down menu and a new window will be displayed.
From the "Customize IDE" window select the Tools Tab, then select New Tool.
Enter the following for the Enter menu text prompt.
HexCess 1st 1K, highlight a file
Now enter the following values
| Command: | c:\SIMOLIBR\ZAPSHEX1.CMD |
| Arguments: | $(FileSel) 1 1024 nopause |
| Start in: | c:\simolibr |
Note: The $(FileSel) will substitute the name of the high-lighted member when executing ZAPS4MFE.BAT from the MFE or Net Express Tool bar.
Click OK and this will complete the process of integrating the Hex-Dump function of SimoZAPS.
From the MFE or Net Express desktop (either the source member list or the catalog for MFE) select a member or simple high-light a member name.
Select the Tools option from the MFE or Net Express Tool bar, then select the HexCess 1st 1K, highlight a file from the drop-down menu.
Note: The dump information will scroll in a window and the dump information will be written to the ZAPSDUMP.LOGfile. Notepad will be used to view the dump file.
SimoZAPS does not actually do the Data File Conversion or Comparison. It generates COBOL source code that does the actual conversion or comaprison. This COBOL source code may be compiled and executed on a mainframe (z/OS or VSE), a Personal Computer (Micro Focus COBOL) or a UNIX platform (Micro Focus COBOL). The following sections describe the Data File Conversion and Comparison processes in more detail.
This function will generate the COBOL source code for a file conversion program. This file conversion program (SYSCOBOL) will read an input file (SYSUT1) and create a new output file (SYSUT2). The format of SYSUT1 and SYSUT2 is specified by records contained in a control or specifications file (SYSCNTL).
|
Start the process | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
Determine if a CONVERT request and call SimoCNVT. | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
|
|
|
Read the specifications from SYSCNTL and use SYSMODEL as a template to create SYSCOBOL.CBL. | |||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||
|
End-of-Job | |||||||||||||||||||||||||||
The following is an example of a batch file that will generate the source code for a file conversion program.
@echo OFF rem * rem * The process will read the SYSCNTL1.TXT file and create the rem * ZAP001C1.CBL file using the SYSMASK1.TXT as a mask. rem * The SYSCNTL1.TXT file is expected to contains the specifications rem * for reading a sequential, 80-byte, fixed, EBCDIC file and creating rem * an ASCII/CRLF, 80-byte, variable, ASCII file that uses a rem * carriage-return and line-feed as a record separator. rem * echo * IVP4GFC1 Starting the GENERATE function of SimoZAPS set syscntl=syscntl1.txt set sysmodel=sysmask1.txt set syscobol=zap001c1.cbl type %syscntl% run simozaps generate echo * IVP4GFC1 SYSCNTL is %syscntl% echo * IVP4GFC1 SYSCOBOL is %syscntl% echo * IVP4GFC1 The SYSCOBOL is displayed in a separate window, echo * IVP4GFC1 to continue... close the SYSCOBOL window. notepad %syscobol% echo * IVP4GFC1 Thank you for using the GENERATE function by SimoTime Enterprises
The following is an example of a SYSCNTL file.
*********************************************************************** * SYSUT1 should be a sequential, 80-byte, fixed, ebcdic file. * * SYSUT2 should be a ASCII/CRLF, 80-byte, variable, ascii file. * * * * The DIALECT statement specifies the use of COBOL/2 compliant code * * for the generated conversion program. * * * * The TransLATE statement will move the input record of SYSUT1 to the * * output record of SYSUT2 and then translate the output record of * * SYSUT2 from EBCDIC to ASCII based on the parameter specified in the * * TransMODE Statement (E2A). * *********************************************************************** /DIALECT C2 /PROGID ZAP001C1 /SYSUT1 org=SEQUENTIAL recfm=FIXED rlen=80 /SYSUT2 org=ASCII/CRLF recfm=VARIABLE rlen=80 * /TRANSMODE E2A /TRANSLATE from POS 1 LEN 80 to POS 1 LEN 80 * /END
The following is a description of the statements (or record types) contained in the control file (SYSCNTL).
| The following keyword/parameters are used for file and translate definitions. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| The following keyword/parameters are used for data transfer/manipulation within a record. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The following member (ASCEBCB1.CPY) is the source code (or COBOL copy file) for the ASCII - EBCDIC conversion tables.
*****************************************************************
* Copyright (C) 1987-2010 SimoTime Enterprises *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* The following tables are used by the INSPECT statement to do *
* the conversion between EBCDIC and ASCII. *
* inspect FIELD-NAME converting EBCDIC-INFO to ASCII-INFO *
* inspect FIELD-NAME converting ASCII-INFO to EBCDIC-INFO *
* *
* The tables may also be used to convert between lower and *
* upper case. *
* inspect FIELD-NAME converting EBCDIC-LOWER to EBCDIC-UPPER *
* inspect FIELD-NAME converting ASCII-LOWER to ASCII-UPPER *
* *
* The tables include the alphabet for upper and lower case, the *
* digits 0-9, the special characters (US) and the alternate *
* codes for A, E, I, O, and U with the appropriate acute, *
* grave, umlat, circumflex and tilde. *
* To display the alternate codes the Courier New (Fixed) or *
* Times New Roman (Proportional) font should be used. *
* *
* SimoZAPS contains four tables that may be used for various *
* Upper/Lower Case or EBCDIC/ASCII conversion requirements. *
* ASCEBCB1.CPY - includes a full character set for the alphabet *
* (upper/lower case), digit, special characters *
* and alternate codes for characters with the *
* acute, grave, umlat, tilde and circumflex. *
* ASCEBCB2.CPY - includes the character set for the translation *
* between EBCDIC/ASCII of signed/unsigned, *
* zoned-decimal, numeric fields. *
* ASCEBCB3.CPY - includes the character set for the alternate *
* codes with the acute, grave, umlat, tilde and *
* circumflex. This is primarily used for case *
* conversion. *
* ASCEBCB4.CPY - includes the character set for the alphabet *
* (upper/lower case), digit, special characters. *
* This is primarily used in the US where the *
* alternate codes are not required. *
*****************************************************************
*
* ------------------------------------------------------------
* ** The EBCDIC Table ...
* ** 01 EBCDIC space character 40
* ** 02 A B C D E F G H I
* ** 03 J K L M N O P Q R
* ** 04 S T U V W X Y Z
* ** 05 a b c d e f g h i
* ** 06 j k l m n o p q r
* ** 07 s t u v w x y z
* ** 08 0 1 2 3 4 5 6 7 8 9
* ** 09 . < ( + | & ! $ * )
* ** 10 ;5F - / , % _ > ? `
* ** 11 7D/7F Single/Double quote : # @7D =7F [ ] { }
* ** 12 \ ~ ^
01 EBCDIC-DATA.
05 EBCDIC-SPACE pic X value X'40'.
05 E-UPPER.
10 EBCDIC-UPPER-CASE-USA.
15 filler pic X(9) value X'C1C2C3C4C5C6C7C8C9'.
15 filler pic X(9) value X'D1D2D3D4D5D6D7D8D9'.
15 filler pic X(8) value X'E2E3E4E5E6E7E8E9'.
10 E-UPPER-USA redefines EBCDIC-UPPER-CASE-USA
pic X(26).
10 EBCDIC-UPPER-CASE-EXT.
15 filler pic X(7) value X'62636465666769'. IN-AN
15 filler pic X(8) value X'7172737475767778'. IN-EI
15 filler pic X(5) value X'EBECEDEEEF'. IN-O
15 filler pic X(6) value X'FBFCFDFE9EAD'. IN-UAEY
15 filler pic X(2) value X'6780'. IN-AO
10 E-UPPER-EXT redefines EBCDIC-UPPER-CASE-EXT
pic X(28).
05 EBCDIC-UPPER redefines E-UPPER
pic X(54).
05 E-LOWER.
10 EBCDIC-LOWER-CASE-USA.
15 filler pic X(9) value X'818283848586878889'.
15 filler pic X(9) value X'919293949596979899'.
15 filler pic X(8) value X'A2A3A4A5A6A7A8A9'.
10 E-LOWER-USA redefines EBCDIC-LOWER-CASE-USA
pic X(26).
10 EBCDIC-LOWER-CASE-EXT.
15 filler pic X(7) value X'42434445464749'. IN-an
15 filler pic X(8) value X'5152535455565758'. IN-ei
15 filler pic X(5) value X'CBCCCDCECF'. IN-o
15 filler pic X(6) value X'DBDCDDDE9C8D'. IN-uaey
15 filler pic X(2) value X'4770'. IN-ao
10 E-LOWER-EXT redefines EBCDIC-LOWER-CASE-EXT
pic X(28).
05 EBCDIC-LOWER redefines E-LOWER
pic X(54).
05 EBCDIC-DIGITS.
10 filler pic X(10) value X'F0F1F2F3F4F5F6F7F8F9'.
05 EBCDIC-SPECIAL.
10 filler pic X(10) value X'4B4C4D4E4F505A5B5C5D'.
10 filler pic X(10) value X'5E5F60616B6C6D6E6F79'.
10 filler pic X(10) value X'7A7B7C7D7E7FBABBC0D0'.
10 filler pic X(6) value X'E0A1B020B1B2'.
01 E-INFO redefines EBCDIC-DATA pic X(155).
01 EBCDIC-TABLE redefines EBCDIC-DATA.
05 EBCDIC-BYTE pic X occurs 155 times.
*
* ------------------------------------------------------------
* ** The ASCII Table ...
* ** 01 ASCII space character 20
* ** 02 A B C D E F G H I
* ** 03 J K L M N O P Q R
* ** 04 S T U V W X Y Z
* ** 05 a b c d e f g h i
* ** 06 j k l m n o p q r
* ** 07 s t u v w x y z
* ** 08 0 1 2 3 4 5 6 7 8 9
* ** 09 . < ( + | & ! $ * )
* ** 10 ;5F - / , % _ > ? `
* ** 11 27/22 Single/Double quote : # @27 =22 [ ] { }
* ** 12 \ ~ ^
01 ASCII-DATA.
05 ASCII-SPACE pic X value X'20'.
05 A-UPPER.
10 ASCII-UPPER-CASE-USA.
15 filler pic X(9) value X'414243444546474849'.
15 filler pic X(9) value X'4A4B4C4D4E4F505152'.
15 filler pic X(8) value X'535455565758595A'.
10 A-UPPER-USA redefines ASCII-UPPER-CASE-USA
pic X(26).
10 ASCII-UPPER-CASE-EXT.
15 filler pic X(7) value X'C2C4C0C1C3C5D1'. IN-AN
15 filler pic X(8) value X'C9CACBC8CDCECFCC'. IN-EI
15 filler pic X(5) value X'D4D6D2D3D5'. IN-O
15 filler pic X(6) value X'DBDCD9DAC6DD'. IN-UAEY
15 filler pic X(2) value X'C5D8'. IN-AO
10 A-UPPER-EXT redefines ASCII-UPPER-CASE-EXT
pic X(26).
05 ASCII-UPPER redefines A-UPPER
pic X(52).
05 A-LOWER.
10 ASCII-LOWER-CASE-USA.
15 filler pic X(9) value X'616263646566676869'.
15 filler pic X(9) value X'6A6B6C6D6E6F707172'.
15 filler pic X(8) value X'737475767778797A'.
10 A-LOWER-USA redefines ASCII-LOWER-CASE-USA
pic X(26).
10 ASCII-LOWER-CASE-EXT.
15 filler pic X(7) value X'E2E4E0E1E3E5F1'. IN-a+
15 filler pic X(8) value X'E9E2E4E0EDEEEFEC'. IN-ei
15 filler pic X(5) value X'F4F6F2F3F5'. IN-o
15 filler pic X(6) value X'FBFCF9FAE6FD'. IN-uaey
15 filler pic X(2) value X'E5F8'. IN-ao
10 A-LOWER-EXT redefines ASCII-LOWER-CASE-EXT
pic X(26).
05 ASCII-LOWER redefines A-LOWER
pic X(52).
05 ASCII-DIGITS.
10 filler pic X(10) value X'30313233343536373839'.
05 ASCII-SPECIAL.
10 filler pic X(10) value X'2E3C282B7C2621242A29'.
10 filler pic X(10) value X'3BAC2D2F2C255F3E3F60'.
10 filler pic X(10) value X'3A2340273D225B5D7B7D'.
10 filler pic X(6) value X'5C7E5E80A3A5'.
01 A-INFO redefines ASCII-DATA pic X(155).
01 ASCII-TABLE redefines ASCII-DATA.
05 ASCII-BYTE pic X occurs 155 times.
*! ASCEBCB1 - End-of-Copy File ... Version 05.11.09
The GENERATE Function includes two COBOL source code templates or masks. The first mask (SYSMASK1.TXT} provides the COBOL source code for sequential processing and should be used when the SYSCOBOL or output file is not an indexed file or when the output is an indexed file and the records are written sequentially by key.
The second mask file (SYSMASK2.TXT) should be used when the output file will be an indexed file and the records are written and the keys may not be in sequential order.
The format of the records in the mask file are as follows.
| Columns | Description |
| 1-6 | Should be spaces or a keyword SPACES - copy the record PROGID - the ampersand strings in columns 8-72 will be replaced with the program ID. CNVRT - This record will be replaced with the BUILD-OUTPUT-RECORD logic. OPEN2 - the ampersand string will be replaced with OUTPUT or I-O for open. |
| 7-72 | COBOL source code |
| 73-80 | ignored. |
Columns 1-6 of each record within each of the records in the SYSMASK file should be spaces or a valid keyword. If Columns 1-6 contains a valid keyword then the statement is processed according to the keyword. Otherwise, the statement is simply copied from the SYSMASK file to the SYSCOBOL file.
The following is the source code for the mask that does sequential output.
*****************************************************************
* This program was created using the SYSMASK1.TXT file as input.*
* The SYSMASK1 provides for the sequential reading of the input *
* file (SYSUT1) and the sequential writing of the output file *
* (SYSUT2). If the output file (SYSUT2) is indexed then the *
* input file (SYSUT1) must be in sequence by the field that *
* will be used to provide the key for the output file (SYSUT2). *
* If the key field is not in sequence then refer to SYSMASK2 *
* to provide for a random add or update of the indexed file. *
*****************************************************************
WORKING-STORAGE SECTION.
01 SIM-TITLE.
PROGID 05 T1 pic X(11) value '* &&&&&&&& '.
05 T2 pic X(34) value 'Data File Content Modification '.
05 T3 pic X(10) value ' v2.0.00 '.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
PROGID 05 C1 pic X(11) value '* &&&&&&&& '.
05 C2 pic X(18) value '(C) Copyright 2001'.
05 C3 pic X(30) value ' SimoTime Enterprises, LLC '.
05 C4 pic X(20) value ' All Rights Reserved'.
*
01 MESSAGE-BUFFER.
PROGID 05 MESSAGE-HEADER pic X(11) value '* &&&&&&&& '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
*
01 SYSUT1-STATUS.
05 SYSUT1-STATUS-L pic X.
05 SYSUT1-STATUS-R pic X.
01 SYSUT1-EOF pic X value 'N'.
01 SYSUT1-OPEN-FLAG pic X value 'C'.
*
01 SYSUT2-STATUS.
05 SYSUT2-STATUS-L pic X.
05 SYSUT2-STATUS-R pic X.
01 SYSUT2-EOF pic X value 'N'.
01 SYSUT2-OPEN-FLAG pic X value 'C'.
*
01 IO-STATUS.
05 IO-STAT1 pic X.
05 IO-STAT2 pic X.
01 TWO-BYTES.
05 TWO-BYTES-LEFT pic X.
05 TWO-BYTES-RIGHT pic X.
01 TWO-BYTES-BINARY redefines TWO-BYTES pic 9(4) comp.
*
01 APPL-RESULT pic S9(9) comp.
88 APPL-AOK value 0.
88 APPL-EOF value 16.
*
01 EBCDIC-SPACE pic X value X'40'.
01 EBCDIC-ZERO pic X value X'F0'.
01 ASCII-SPACE pic X value X'20'.
01 ASCII-ZERO pic X value X'30'.
*
01 SYSUT1-TOTAL.
05 filler pic X(21) value 'SYSUT1 line count is '.
05 SYSUT1-LOC pic 9(7) value 0.
01 SYSUT2-TOTAL.
05 filler pic X(21) value 'SYSUT2 line count is '.
05 SYSUT2-LOC pic 9(7) value 0.
*
*****************************************************************
* The following copy file contains the translation tables for *
* the ASCII and EBCDIC conversion. Sections of the tables may *
* also be used for case conversion. *
*****************************************************************
COPY ASCEBCB1.
*
*****************************************************************
PROCEDURE DIVISION.
perform POST-COPYRIGHT
perform SYSUT1-OPEN
perform SYSUT2-OPEN
*
perform until SYSUT1-STATUS not = '00'
perform SYSUT1-READ
if SYSUT1-STATUS = '00'
add 1 to SYSUT1-LOC
perform BUILD-OUTPUT-RECORD
perform SYSUT2-WRITE
if SYSUT2-STATUS = '00'
add 1 to SYSUT2-LOC
end-if
end-if
end-perform
*
move SYSUT1-TOTAL to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
*
move SYSUT2-TOTAL to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
*
if APPL-EOF
move 'is Complete...' to MESSAGE-TEXT
else
move 'is ABENDING...' to MESSAGE-TEXT
end-if
perform DISPLAY-CONSOLE-MESSAGE
*
perform SYSUT2-CLOSE
perform SYSUT1-CLOSE
GOBACK.
*
*****************************************************************
* The following routines are in alphabetical sequence.. *
*****************************************************************
*
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform DISPLAY-CONSOLE-MESSAGE
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
add 12 to ZERO giving RETURN-CODE
STOP RUN
exit.
*
CNVRT * This statement will be replaced by SimoZAPS.
*
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
DISPLAY-CONSOLE-MESSAGE.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79) upon console
else
display MESSAGE-BUFFER upon console
end-if
move all SPACES to MESSAGE-TEXT
exit.
*
*****************************************************************
* Display the file status bytes. This routine will display as *
* two digits if the full two byte file status is numeric. If *
* second byte is non-numeric then it will be treated as a *
* binary number. *
*****************************************************************
DISPLAY-IO-STATUS.
if IO-STATUS NOT NUMERIC
or IO-STAT1 = '9'
subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
move IO-STAT2 to TWO-BYTES-RIGHT
PROGID display '* &&&&&&&& File-Status-' IO-STAT1 '/'
TWO-BYTES-BINARY upon console
else
PROGID display '* &&&&&&&& File-Status-' IO-STATUS upon console
end-if
exit.
*
*****************************************************************
POST-COPYRIGHT.
display SIM-TITLE upon console
display SIM-COPYRIGHT upon console
exit.
*
*****************************************************************
* I/O ROUTINES FOR SYSUT1... *
*****************************************************************
SYSUT1-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close SYSUT1-FILE
if SYSUT1-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'SYSUT1-Failure-CLOSE...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT1-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT1-READ.
read SYSUT1-FILE
if SYSUT1-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if SYSUT1-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if
if APPL-AOK
CONTINUE
else
if APPL-EOF
move 'Y' to SYSUT1-EOF
else
move 'SYSUT1-Failure-GET...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT1-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
SYSUT1-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input SYSUT1-FILE
if SYSUT1-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to SYSUT1-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'SYSUT1-Failure-OPEN...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT1-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*
*****************************************************************
* I/O ROUTINES FOR SYSUT2... *
*****************************************************************
SYSUT2-WRITE.
if SYSUT2-OPEN-FLAG = 'C'
perform SYSUT2-OPEN
end-if
write SYSUT2-RECORD
if SYSUT2-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if SYSUT2-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if.
if APPL-AOK
CONTINUE
else
move 'SYSUT2-Failure-WRITE...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT2-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT2-OPEN.
add 8 to ZERO giving APPL-RESULT.
OPEN2 open &&&&&& SYSUT2-FILE
if SYSUT2-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to SYSUT2-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'SYSUT2-Failure-OPEN...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT2-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT2-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close SYSUT2-FILE
if SYSUT2-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'C' to SYSUT2-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'SYSUT2-Failure-CLOSE...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT2-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
The following is the mask that does output to an indexed file when the keys are not in sequence. This code will do an add of new records and an update of existing records.
*****************************************************************
* This program was created using the SYSMASK2.TXT file as input.*
* The SYSMASK2 provides for the sequential reading of the input *
* file (SYSUT1) and the random writing of the output file *
* (SYSUT2). If the output file (SYSUT2) is indexed then the *
* input file (SYSUT1) does not need to be in sequence by the *
* field that will be used to provide the key for the output *
* file (SYSUT2). *
* New records will be added and existing records will be *
* updated. If duplicate keys are provided from SYSUT1 then only *
* the information from the last record will be reflected in the *
* output file (SYSUT2). *
*****************************************************************
WORKING-STORAGE SECTION.
01 SIM-TITLE.
PROGID 05 T1 pic X(11) value '* &&&&&&&& '.
05 T2 pic X(34) value 'Data File Content Modification '.
05 T3 pic X(10) value ' v2.0.00 '.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
PROGID 05 C1 pic X(11) value '* &&&&&&&& '.
05 C2 pic X(18) value '(C) Copyright 2001'.
05 C3 pic X(30) value ' SimoTime Enterprises, LLC '.
05 C4 pic X(20) value ' All Rights Reserved'.
*
01 MESSAGE-BUFFER.
PROGID 05 MESSAGE-HEADER pic X(11) value '* &&&&&&&& '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
*
01 SYSUT1-STATUS.
05 SYSUT1-STATUS-L pic X.
05 SYSUT1-STATUS-R pic X.
01 SYSUT1-EOF pic X value 'N'.
01 SYSUT1-OPEN-FLAG pic X value 'C'.
01 SYSUT1-RECORD-FOUND pic X value 'N'.
*
01 SYSUT2-STATUS.
05 SYSUT2-STATUS-L pic X.
05 SYSUT2-STATUS-R pic X.
01 SYSUT2-EOF pic X value 'N'.
01 SYSUT2-OPEN-FLAG pic X value 'C'.
01 SYSUT2-RECORD-FOUND pic X value 'N'.
*
01 IO-STATUS.
05 IO-STAT1 pic X.
05 IO-STAT2 pic X.
01 TWO-BYTES.
05 TWO-BYTES-LEFT pic X.
05 TWO-BYTES-RIGHT pic X.
01 TWO-BYTES-BINARY redefines TWO-BYTES pic 9(4) comp.
*
01 APPL-RESULT pic S9(9) comp.
88 APPL-AOK value 0.
88 APPL-EOF value 16.
*
01 X1 pic 9(5) value 0.
01 X2 pic 9(5) value 0.
01 X3 pic 9(5) value 0.
*
01 B1 pic 9(5) value 0.
01 REGISTER-1 pic 9(5) value 128.
01 BIT-OFF pic X value '0'.
01 BIT-ON pic X value '1'.
01 BTS-PASS-BITS pic X value LOW-VALUE.
01 BTS-PASS-BYTES pic X(8) value '00000000'.
01 EIGHT-BYTES pic X(8) value '00000000'.
01 EBCDIC-BIT-MASK pic X(8) value '11110000'.
01 EBCDIC-SPACE pic X value X'40'.
01 EBCDIC-ZERO pic X value X'F0'.
01 ASCII-BIT-MASK pic X(8) value '00110000'.
01 ASCII-SPACE pic X value X'20'.
01 ASCII-ZERO pic X value X'30'.
*
01 SYSUT1-TOTAL.
05 filler pic X(21) value 'SYSUT1 records read '.
05 SYSUT1-RDR pic 9(9) value 0.
01 SYSUT2-TOTAL.
05 filler pic X(21) value 'SYSUT2 records added '.
05 SYSUT2-ADD pic 9(9) value 0.
05 filler pic X(17) value ' records updated '.
05 SYSUT2-UPD pic 9(9) value 0.
*
*****************************************************************
* The following copy file contains the translation tables for *
* the ASCII and EBCDIC conversion. Sections of the tables may *
* also be used for case conversion. *
*****************************************************************
COPY ASCEBCB1.
*
*****************************************************************
PROCEDURE DIVISION.
perform POST-COPYRIGHT
perform SYSUT1-OPEN
perform SYSUT2-OPEN
*
PERFORM UNTIL SYSUT1-EOF = 'Y'
IF SYSUT1-EOF = 'N'
PERFORM SYSUT1-READ
IF SYSUT1-EOF = 'N'
add 1 to SYSUT1-RDR
PERFORM BUILD-OUTPUT-RECORD
PERFORM SYSUT2-READ
PERFORM BUILD-OUTPUT-RECORD
IF SYSUT2-RECORD-FOUND = 'Y'
add 1 to SYSUT2-UPD
PERFORM SYSUT2-REWRITE
ELSE
add 1 to SYSUT2-ADD
PERFORM SYSUT2-WRITE
END-IF
END-IF
END-IF
END-PERFORM.
*
move SYSUT1-TOTAL to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
*
move SYSUT2-TOTAL to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
*
if APPL-EOF
move 'is Complete...' to MESSAGE-TEXT
else
move 'is ABENDING...' to MESSAGE-TEXT
end-if
perform DISPLAY-CONSOLE-MESSAGE
*
perform SYSUT2-CLOSE
perform SYSUT1-CLOSE
GOBACK.
*
*****************************************************************
* The following routines are in alphabetical sequence.. *
*****************************************************************
*
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform DISPLAY-CONSOLE-MESSAGE
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
add 12 to ZERO giving RETURN-CODE
STOP RUN
exit.
*
CNVRT * This statement will be replaced by SimoZAPS...
*
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
DISPLAY-CONSOLE-MESSAGE.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79) upon console
else
display MESSAGE-BUFFER upon console
end-if
move all SPACES to MESSAGE-TEXT
exit.
*
*****************************************************************
* Display the file status bytes. This routine will display as *
* two digits if the full two byte file status is numeric. If *
* second byte is non-numeric then it will be treated as a *
* binary number. *
*****************************************************************
DISPLAY-IO-STATUS.
if IO-STATUS NOT NUMERIC
or IO-STAT1 = '9'
subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
move IO-STAT2 to TWO-BYTES-RIGHT
PROGID display '* &&&&&&&& File-Status-' IO-STAT1 '/'
TWO-BYTES-BINARY upon console
else
PROGID display '* &&&&&&&& File-Status-' IO-STATUS upon console
end-if
exit.
*
*****************************************************************
POST-COPYRIGHT.
display SIM-TITLE upon console
display SIM-COPYRIGHT upon console
exit.
*
*****************************************************************
* I/O ROUTINES FOR SYSUT1... *
*****************************************************************
SYSUT1-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close SYSUT1-FILE
if SYSUT1-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'SYSUT1-Failure-CLOSE...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT1-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT1-READ.
read SYSUT1-FILE
if SYSUT1-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if SYSUT1-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if
if APPL-AOK
CONTINUE
else
if APPL-EOF
move 'Y' to SYSUT1-EOF
else
move 'SYSUT1-Failure-GET...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT1-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
SYSUT1-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input SYSUT1-FILE
if SYSUT1-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to SYSUT1-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'SYSUT1-Failure-OPEN...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT1-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*
*****************************************************************
* I/O ROUTINES FOR SYSUT2... *
*****************************************************************
SYSUT2-WRITE.
if SYSUT2-OPEN-FLAG = 'C'
perform SYSUT2-OPEN
end-if
write SYSUT2-RECORD
if SYSUT2-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if SYSUT2-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if.
if APPL-AOK
CONTINUE
else
move 'SYSUT2-Failure-WRITE...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT2-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT2-REWRITE.
if SYSUT2-OPEN-FLAG = 'C'
perform SYSUT2-OPEN
end-if
rewrite SYSUT2-RECORD
if SYSUT2-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if SYSUT2-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if.
if APPL-AOK
CONTINUE
else
move 'SYSUT2-Failure-WRITE...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT2-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT2-OPEN.
add 8 to ZERO giving APPL-RESULT.
open I-O SYSUT2-FILE
if SYSUT2-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to SYSUT2-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'SYSUT2-Failure-OPEN...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT2-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT2-READ.
move 'N' to SYSUT2-RECORD-FOUND
move 'N' to SYSUT2-EOF
add 12 to ZERO giving APPL-RESULT
read SYSUT2-FILE
evaluate SYSUT2-STATUS
when '00' move 'Y' to SYSUT2-RECORD-FOUND
subtract APPL-RESULT from APPL-RESULT
when '23' move 'N' to SYSUT2-RECORD-FOUND
subtract APPL-RESULT from APPL-RESULT
when '10' move 'N' to SYSUT2-RECORD-FOUND
move 'Y' to SYSUT2-EOF
subtract APPL-RESULT from APPL-RESULT
end-evaluate.
if APPL-AOK
CONTINUE
else
move 'SYSUT2-Failure-GET...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT2-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT2-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close SYSUT2-FILE
if SYSUT2-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'C' to SYSUT2-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'SYSUT2-Failure-CLOSE...' to MESSAGE-TEXT
perform DISPLAY-CONSOLE-MESSAGE
move SYSUT2-STATUS to IO-STATUS
perform DISPLAY-IO-STATUS
perform ABEND-PROGRAM
end-if
exit.
The following provides additional detail for the IVP (IVP4GFC1.CMD) that creates a program to read an EBCDIC Sequential file and create an ASCII Text file.
@echo OFF
setlocal
set JobStatus=0000
set SimoNote=c:\SimoLIBR\LOGS\SimoTIME.LOG
call :PostNote "************************************************************Ivp4Gfc1"
echo * Ivp4Gfc1 * Installation Verification Procedure *
echo * Ivp4Gfc1 * The SimoZAPS Generate Function *
echo * Ivp4Gfc1 * SimoTime Enterprises, LLC *
echo * Ivp4Gfc1 * (C) Copyright 1987-2010 All Rights Reserved *
echo * Ivp4Gfc1 * Web Site URL: http://www.simotime.com *
echo * Ivp4Gfc1 * e-mail: helpdesk@simotime.com *
echo * Ivp4Gfc1 ************************************************************
call :PostNote "Starting JobName Ivp4Gfc1, User is %USERNAME%"
rem *
rem * This process will read the SYSCNTL1.TXT file and create the
rem * ZAP001C1.CBL file using the SYSMASK1.TXT as a mask.
rem * The SYSCNTL1.TXT file is expected to contains the specifications
rem * for reading a sequential, 80-byte, fixed, EBCDIC file and creating
rem * an ASCII/CRLF, 80-byte, variable, ASCII file that uses a
rem * carriage-return and line-feed as a record separator.
rem *
set SYSCNTL=syscntl1.txt
set SYSMODEL=sysmask1.txt
set SYSCOBOL=zap001c1.cbl
call :PostNote "SYSCNTL is %syscntl%"
call :PostNote "SYSMODEL is %sysmask%"
call :PostNote "SYSCOBOL is %syscobol%"
type %syscntl%
run simozaps generate
if ERRORLEVEL = 1 set JobStatus=0020
if not "%JobStatus%" == "0000" goto EojNok
goto :EojAok
rem *
rem ****************************************************************
rem * Display the message and write to the log file using ECHO.
rem * The ~ causes the leading/trailing double-quotes to be removed.
rem *
:PostNote
if "%SimoNote%" == "" set SimoNote=c:\SimoTime.LOG
echo %date% %time% %~1 >> %SimoNote%
echo * Ivp4Gfc1 %~1
goto :EOF
rem * The preceding :EOF is a reserved word/label that returns to
rem * the statement after the call to :PostNote.
rem *
rem ******************************************************************************
:EojNok
call :PostNote "ABENDING JobName Ivp4Gfc1, Job Status is %JobStatus%..."
goto :End
:EojAok
call :PostNote "Finished JobName Ivp4Gfc1..."
echo * Ivp4Gfc1 SYSCOBOL source is displayed in a separate window using NotePAD.
echo * Ivp4Gfc1 Thank you for using the GENERATE function by SimoTime Enterprises
if "%1" == "NOSHOW" goto :End
start notepad %syscobol%
goto :End
:End
This example uses the following control file (SYSCNTL1.TXT).
*********************************************************************** * SYSUT1 should be a sequential, 80-byte, fixed, ebcdic file. * * SYSUT2 should be a ASCII/CRLF, 80-byte, variable, ascii file. * * * * The DIALECT statement specifies the use of COBOL/2 compliant code * * for the generated conversion program. * * * * The TransLATE statement will move the input record of SYSUT1 to the * * output record of SYSUT2 and then translate the output record of * * SYSUT2 from EBCDIC to ASCII based on the parameter specified in the * * TransMODE Statement (E2A). * *********************************************************************** /DIALECT C2 /PROGID ZAP001C1 /SYSUT1 name=ZAP001D1 org=SEQUENTIAL recfm=FIXED rlen=80 /SYSUT2 name=ZAP001D2 org=ASCII/CRLF recfm=VARIABLE rlen=80 * /TRANSMODE E2A /TRANSINIT X'20' /TRANSLATE from POS 1 LEN 80 to POS 1 LEN 80 * /END
You may view the COBOL source code that is generated from the information in the control file (SYSCNTL1.TXT) and the mask file (SYSMASK1.TXT).
The following provides additional detail for the IVP (IVP4GFC2.CMD) that creates a program to read an EBCDIC Sequential file and create an ASCII Indexed file.
@echo OFF
rem *
rem * This process will read the SYSCNTL2.TXT file and create the
rem * ZAP001C1.CBL file using the SYSMASK1.TXT as a mask.
rem * The SYSCNTL2.TXT file is expected to contains the specifications
rem * for reading a sequential, 80-byte, fixed, EBCDIC file and creating
rem * an INDEXED, 256-byte maximum record length, variable, ASCII file
rem * with the key position at 1 for a key length of 6.
rem *
echo * IVP4GFC2 Starting the GENERATE function of SimoZAPS
set SYSCNTL=syscntl2.txt
set SYSMODEL=sysmask1.txt
set SYSCOBOL=zap002c1.cbl
type %syscntl%
run simozaps GENERATE
echo * IVP4GFC2 SYSCOBOL is %syscobol%
echo * IVP4GFC2 SYSCNTL is %syscntl%
call :PostNote "Finished JobName Ivp4Gfc2..."
if "%1" == "NOSHOW" goto :End
echo * Ivp4Gfc2 SYSCOBOL source is displayed in a separate window using NotePAD.
start notepad %syscobol%
:End
echo * Ivp4Gfc2 Thank you for using the GENERATE function by SimoTime Enterprises
This example uses the following control file (SYSCNTL2.TXT).
*********************************************************************** * SYSUT1 should be a sequential, 80-byte, fixed, ebcdic file. * * SYSUT2 should be an INDEXED, 256-byte, variable, ascii file * * with key position at 1 for a key length of 6. * * * * The DIALECT statement specifies the use of COBOL/2 compliant code * * for the generated conversion program. * * * * The TransINIT statement will initialize the SYSUT2 record to X'20' * * or an ASCII SPACE character. This is especially useful when the * * output record length for SYSUT2 is greater than the input record * * length of SYSUT1. The hex value is used since the generated program * * could run on the PC or the mainframe. * * * * The VSAMLOAD statement specifies a sequential load or add of * * records to the indexed (i.e VSAM KSDS) file. If the input records * * (from SYSUT1) do not provide records in sequence by the key then a * * write error will occur when an attempt is made to write the record * * to SYSUT2. The IVP4GFC5.BAT provides an example of an unordered or * * random load or update of a VSAM Keyed Sequential Data Set. * *********************************************************************** /Dialect C2 /VSAMload Sequential /progid ZAP002C1 /sysut1 org=sequential recfm=fixed rlen=80 /sysut2 org=indexed recfm=variable rlen=256 klen=6 kpos=1 * /transinit X'20' * /transmode E2A /translate From pos 1 len 80 To pos 1 len 80 * /END
You may view the COBOL source code that is generated from the information in the control file (SYSCNTL2.TXT) and the mask file (SYSMASK1.TXT).
The following provides additional detail for the IVP (IVP4GFC3.CMD) that creates a program to read an EBCDIC Sequential file and create an ASCII Indexed file.
@echo OFF
rem *
rem * This process will read the SYSCNTL3.TXT file and create the
rem * ZAP003C1.CBL file using the SYSMASK1.TXT as a mask.
rem * The SYSCNTL3.TXT file is expected to contains the specifications
rem * for reading a sequential, 80-byte, fixed, EBCDIC file and creating
rem * a sequential, 80-byte, fixed, ascii file.
rem * This example does a simple copy of an EBCDIC sequential file to an
rem * ASCII sequential file of the same record length.
rem *
echo * IVP4GFC3 Starting the GENERATE function of SimoZAPS
set SYSCNTL=syscntl3.txt
set SYSMODEL=sysmask1.txt
set SYSCOBOL=zap003c1.cbl
type %syscntl%
run simozaps GENERATE
echo * IVP4GFC3 SYSCOBOL is %syscobol%
echo * IVP4GFC3 SYSCNTL is %syscntl%
call :PostNote "Finished JobName Ivp4Gfc3..."
if "%1" == "NOSHOW" goto :End
echo * Ivp4Gfc3 SYSCOBOL source is displayed in a separate window using NotePAD.
start notepad %syscobol%
:End
echo * Ivp4Gfc3 Thank you for using the GENERATE function by SimoTime Enterprises
This example uses the following control file (SYSCNTL3.TXT).
*********************************************************************** * SYSUT1 should be a sequential, 80-byte, fixed, ebcdic file. * * SYSUT2 should be a sequential, 80-byte, fixed, ascii file. * * This example does a simple copy of an EBCDIC sequential file to * * an ASCII sequential file of the same record length. * *********************************************************************** /DIALECT C2 /PROGID ZAP003C1 /SYSUT1 org=SEQUENTIAL recfm=FIXED rlen=80 block=800 /SYSUT2 org=SEQUENTIAL recfm=FIXED rlen=80 block=800 * /TRANSMODE E2A /TRANSLATE FROM pos 1 len 80 TO pos 1 len 80 * /END
You may view the COBOL source code that is generated from the information in the control file (SYSCNTL3.TXT) and the mask file (SYSMASK1.TXT).
The following provides additional detail for the IVP (IVP4GFC4.CMD) that creates a program to read an EBCDIC Sequential file and create an ASCII Indexed file.
@echo OFF
rem *
rem * SYSUT1 should be a ASCII/CRLF, 80-byte, variable, ascii file.
rem * SYSUT2 should be a indexed, 80-byte, variable, ebcdic file.
rem * This example does a copy of an ASCII text file with carriage return
rem * and line feed characters used as record separators to an indexed
rem * file of EBCDIC records. The maximum record length is 80 and the key
rem * position is one with a key length of 6.
rem *
echo * IVP4GFC4 Starting the GENERATE function of SimoZAPS
set SYSCNTL=syscntl4.txt
set SYSMODEL=sysmask1.txt
set SYSCOBOL=zap004c1.cbl
type %syscntl%
run simozaps GENERATE
echo * IVP4GFC4 SYSCOBOL is %syscobol%
echo * IVP4GFC4 SYSCNTL is %syscntl%
call :PostNote "Finished JobName Ivp4Gfc4..."
if "%1" == "NOSHOW" goto :End
echo * Ivp4Gfc4 SYSCOBOL source is displayed in a separate window using NotePAD.
start notepad %syscobol%
:End
echo * Ivp4Gfc4 Thank you for using the GENERATE function by SimoTime Enterprises
This example uses the following control file (SYSCNTL4.TXT).
*********************************************************************** * SYSUT1 should be a ASCII/CRLF, 80-byte, variable, ascii file. * * SYSUT2 should be a indexed, 80-byte, variable, ebcdic file. * * This example does a copy of an ASCII text file with carriage return * * and line feed characters used as record separators to an indexed * * file of EBCDIC records. The maximum record length is 80 and the key * * position is one with a key length of 6. * *********************************************************************** /DIALECT C2 /PROGID ZAP004C1 /SYSUT1 ORG=ASCII/CRLF RECFM=VARIABLE RLEN=80 /SYSUT2 ORG=INDEXED RECFM=VARIABLE RLEN=80 KPOS=1 KLEN=6 * /TRANSMODE A2E /TRANSLATE FROM POS 1 LEN 80 to POS 1 LEN 80 * /END
You may view the COBOL source code that is generated from the information in the control file (SYSCNTL4.TXT) and the mask file (SYSMASK1.TXT).
The following provides additional detail for the IVP (IVP4GFC5.CMD) that creates a COBOL program that will read an EBCDIC Sequential file and create an ASCII Indexed file.
@echo OFF
rem *
rem * This process will read the SYSCNTL5.TXT file and create the
rem * ZAP005C1.CBL file using the SYSMASK2.TXT as a mask.
rem * The SYSCNTL5.TXT file is expected to contains the specifications
rem * for reading a sequential, 80-byte, fixed, EBCDIC file and creating
rem * an INDEXED, 256-byte maximum record length, variable, ASCII file
rem * with the key position at 1 for a key length of 6. This program
rem * will do an unordered or random add to the Indexed file. The keys
rem * do not need to be in sequence.
rem *
echo * IVP4GFC5 Starting the GENERATE function of SimoZAPS
set SYSCNTL=syscntl5.txt
set SYSMODEL=sysmask2.txt
set SYSCOBOL=zap005c1.cbl
echo * IVP4GFC5 SYSCOBOL is %syscobol%
type %SYSCNTL%
run simozaps generate
echo * IVP4GFC5 SYSCOBOL is %syscobol%
echo * IVP4GFC5 SYSCNTL is %syscntl%
call :PostNote "Finished JobName Ivp4Gfc5..."
if "%1" == "NOSHOW" goto :End
echo * Ivp4Gfc5 SYSCOBOL source is displayed in a separate window using NotePAD.
start notepad %syscobol%
:End
echo * Ivp4Gfc5 Thank you for using the GENERATE function by SimoTime Enterprises
The preceding example uses the following control file (SYSCNTL5.TXT).
*********************************************************************** * SYSUT1 should be a ASCII/CRLF, 80-byte, variable, ascii file. * * SYSUT2 should be a indexed, 80-byte, variable, ebcdic file. * * This example does a copy of an ASCII text file with carriage return * * and line feed characters used as record separators to an indexed * * file of EBCDIC records. The maximum record length is 80 and the key * * position is one with a key length of 6. * *********************************************************************** /DIALECT C2 /PROGID ZAP004C1 /SYSUT1 ORG=ASCII/CRLF RECFM=VARIABLE RLEN=80 /SYSUT2 ORG=INDEXED RECFM=VARIABLE RLEN=80 KPOS=1 KLEN=6 * /TRANSMODE A2E /TRANSLATE FROM POS 1 LEN 80 to POS 1 LEN 80 * /END
You may view the COBOL source code that is generated from the information in the control file (SYSCNTL5.TXT) and the mask file (SYSMASK2.TXT).
This function will generate the COBOL source code for a file comparison program. This generated file comparison program (SYSCOBOL) will read two files (SYSUT1) and (SYSUT2). The format of the two input files (SYSUT1 and SYSUT2) is specified by records contained in a control or specifications file (SYSCNTL).
A WIndow's Command (.CMD) file is provided for easy execution of SimoZAPS and the "Generate a Comparison Program" function.
C:\> ZAPSCOMP name-of-control-file.txt name-of-generated-cobol.cbl SYSUT3
The preceding statement will run SimoZAPS and create a COBOL source member that will do a file comparison. The first parameter is the fully-qualified file name for the control file. The second parameter is the name of the COBOL program to be generated. The third parameter is optional and SYSUT3 will cause a COBOL program to be generated that will read a control file (containing /COMPARE statements) at execution time.
SimoZAPS has the ability to generate two types of compare programs. One type determines the positions to be compared at compiled time and the other determines the positions to be compared at execution time. This is covered in more detail in the following sections.
The reading and comparing of the two files are the easy parts. What to compare in each record is determined by the use of a /COMPARE statement in the control file (SYSCNTL for compile time or SYSUT3 for execution time). Multiple /COMPARE statements may be specified in the control files. The following is an example of a /COMPARE statement.
| /COMPARE | SYSUT1 POS nnnnn LEN nnnn SYSUT2 POS nnnnn LEN nnnn |
The maximum length of a text string that may be compared is 1,024 bytes. If a record exceeds this length then multiple /COMPARE statements will be required.
The following is an overview of the steps required to generate, compile and execute a data file comparison program.
| Step | Description | ||||||||
| 01 | Decide on the environment for doing file compares. | ||||||||
|
|||||||||
| 02 | Create a control file for generating the comparison programs. | ||||||||
|
|||||||||
| 03 | Generate the comparison programs. | ||||||||
|
|||||||||
| 04 | Compile the comparison programs. | ||||||||
|
|||||||||
| 05 | Run or Animate (or execute) the comparison programs | ||||||||
|
The first type of program will simple read two files and do the comparison of positions within the records base on hard-coded values in the generated program. This type of program has the /COMPARE statements in the same control file (SYSCNTL) that is used to generate the COBOL source code. The positions to be compared will be determined at compile time and become part of the generated source code. The advantage of using this approach is that fewer parameters are required at execution time. The disadvantage of using this approach is that it requires the program to be regenerated and compiled if a user wants to change the positions within the records to be compared.
C:\> ZAPSCOMP name-of-control-file.txt name-of-generated-cobol.cbl
The following is an example of a control file that will generate the COBOL source code that will compare the contents of two files based on the /COMPARE statements in a control file (SYSCNTL). The compare positions will be included in the generated COBOL source code.
/Dialect C2 /progid ITCOMPC1 /sysut1 name=ITCOMPD1 org=Indexed recfm=variable rlen=512 klen=12 kpos=1 /sysut2 name=ITCOMPD2 org=Indexed recfm=variable rlen=512 klen=12 kpos=1 * /DELTAMAX 250 EOF /KEYFIELD SYSUT1 pos 1 len 12 SYSUT2 pos 1 len 12 * /COMPARE SYSUT1 pos 1 len 94 SYSUT2 pos 1 len 94 * /DFORMAT ASC HEX EBC * /END
Once the COBOL source code has been generated it needs to be compiled. Since this example uses an ASCII/Text file for input (on the mainframe this would need to be a sequential file) we will use Micro Focus COBOL on a WIndows platform to compile the program. We will compile to a .GNT for improved performance over .INT and use the ASSIGN(EXTERNAL) directive for mapping file names when we execute the program.
The following is an example of a Windows command file (or batch file) that will set the environment and execute (or run) the program.
@echo OFF
rem *
set SYSLOG=c:\SimoDemo\TestLib1\DataWrk1\SYSLOGT1.TXT
set ITCOMPD1=C:\SimoDEMO\TestLib1\DataAsc1\ItemAsc1.Dat
set ITCOMPD2=C:\SimoDEMO\TestLib1\DataAsc1\ITEXPECT.DAT
if exist %SYSLOG% erase %SYSLOG%
rem *
run ITCOMPC1
rem *
if exist %SYSLOG% start Notepad %SYSLOG%
rem *
pause
The second type file comparison program will read a control file (SYSUT3) containing /COMPARE statements at execution time and do positional comparisons within the records based on the /COMPARE statements submitted at execution time. The advantage of this approach is the compare positions are defined when the generated COBOL program is executed. The user may change the positions within the record to be compared without having to re-generate and compile the program. The disadvantage is that it is necessary to have a control file with compare statements at execution time.
C:\> ZAPSCOMP name-of-control-file.txt name-of-generated-cobol.cbl SYSUT3
The following is an example of a control file that will generate the COBOL source code that will compare the contents of two files based on the /COMPARE statements in a control file (SYSUT3) that will be processed when the generated program is executed.
*********************************************************************** * This is an example of the compare specifications to generate a * * Data File Comparison Program. This is used by SimoZAPS * * SimoTime Enterprises, LLC * * (C) Copyright 1987-2010 All Rights Reserved * * Web Site URL: http://www.simotime.com * * e-mail: helpdesk@simotime.com * *********************************************************************** /Dialect C2 /progid ITUTL3C1 /SYSUT1 name=SYSUT1 org=Indexed recfm=variable rlen=512 klen=12 kpos=1 /SYSUT2 name=SYSUT2 org=Indexed recfm=variable rlen=512 klen=12 kpos=1 /SYSUT3 name=SYSUT3 org=ASCII/Text recfm=variable rlen=080 * /DELTAMAX 250 EOF /KEYFIELD SYSUT1 pos 1 len 12 SYSUT2 pos 1 len 12 *COMPARE SYSUT1 pos 1 len 512 SYSUT2 pos 1 len 512 *COMPARE uses SYSUT3 ... * /DFORMAT ASC HEX EBC * /END
Once the COBOL source code has been generated it needs to be compiled. Since this example uses an ASCII/Text file for input (on the mainframe this would need to be a sequential file) we will use Micro Focus COBOL on a Windows platform to compile the program. We will compile to a .GNT for improved performance over .INT and use the ASSIGN(EXTERNAL) directive for mapping file names when we execute the program.
The following is an example of a Windows command file (or batch file) that will set the environment and execute (or run) the program.
@echo OFF
rem *
set SYSLOG=c:\SimoDemo\TestLib1\DataWrk1\SYSLOGT1.TXT
set SYSUT1=C:\SimoDEMO\TestLib1\DataAsc1\ItemAsc1.Dat
set SYSUT2=C:\SimoDEMO\TestLib1\DataAsc1\ITEXPECT.DAT
set SYSUT3=c:\SimoDemo\TestLib1\DataTxt1\ITUTL301.TXT
if exist %SYSLOG% erase %SYSLOG%
rem *
run ITUTL3C1
rem *
if exist %SYSLOG% start Notepad %SYSLOG%
rem *
pause
For this example the control file (SYSUT3) contains the following compare statement. Since the maximum record size for the file is 512 bytes this will compare the entire record content.
/COMPARE SYSUT1 pos 1 len 512 SYSUT2 pos 1 len 512
What to do when a not equal condition occurs can be challenging on a single platform but in today's environment with multiple platforms and a mix of encoding schemes (such as EBCDIC and ASCII) and numeric formats (such as PACKED and BINARY) the task can become time consuming and difficult.
When a difference is found the type of display or logging information is defined by the use of a /DFORMAT statement in the control file. The following shows the format of the /DFORMAT statement.
| /DFORMAT | ASC | HEX | EBC | |
| NOASC | NOHEX | NOEBC |
SimoZAPS does not actually do the data file comparison but generates a COBOL program to do the comparison. This technique provides greater flexibility since the COBOL program may be compiled on an IBM mainframe (z/OS or VSE) and Windows or UNIX using Micro Focus. Also, unique comparison requirements may be addressed by simply modifying the generated COBOL program.
The generated comparison program provides support for Keyed data sets and Sequential files. For Keyed data sets support is included for inserted, added or deleted records. If Sequential files are in sequence by a certain field then support for inserted, added or deleted records is provided. For files not in sequence a record by record comparison is performed.
It is possible to compare parts or segments of a record.
When a not equal condition is encountered the following is displayed to the screen and written to a logging file. The RED shows the possible ASCII translation. The BLUE shows the possible EBCDIC translation. The BLACK shows the hexadecimal dump information on two lines (high nibble on line 1, low nibble on line 2). The GREEN shows reference information about each file. For example, the relative record number is displayed along with the position and length of the text string within the record that was compared. The MAROON row shows the positions that are equal (=) or not equal (#).
*** 2005/04/01 08:57:37:40 Starting - Data File Content Comparison by SimoTime Enterprises, LLC *** 2005/04/01 08:57:37:41 SYSUT1.....Record Number(position:length) 000000001(00001:00094) *** 2005/04/01 08:57:37:41 ....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8....:....9.... *** 2005/04/01 08:57:37:42 000000000001Distributor Cap ........Each ...2....i. *** 2005/04/01 08:57:37:42 3333333333334677766776724672222222222222222222222222222222220000000046662222222222220003900068 *** 2005/04/01 08:57:37:42 000000000001493429254F203100000000000000000000000000000000000000000051380000000000000002C0009C *** 2005/04/01 08:57:37:42 .....................?.../.........................................../........................ *** 2005/04/01 08:57:37:43 SYSUT2.....Record Number(position:length) 000000001(00001:00094) *** 2005/04/01 08:57:37:43 ....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8....:....9.... *** 2005/04/01 08:57:37:43 000000000001Distributor Cap ...$....Each ...2....i. *** 2005/04/01 08:57:37:43 3333333333334677766776724672222222222222222222222222222222220002000046662222222222220003900068 *** 2005/04/01 08:57:37:44 000000000001493429254F203100000000000000000000000000000000000004000C51380000000000000002C0009C *** 2005/04/01 08:57:37:44 .....................?.../.........................................../........................ *** 2005/04/01 08:57:37:44 ===============================================================#===#========================== *** 2005/04/01 08:57:37:45 * *** 2005/04/01 08:57:37:45 SYSUT1.....Record Number(position:length) 000000002(00001:00094) *** 2005/04/01 08:57:37:45 ....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8....:....9.... *** 2005/04/01 08:57:37:45 000000000002Rotor ........Each ........)\ *** 2005/04/01 08:57:37:46 3333333333335676722222222222222222222222222222222222222222220000000046662222222222220000800025 *** 2005/04/01 08:57:37:47 0000000000022F4F200000000000000000000000000000000000000000000000000051380000000000000009C0009C *** 2005/04/01 08:57:37:47 .............?.?...................................................../.......................* *** 2005/04/01 08:57:37:48 SYSUT2.....Record Number(position:length) 000000002(00001:00094) *** 2005/04/01 08:57:37:48 ....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8....:....9.... *** 2005/04/01 08:57:37:49 000000000002Rotor ...$....Each ........)\ *** 2005/04/01 08:57:37:49 3333333333335676722222222222222222222222222222222222222222220002000046662222222222220000800025 *** 2005/04/01 08:57:37:49 0000000000022F4F200000000000000000000000000000000000000000000004000C51380000000000000009C0009C *** 2005/04/01 08:57:37:50 .............?.?...................................................../.......................* *** 2005/04/01 08:57:37:51 ===============================================================#===#========================== *** 2005/04/01 08:57:37:52 * *** 2005/04/01 08:57:37:53 Summary - Data File Content Comparison *** 2005/04/01 08:57:37:53 000000005 - Record count for ITCOMPD1 *** 2005/04/01 08:57:37:54 000000005 - Record count for ITCOMPD2 *** 2005/04/01 08:57:37:55 000000002 - Unequal count *** 2005/04/01 08:57:37:55 Finished - Data File Content Comparison by SimoTime Enterprises, LLC
The summary information shows the record counts and the number of unequal compares by record count.
To create the program that provides the preceding information the following control file is required.
/Dialect C2 /progid ITCOMPC1 /sysut1 name=ITCOMPD1 org=Indexed recfm=variable rlen=512 klen=12 kpos=1 /sysut2 name=ITCOMPD2 org=Indexed recfm=variable rlen=512 klen=12 kpos=1 * /DELTAMAX 250 EOF /KEYFIELD SYSUT1 pos 1 len 12 SYSUT2 pos 1 len 12 * /COMPARE SYSUT1 pos 1 len 94 SYSUT2 pos 1 len 94 * /DFORMAT ASC HEX EBC * /END
The following is the Windows command file (or batch file) that was used to create the preceding information.
@echo OFF
setlocal
set PostNote=c:\SimoLIBR\LOGS\SimoTime.LOG
set JobStatus=0000
set ShowCode=SHOW
rem *
call :PostNote "************************************************************ItemCompareE1.CMD"
call :PostNote "Starting JobName ItemCompareE1, User is %USERNAME%"
echo ************************************************************
echo * This program is provided by: *
echo * SimoTime Enterprises, LLC *
echo * (C) Copyright 1987-2010 All Rights Reserved *
echo * Web Site URL: http://www.simotime.com *
echo * e-mail: helpdesk@simotime.com *
echo ************************************************************
echo * Text: Read a control file, Create a COBOL data file
echo * comparison program..
echo * Author: SimoTime Enterprises
echo * Version: 04.07.23
echo *
rem *
rem *
call :PostNote "************************************************************"
call :PostNote "* This step will create the HTML documentation based on *"
call :PostNote "* the copy file that defines the record structure. *"
rem *
call Rec1HTML c:\SimoDemo\CobCpy1\ITEMCB01.CPY c:\SimoDEMO\HTML\ITEMMAST.HTM IBM NOPAUSE
if ERRORLEVEL = 1 goto :EojNOK
call :PostNote "* The HTML document has been created. *"
rem *
call :PostNote "************************************************************"
call :PostNote "* This step will generate the COBOL program that compares *"
call :PostNote "* two data files. If a difference is encountered the delta *"
call :PostNote "* information will be displayed and written to a log file. *"
rem *
call ZapsCOMP c:\SimoDemo\Compares\ItemCompareT1.txt c:\SimoDemo\COBOLGen\ItCompC1.CBL
if ERRORLEVEL = 1 goto :EojNOK
call :PostNote "* The COBOL comparison program has been generated. *"
rem *
goto :EojAok
rem *
rem ****************************************************************
rem * Display the message and write to the log file using ECHO.
rem * The ~ causes the leading/trailing double-quotes to be removed.
rem *
:PostNote
@echo OFF
echo %date% %time% %~1 >> %PostNote%
echo %~1
goto :EOF
rem * The preceding :EOF causes a return to caller within this CMD.
rem *
rem *********************************************************************
:EojNOK
call :PostNote "ABENDING JobName ItemCompareE1, User is %USERNAME%"
pause
rem *
rem *********************************************************************
:EojAOK
call :PostNote "Finished JobName ItemCompareE1, User is %USERNAME%"
echo * Thank you for using the GENERATE function by SimoTime Enterprises
pause
rem *
:End
The following is a description of the statements (or record types) contained in the control file (SYSCNTL).
| Keyword | Parameters | |||||||||||||||||||||||||||||||||
| /DIALECT |
|
|||||||||||||||||||||||||||||||||
| /PROGID |
|
|||||||||||||||||||||||||||||||||
| /SYSUT1 | NAME=xxxxxxxx ORG=xxxxxxxxxx RECFM=xxxxxxxx rlen=nnnnn KLEN=nnnn KPOS=nnnn
|
|||||||||||||||||||||||||||||||||
| /SYSUT2 | NAME=xxxxxxxx ORG=xxxxxxxxxx RECFM=xxxxxxxx rlen=nnnnn KLEN=nnnn KPOS=nnnn
|
|||||||||||||||||||||||||||||||||
| /UT1OMIT | IF POS nnnn LEN nnnn EQ xxxx BYPASS RECORD +nnn
|
|||||||||||||||||||||||||||||||||
| /UT2OMIT | IF POS nnnn LEN nnnn EQ xxxx BYPASS RECORD +nnn
|
|||||||||||||||||||||||||||||||||
| /UT1CALL | The name of a callable translation routine to be executed immediatley after a read of a SYSUT1 record. | |||||||||||||||||||||||||||||||||
| /UT2CALL | The name of a callable translation routine to be executed immediatley after a read of a SYSUT2 record. | |||||||||||||||||||||||||||||||||
| /DELTAMAX |
|
|||||||||||||||||||||||||||||||||
| /KEYFIELD | SYSUT1 POS nnnn LEN nnnn SYSUT2 POS nnnn LEN nnnn
|
|||||||||||||||||||||||||||||||||
| /COMPARE | compare_type SYSUT1 POS nnnn LEN nnnn SYSUT2 POS nnnn LEN nnnn
Note: It is possible to have more than one compare statement. The maximum length for each compare string is 1,024 bytes. Therefore, if a record is longer that 1,024 bytes it will require multiple compare statements. |
|||||||||||||||||||||||||||||||||
| /DFORMAT | ASC HEX EBC
|
|||||||||||||||||||||||||||||||||
| /END | End of control statements, this statement is optional. |
The following is a description of the statements (or record types) contained in the control file (SYSCNTL).
The following is an overview of the generation function for a file comparison program.
|
Start the process | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
Determine if a COMPARE request and call SimoCNVT. | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
|
|
|
Read the specifications from SYSCNTL and use SYSMODEL as a template to create SYSCOBOL.CBL. | |||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||
|
End-of-Job | |||||||||||||||||||||||||||
This procedure will read an ASCII/Text file and create an EBCDIC, 80-byte, fixed-record-length file. The intent of this function is to convert the many "control card" files used in a mainframe job stream. It is an 80/80 copy with conversion between EBCDIC and ASCII.
| SIMOZAPS | TRANSLATE | sysin | sysout | ASCtoEBC | NODISPLAY | KEEPNULLS | |
| EBCtoASC | DISPLAY | PADNULLS |
The following is a summary of the parameters used by the Translate Function.
| Parameter | Description |
| sysin | This is the name of the input file. Depending on the ASCtoEBC or EBCtoASC parameter this will be an ASCII/Text file or an 80-byte EBCDIC file. |
| sysout | This is the name of the output file. Depending on the ASCtoEBC or EBCtoASC parameter this will be an 80-byte EBCDIC file or an ASCII/Text file. |
| ASCtoEBC EBCtoASCor ASCtoA80 |
This keyword/parameter will explicitly define the format of the output file. The format of the input file is implicitly defined, it is the complement of the output file. If this keyword/parameter
is missing then ASCtoEBC is the default value. ASCtoEBC - copy from an ASCII/Text file to an 80-byte, fixed-length, EBCDIC file. EBCtoASC - copy from an 80-byte, fixed-length, EBCDIC file to an ASCII/Text file to . ASCtoA80 - copy from an ASCII/Text file to an 80-byte, fixed-length, ASCII file. |
| NODISPLAY or DISPLAY |
This keyword/parameter provides the capability of displaying the records from the input file as they are being converted. If this keyword/parameter is missing then NODISPLAY is the default value. |
| KEEPNULLS or PADNULLS |
This keyword/parameter provides the capability of leaving null values (low-values or hex'00') unchanged or converting null values to spaces. If the keyword/parameter is missing then KEEPNULLS is the default value. |
|
|
|
|
|
|||||||||||||||||||||||||||||||
|
|
|
|
|
|||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||
For additional file conversion capability refer to the File Conversion section. The file convert function of SimoZAPS does not do the actual conversion of a file. It creates a COBOL source member that may be compiled and executed on the mainframe or the PC.
The MODIFY function of SimoZAPS provides the capability of copying an ASCII/Text file with include, omit or modify capability. As the SYSIN file is being read a record may be selected (included or omitted) based on content for writing to the SYSOUT file. Prior to writing a record to the SYSOUT file the record may be changed using the keyword/parameter combinations described below.
The following is the command line format for the MODIFY function of SimoZAPS.
| SIMOZAPS | MODIFY | sysin | sysout | COMMAND CMD |
keyword | parameters | |
| or | |||||||
| SIMOZAPS | MODIFY | sysin | sysout | LISTFILE LIST FILE |
filename.ext |
| Note: | : COMMAND may be abbreviated as CMD and LISTFILE may be abbreviated as LIST or FILE. |
| The following keyword/parameters are used to include or omit records. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| The following keyword/parameters are used to format each record. | ||||||||||||||||||||||||
|
This section will describe how and when to use the SimoZAPS utility program. Practical examples will be used.
When specifying literals with leading, embedded or trailing spaces it will be necessary to place the literal within a pair of double-quotes. Since double-quotes are used to define the beginning and end of a literal then a literal that contains double-quotes cannot be specified.
When specifying values with the percent sign (%) the results may not be as anticipated if using the COMMAND function.
| 1. | When using the COMMAND function the actual percent value will be substituted. | |
| 2. | When using a LISTFILE the percent string literal will be substituted. |
When multiple statements that use conditional arguments are specified then consideration should be given to the sequence of the statements with the longest search arguments being specified first if subsequent shorter search argument contain identical text strings. For example, changing the sequence of the following two statements would produce different results because in the first sequence the value "ABCDEF" would never to be found.
| INCLUDE | IF 1 EQ "ABC" AND CASE MATCH |
| OMIT | IF 1 EQ "ABCDEF" AND CASE MATCH |
This section will describe how to use the MODIFY function of SimoZAPS to make a global change to a text string in an ASCII/Text file.
|
Start the process | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
|
|
|
Use the MODIFY function to create a new file replacing occurrences of " zap " with " SimoZAP1 " | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
End-of-Job | |||||||||||||||||||||||||||
The IVP4ZAP1.BAT will execute the SimoZAPS program with the MODIFY function. The CMD parameter indicates the additional parameters are included in the command line. In this example the text string " zap " will be replaced with " " SimoZAP1 " when the file is copied.
@echo OFF
rem *
rem * Read the TXT4ZAP1.TXT file and create the TXT4ZAP1.NEW file.
rem * Replace the word " zap " with " SimoZAP1 "
rem * Notice the use of the double quotes allows embedded spaces.
rem *
echo * IVP4ZAP1 is Starting...
run simozaps MODIFY txt4zap1.txt txt4zap1.new CMD REPLACE VARIABLE " zap " WITH " SimoZAP1 "
if ERRORLEVEL = 1 GOTO :ABEND01
echo *
echo * IVP4ZAP1 TXT4ZAP1.TXT - original file is left unchanged...
echo *
type txt4zap1.txt
echo *
echo * IVP4ZAP1 TXT4ZAP1.NEW - the new file with modifications...
echo *
type txt4zap1.new
echo *
echo * IVP4ZAP1 End of Job...
goto :END
rem *
:ABEND01
echo * IVP4ZAP1 is ABENDING !!!
goto :END
rem *
:END
The following is the contents of the TXT4ZAP1.TXT file.
The keyword is zap Repeat keyword is zap The keyword should be replaced with SimoZAP1. If successful the new keyword should be SimoZAP1.
After running IVP4ZAP1.BAT the new file (TXT4ZAP1.NEW) should have the text string " zap " replaced with " SimoZAP1 ".
One of the problems we encountered when building our Web site was the naming of the members within a directory. Windows is not case sensitive to member names but UNIX systems are case sensitive to member names. We developed the Web site on a Windows platform and everything worked fine. After uploading the files to the UNIX server we encountered many missing links even though the members were copied to the UNIX server. The missing links were due to the case sensitivity for member names.
The following is an example of using the MODIFY function of SIMOZAPS to create a batch file to ensure the member names within our Web directory are all lower case. There are other ways to do this but the purpose here is to illustrate the capabilities of the SimoZAPS utility.
| Caution!!! A back-up copy of the target directory should be created prior to executing this type of process. |
|
Start the process | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
|
Create a file with a list of member names. | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
|
|
|
Read the list of member names and create a new executable batch file. | |||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||
|
End-of-Job | |||||||||||||||||||||||||||
The following is the IVP4ZAP2.BAT file referenced in the preceding figure.
@echo OFF
rem *
rem * Convert member names to lower case.
rem *
echo * IVP4ZAP2 is Starting...
if exist SYSWORK2.TXT erase SYSWORK2.TXT
echo *
@echo ON
dir *.*/on/b/a-d>syswork2.txt
@echo OFF
echo * The preceding DIR command will do the following.
echo * The /on organizes the list by name.
echo * The /b will cause the dir function to only list the file name.ext.
echo * The /a-d will not include directory names in the list.
echo * The piping will write the dir information to ivp4zap2.txt.
echo * This file will be used by the following command.
echo *
if exist DOITONCE.BAT erase DOITONCE.BAT
@echo ON
run simozaps MODIFY SYSWORK2.TXT doitonce.bat FILE TXT4ZAP2.TXT
@echo OFF
if ERRORLEVEL = 1 GOTO :ABEND01
echo *
echo * The DOITONCE.BAT file has been created from SYSWORK2.TXT.
echo * Please review the results and execute accordingly.
echo *
goto :END
rem *
:ABEND01
echo * IVP4ZAP2 is ABENDING !!!
goto :END
rem *
:END
The following is the contents of the TXT4ZAP2.TXT file used by the MODIFY function of SimoZAPS.
* * The following control statements will create a DOS * Command to rename a member using lower case. * omit if 1 eq * repeat from 1 to 12 at 14 toupper from 1 to 12 tolower from 14 to 25 * * The following statement may need to be modified to point * to the proper drive and directory. * insert "c:\simozaps\" at 1 * * The following statement is required to do the renaming * from mixed or upper case to all lower case. * insert "rename " at 1 *
In the preceding example the MODIFY function of SimoZAPS does not actually do the task of renaming the members in the directory to ensure a lower-case format. The MODIFY function of SimoZAPS is used to create the DOITONCE.BAT file that will do the actual task.
This program will read an ASCII/Text file of COBOL source code and format in UPPER/lower case. It will create a SYSOUT file in the new format, the original file is unchanged.
| Caution!!! A back-up copy of the target directory should be created prior to executing this type of process. |
The following procedure will read the COBOL source member specified by the sysin parameter and create a new COBOL source member specified by the sysout parameter. The sysout member will contain the predefined upper/lower case format.
| SIMOZAPS | FormatCOBOL | sysin | sysout | Display NoDisplay |
CobolLower CobolUpper |
NamesUpper NamesLower |
|
| The following defines the input and output file names. | ||||||||
|
||||||||
| The following keyword/parameters are used to format each record. | ||||||||
|
This section will describe how to use the FormatCOBOL function of SimoZAPS to read a COBOL source member and create a new file with case consistency. The following shows the contents of the IVP4ZAP3.BAT file.
@echo OFF
rem *
rem * This program will read the HELLO.CBL COBOL source member that contains
rem * an erratic use of upper and lower case.
rem *
rem * Create HELLO.NEW with a consistent use of upper and lower case.
rem *
echo *
echo * IVP4ZAP3 - Installation Verification Program for the FormatCOBOL function.
run simozaps FormatCOBOL hello.cbl hello.new nodisplay
if ERRORLEVEL = 1 GOTO :ABEND01
echo * IVP4ZAP3 - The FormatCOBOL function is complete,
echo * IVP4ZAP3 - Review the HELLO.CBL and HELLO.NEW files.
echo *
goto :END
rem *
:ABEND01
echo * IVP4ZAP1 is ABENDING !!!
goto :END
rem *
:END
In the preceding example the FormatCOBOL function will read the HELLO.CBL member and create a new HELLO.NEW file with case consistency. The "nodisplay" option suppresses the scrolling of source code on the screen.
In the new COBOL.NEW file the COBOL verbs will be lower case and the user defined fields will be upper case.
The proper use of SimoZAPS can save many hours of tedious point-and-click changes. SimoZAPS provides a method for predefining tasks and performing these tasks in an automated and unattended environment.
The SimoZAPS program provides a function for doing global changes that may make a large number of changes very quickly. This also creates an exposure for making a large number of incorrect changes very quickly. Therefore, SimoZAPS never changes the original input file, it creates a new file with the requested changes. As with all changes the results should be reviewed and tested before being accepted and deployed in a production environment.
Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.
SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software.
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com
The SimoZAPS program, this documentation, the Installation Verification Procedures (IVP's) and examples are provided electronically or on a Compact Disk (CD) with a predefined SETUP procedure. Additional information about acquiring SimoZAPS may be obtained by contacting the helpdesk@simotime.com or refer to the Product Availability and Pricing document.
The File Conversion, Volume 1 suite of programs includes a number of examples for file conversions that are required when migrating data between the PC and an IBM mainframe. Simply click on the following items to download this suite of sample source code.
The following is a list of some of the conversion programs created by the GENERATE function of SimoZAPS. These are provided as programming examples for COBOL.
| Program Name | Description |
| zap00101 | Convert from an EBCDIC-Sequential file to an ASCII-Text file. |
| zap00201 | Convert from an EBCDIC-Sequential file to an ASCII-Indexed file (Sequential-Add). |
| zap00301 | Convert from an EBCDIC-Sequential file to an ASCII-Sequential file. |
| zap00401 | Convert from an ASCII-Text file to an EBCDIC-Indexed file (Sequential-Add). |
| zap00501 | Convert from an ASCII-Text file to an EBCDIC-Indexed file (Random-Add). |
The File Conversion, Volume 2 suite of programs includes a number of examples for file conversions that are required when migrating data between the PC and an IBM mainframe. Simply click on the following items to download this suite of sample source code.
This item will provide a link to an ASCII or EBCDIC translation table . A column for decimal, hexadecimal and binary is also included.
This suite of programs provides examples of how to parse, edit, modify, format and display (standard or hexadecimal dump) various words within a data string. The editing and formatting of a date field are used in this example. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370.
To review all the information available on this site start at The SimoTime Home Page .
Check out The SimoTime Glossary for a list of terms and definitions used in the documents provided by SimoTime.
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com
Founded in 1987, SimoTime Enterprises is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com
| Return-to-Top |
| SimoZAPS |
| Copyright © 1987-2010 SimoTime Enterprises All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |