![]() |
Eighty-Column Card Files Read, Convert and Write using COBOL |
| When technology complements business | Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
| The SimoTime Home Page |
On the mainframe it is a common practice to read a sequential file of eighty (80) byte records to obtain information or specifications that will affect the behavior of program execution. The eighty (80) byte records are a carry-over from the days when eighty-column cards were used. Even today these files are referred to as card files.
The technique for accessing these files varies and this suite of sample programs describes a few of the possible techniques. In addition, when an application is moved between an EBCDIC-encoded Mainframe System with ZOS and a Linux, UNIX or Windows System with Micro Focus. it may be converted to run in an ASCII-encoded environment and this introduces a new set of challenges.
This suite of programs and documentation describes the techniques for simplifying this process by using callable I/O modules and a callable conversion routine that are provided by The SimoCARD Series of programs. The I/O modules provide for read and write access of both record and line sequential files The conversion routine will convert 80-byte text strings between EBCDIC-encoding and ASCII-encoding.
At this point it is important to note the terminology used in this document. The term "Record Sequential" will be used to refer to a sequential file that contains fixed-length records concatenated one after the other without record separators. This type of file may contain ASCII or EBCDIC encoded data along with numeric fields of various mainframe (or COBOL) formats such as packed or binary (i.e. COMP-3 or COMP).
The term "Line Sequential" (or ASCII/Text file) will be used to refer to a sequential file that contains variable-length records concatenated one after the other with a record separator inserted between each record. For Windows the record separator is two bytes (i.e. a carriage return and a line feed or a x'0D0A'). For UNIX the record separator is a single line feed character or x'0A'. To add to the confusion for an Apple Mac the record separator is a single carriage return character or x'0D'.
The primary purpose of this suite of programs is to address some of the possibilities and considerations when sharing or migrating data between an EBCDIC-encoded IBM Mainframe System (Note: the IBM, AS/400 is an EBCDIC-encoded system) and an ASCII-encoded Linux, UNIX or Windows System with Micro Focus Enterprise Server. This example will focus on sequential files with eighty (80) byte records.
| ||||||||
| Function included in this Suite of Programs |
The following records are included in an ASCII/Text (or Line Sequential) file. This file (TEST0080.TXT) will be converted to an EBCDIC-encoded, Record Sequential file with eighty (80) byte, fixed length records. The EBCDIC-encoded file will then be converted back to a third file that is an ASCII/Text file. The two ASCII/Text files will then be compared using a generated COBOL program. They should be identical.
The following is test data containing variable-length, alpa-numeric text strings.
000000000001 A 000000000002 AB 000000000003 ABC 000000000004 ABCD 000000000005 ABCDE 000000000006 ABCDEF 000000000007 ABCDEFG 000000000008 ABCDEFGH 000000000009 ABCDEFGHI 000000000010 ABCDEFGHIJ 000000000011 ABCDEFGHIJK 000000000012 ABCDEFGHIJKL 000000000013 ABCDEFGHIJKLM 000000000014 ABCDEFGHIJKLMN 000000000015 ABCDEFGHIJKLMNO 000000000016 ABCDEFGHIJKLMNOP 000000000017 ABCDEFGHIJKLMNOPR 000000000018 ABCDEFGHIJKLMNOPQR 000000000019 ABCDEFGHIJKLMNOPQRS 000000000020 ABCDEFGHIJKLMNOPQRST 000000000021 ABCDEFGHIJKLMNOPQRSTU 000000000022 ABCDEFGHIJKLMNOPQRSTUV 000000000023 ABCDEFGHIJKLMNOPQRSTUVW 000000000024 ABCDEFGHIJKLMNOPQRSTUVWX 000000000025 ABCDEFGHIJKLMNOPQRSTUVWXY 000000000026 ABCDEFGHIJKLMNOPQRSTUVWXYZ 000000000027 ABCDEFGHIJKLMNOPQRSTUVWZXZabcdefghijklmnopqrstuvwxtz1234567890 000000000028 ABCDEFGHIJKLMNOPQRSTUVWXYZ 000000000029 ABCDEFGHIJKLMNOPQRSTUVWXY 000000000030 ABCDEFGHIJKLMNOPQRSTUVWX 000000000031 ABCDEFGHIJKLMNOPQRSTUVW 000000000032 ABCDEFGHIJKLMNOPQRSTUV 000000000033 ABCDEFGHIJKLMNOPQRSTU 000000000034 ABCDEFGHIJKLMNOPQRST 000000000035 ABCDEFGHIJKLMNOPQRS 000000000036 ABCDEFGHIJKLMNOPQR 000000000037 ABCDEFGHIJKLMNOPQ 000000000038 ABCDEFGHIJKLMNOR 000000000039 ABCDEFGHIJKLMNO 000000000040 ABCDEFGHIJKLMN 000000000041 ABCDEFGHIJKLM 000000000042 ABCDEFGHIJKL 000000000043 ABCDEFGHIJK 000000000044 ABCDEFGHIJ 000000000045 ABCDEFGHI 000000000046 ABCDEFGH 000000000047 ABCDEFG 000000000048 ABCDEF 000000000049 ABCDE 000000000050 ABCD 000000000051 ABC 000000000052 AB 000000000053 A 000000000054 a 000000000055 ab 000000000056 abc 000000000057 abcd 000000000058 abcde 000000000059 abcdef 000000000060 abcdefg 000000000061 abcdefgh 000000000062 abcdefghi 000000000063 abcdefghij 000000000064 abcdefghijk 000000000065 abcdefghijkl 000000000066 abcdefghijklm 000000000067 abcdefghijklmn 000000000068 abcdefghijklmno 000000000069 abcdefghijklmnop 000000000070 abcdefghijklmnopr 000000000071 abcdefghijklmnopqr 000000000072 abcdefghijklmnopqrs 000000000073 abcdefghijklmnopqrst 000000000074 abcdefghijklmnopqrstu 000000000075 abcdefghijklmnopqrstuv 000000000076 abcdefghijklmnopqrstuvw 000000000077 abcdefghijklmnopqrstuvwx 000000000078 abcdefghijklmnopqrstuvwxy 000000000079 abcdefghijklmnopqrstuvwxyz 000000000080 abcdefghijklmnopqrstuvwzxz0123456789 000000000081 abcdefghijklmnopqrstuvwxyz 000000000082 abcdefghijklmnopqrstuvwxy 000000000083 abcdefghijklmnopqrstuvwx 000000000084 abcdefghijklmnopqrstuvw 000000000085 abcdefghijklmnopqrstuv 000000000086 abcdefghijklmnopqrstu 000000000087 abcdefghijklmnopqrst 000000000088 abcdefghijklmnopqrs 000000000089 abcdefghijklmnopqr 000000000090 abcdefghijklmnopq 000000000091 abcdefghijklmnor 000000000092 abcdefghijklmno 000000000093 abcdefghijklmn 000000000094 abcdefghijklm 000000000095 abcdefghijkl 000000000096 abcdefghijk 000000000097 abcdefghij 000000000098 abcdefghi 000000000099 abcdefgh 000000000100 abcdefg 000000000101 abcdef 000000000102 abcde 000000000103 abcd 000000000104 abc 000000000105 ab 000000000106 a
This suite of samples programs will run on the following platforms.
| ||||||||
| Operating Systems and Supporting Software |
Note: The programs in this package of software will make calls to programs that are provided in the SimoMODS and SimoCARD Series of programs. Therefore, the basic SimoLIBR should be installed.
The following is a flowchart of the job for executing the program to reads an ASCII/Text file of variable length records and creates an EBCDIC-encoded record sequential file of eighty (80) byte fixed length records.
The main program (CBLCRDC1) contains no File I/O coding or conversion coding, it simply calls the I/O routines and the conversion routine to do the detailed work. The source code for the CMD file and the COBOL programs is provided and may be modified to fit your environment.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SIMOCARD Series, callable I/O and Record Content Converion Routines |
Note: The light-green boxes are unique to the Mainframe and Micro Focus Enterprise Server/Studio (or Micro Focus Mainframe Express). The light-red boxes are unique to the PC with Windows and Micro Focus. The light-yellow boxes are decision points or program transitions in the processing logic. The light-blue boxes identify data structures such as Files, VSAM Data Sets or Relational Tables. The light-gray boxes identify a system function or information item.
This section describes the command files that are provided in the suite of programs.
| ||||||||||||||
| Brief Overview of Command Files in this Suite of Programs |
The following (CBLCRDE1.CMD) is a Windows .CMD that will execute a program that will read an ASCII-encoded, text file with variable length records and write to an EBCDIC-encoded file with eighty (80) byte, fixed length records.
@echo OFF
rem * *******************************************************************
rem * CBLCRDE1.CMD - a Windows Command File *
rem * This program is provided by SimoTime Enterprises *
rem * (C) Copyright 1987-2012 Al2 Rights Reserved *
rem * Web Site URL: http://www.simotime.com *
rem * e-mail: helpdesk@simotime.com *
rem * *******************************************************************
rem *
rem * Text - Read ASCII Text and write EBCDIC fixed record file
rem * Author - SimoTime Enterprises
rem * Date - November 11, 2003
rem * Version - 03.12.15
rem *
rem * This set of programs illustrates the use of some of the commonly
rem * called I/O routines that will read or write 80 byte records from
rem * or to s record sequential or line sequential file. In this example
rem * the text string will be converted from ASCII to EBCDIC before
rem * writing to the EBCDIC-encoded file with eighty (80) byte, fixed
rem * length records.
rem *
rem * This set of programs will run on a Personal Computer with Windows
rem * and Micro Focus Net Express or Mainframe Express.
rem *
rem * ************
rem * * CBLCRDE1 *
rem * ********cmd*
rem * *
rem * ************ **********
rem * * CBLCRDC1 *<=====* Tag==A *
rem * ********gnt* **********
rem * *
rem * *
rem * **call************
rem * * *
rem * * *
rem * * *
rem * * *
rem * * *
rem * * ************ ************
rem * * * GET080LS ******* SIMOGL80 * Read 80 bytes
rem * * *******data* ********gnt*
rem * *
rem * *
rem * ***call***********
rem * * *
rem * * ************
rem * * * SIMOXT80 * Convert ASCII/EBCDIC
rem * * ********gnt*
rem * *
rem * *
rem * ***call*************************
rem * * *
rem * * ************ ************
rem * * * SIMOPR80 ******* PUT080RS * Write 80 bytes
rem * * ********gnt* *******data*
rem * *
rem * ******** **********
rem * * EOF? ***(no)*** Goto=A *=====>
rem * ******** **********
rem * *
rem * (yes)
rem * *
rem * ************
rem * * EOJ *
rem * ************
rem *
rem * *******************************************************************
rem * Step 1 of 2 Set the global environment variables...
rem *
setlocal
call ..\Env1BASE
call SimoNOTE "*******************************************************CblCrdE1"
call SimoNOTE "Starting JobName CblCrdE1"
set GET080LS=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.ALPHALS1.TXT
set PUT080RS=%BaseLib1%\DATA\Wrk1\SIMOTIME.UTIL.ALPHARSE.DAT
rem * *******************************************************************
rem * Step 1 of 1 Read ASCII-Line Sequential, write EBCDIC-Record-Sequential
rem *
if exist %PUT080RS% erase %PUT080RS%
run CblCrdC1
if "%ERRORLEVEL%" == "0" goto :EojAOK
set JobStatus=0010
goto :EojNOK
rem *
:EojNOK
call SimoNOTE "ABENDING JobName CblCrdE1, Status is %JobStatus%"
goto :End
rem *
:EojAOK
call SimoNOTE "Complete JobName CblCrdE1, Status is %JobStatus%"
goto :End
rem *
:End
call SimoNOTE "Conclude SysLog is %SYSLOG%"
if not "%1" == "nopause" pause
endlocal
The following (CBLCRDE2.CMD) is a Windows .CMD that will execute a program that will read an EBCDIC-encoded file with eighty (80) byte, fixed length records and write to an ASCII-encoded, text file with variable length records.
@echo OFF
rem * *******************************************************************
rem * CBLCRDE2.CMD - a Windows Command File *
rem * This program is provided by SimoTime Enterprises *
rem * (C) Copyright 1987-2012 All Rights Reserved *
rem * Web Site URL: http://www.simotime.com *
rem * e-mail: helpdesk@simotime.com *
rem * *******************************************************************
rem *
rem * Text - Read EBCDIC fixed record file, write ASCII Text
rem * Author - SimoTime Enterprises
rem * Date - November 11, 2003
rem * Version - 03.12.15
rem *
rem * This set of programs illustrates the use of some of the commonly
rem * called I/O routines that will read or write 80 byte records from
rem * or to s record sequential or line sequential file. In this example
rem * the text string will be converted from ASCII to EBCDIC before
rem * writing to the EBCDIC-encoded file with eighty (80) byte, fixed
rem * length records.
rem *
rem * This set of programs will run on a Personal Computer with Windows
rem * and Micro Focus Net Express or Mainframe Express.
rem *
rem * ************
rem * * CBLCRDE2 *
rem * ********cmd*
rem * *
rem * ************ ************
rem * * run ******* CBLCRDC2 *
rem * ************ ********gnt*
rem * * *
rem * * *
rem * * **call************
rem * * * *
rem * * * *
rem * * ************* *
rem * * * *
rem * * * *
rem * * * ************ ************
rem * * * * GET080RS ******* SIMOGR80 * Read 80 bytes
rem * * * *******rseq* ********gnt*
rem * * *
rem * * *
rem * * ***call***********************
rem * * * *
rem * * * ************
rem * * * * SIMOXT80 * Convert EBCDIC/ASCII
rem * * * ********gnt*
rem * * *
rem * * *
rem * * ***call***********************
rem * * *
rem * * ************ ************
rem * * Write 80 bytes * SIMOPL80 ******* PUT080LS *
rem * * ********gnt* *******lseq*
rem * ************
rem * * EOJ *
rem * ************
rem *
rem * *******************************************************************
rem * Set the environment variables...
rem *
setlocal
call ..\Env1BASE
call SimoNOTE "*******************************************************CblCrdE2"
call SimoNOTE "Starting JobName CblCrdE2"
set GET080RS=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.ALPHARSE.DAT
set PUT080LS=%BaseLib1%\DATA\Wrk1\SIMOTIME.UTIL.ALPHALS2.TXT
rem * *******************************************************************
rem * Step 1 of 1 Read EBCDIC-Record-Sequential, write ASCII-Line-Sequential
rem *
if exist %PUT080LS% erase %PUT080LS%
run CblCrdC2
if "%ERRORLEVEL%" == "0" goto :EojAOK
set JobStatus=0020
goto :EojNOK
rem *
:EojNOK
call SimoNOTE "ABENDING JobName CblCrdE2, Status is %JobStatus%"
goto :End
rem *
:EojAOK
call SimoNOTE "Complete JobName CblCrdE2, Status is %JobStatus%"
goto :End
rem *
:End
call SimoNOTE "Conclude SysLog is %SYSLOG%"
if not "%1" == "nopause" pause
endlocal
The following (CBLCRDE3.CMD) is a Windows .CMD that will execute a program that will compare the contents of the two ASCII-encoded text files.
@echo OFF
rem * *******************************************************************
rem * CBLCRDE3.CMD - a Windows Command File *
rem * This program is provided by SimoTime Enterprises *
rem * (C) Copyright 1987-2012 All Rights Reserved *
rem * Web Site URL: http://www.simotime.com *
rem * e-mail: helpdesk@simotime.com *
rem * *******************************************************************
rem *
rem * Text - Compare ACTUAL80 with EXPECT80, ASCII/Text Files
rem * Author - SimoTime Enterprises
rem * Date - November 11, 2003
rem * Version - 03.12.15
rem *
rem * This set of programs illustrates the use of a COBOL program to
rem * compare two ASCII/Text files with a maximum record length of
rem * eighty (80) bytes.
rem *
rem * This set of programs will run on a Personal Computer with Windows
rem * and Micro Focus Net Express.
rem *
rem * *******************************************************************
rem * Set the environment variables...
rem *
setlocal
call ..\Env1BASE
call SimoNOTE "*******************************************************CblCrdE3"
call SimoNOTE "Starting JobName CblCrdE3"
set EXPECT80=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.ALPHALS1.TXT
set ACTUAL80=%BaseLib1%\DATA\Wrk1\SIMOTIME.UTIL.ALPHALS2.TXT
set SYSUT3=%BaseLib1%\ParmLib\CBLCRDX1.CTL
rem * *******************************************************************
rem * Step 1 of 1 Compare the ASCII/Text files
rem *
run CblCrdC3
if "%ERRORLEVEL%" == "0" goto :EojAOK
set JobStatus=0030
goto :EojNOK
rem *
:EojNOK
call SimoNOTE "ABENDING JobName CblCrdE3, Status is %JobStatus%"
goto :End
rem *
:EojAOK
call SimoNOTE "Complete JobName CblCrdE3, Status is %JobStatus%"
goto :End
rem *
:End
call SimoNOTE "Conclude SysLog is %SYSLOG%"
if not "%1" == "nopause" pause
endlocal
The following (CBLCRDE9.CMD) is a Windows .CMD that does the three preceding jobs as steps within a multi-step job.
@echo OFF
rem * *******************************************************************
rem * CBLCRDE9.CMD - a Windows Command File *
rem * This program is provided by SimoTime Enterprises *
rem * (C) Copyright 1987-2012 All Rights Reserved *
rem * Web Site URL: http://www.simotime.com *
rem * e-mail: helpdesk@simotime.com *
rem * *******************************************************************
rem *
rem * Text - Read ASCII Text and write EBCDIC fixed record file
rem * Author - SimoTime Enterprises
rem * Date - November 11, 2003
rem * Version - 03.12.15
rem *
rem * This set of programs illustrates the use of some of the commonly
rem * called I/O routines that will read or write 80 byte records from
rem * or to s record sequential or line sequential file. In this example
rem * the text string will be converted from ASCII to EBCDIC before
rem * writing to the EBCDIC-encoded file with eighty (80) byte, fixed
rem * length records.
rem *
rem * This set of programs will run on a Personal Computer with Windows
rem * and Micro Focus Net Express or Mainframe Express.
rem *
rem * *******************************************************************
rem * Set the Environment
rem *
setlocal
call ..\ENV1BASE
call SimoNOTE "*******************************************************CblCrdE9"
rem *
rem * *******************************************************************
rem * Step 1 of 3 Read ASCII-Line-Sequential, write EBCDIC-Record-Sequential
:Step01
call SimoNOTE "Starting JobName CblCrdE9, Step01"
set GET080LS=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.ALPHALS1.TXT
set PUT080RS=%BaseLib1%\DATA\Wrk1\SIMOTIME.UTIL.ALPHARSE.DAT
rem *
if exist %PUT080RS% erase %PUT080RS%
run CblCrdC1
if "%ERRORLEVEL%" == "0" goto :Step02
set JobStatus=0010
goto :EojNOK
rem *
rem * *******************************************************************
rem * Step 2 of 3 Read EBCDIC-Record-Sequential, write ASCII-Line-Sequential
:Step02
call SimoNOTE "Starting JobName CblCrdE9, Step02"
set GET080RS=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.ALPHARSE.DAT
set PUT080LS=%BaseLib1%\DATA\Wrk1\SIMOTIME.UTIL.ALPHALS2.TXT
rem *
if exist %PUT080LS% erase %PUT080LS%
run CblCrdC2
if "%ERRORLEVEL%" == "0" goto :Step03
set JobStatus=0020
goto :EojNOK
rem *
rem * *******************************************************************
rem * Step 3 of 3 Compare the ASCII-Line-Sequential files
:Step03
call SimoNOTE "Starting JobName CblCrdE9, Step03"
set EXPECT80=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.ALPHALS1.TXT
set ACTUAL80=%BaseLib1%\DATA\Wrk1\SIMOTIME.UTIL.ALPHALS2.TXT
set SYSUT3=%BaseLib1%\PARMLIB\CBLCRDX1.CTL
rem *
run CblCrdC3
if "%ERRORLEVEL%" == "0" goto :EojAOK
set JobStatus=0030
goto :EojNOK
:EojNOK
call SimoNOTE "ABENDING JobName CblCrdE9, Status is %JobStatus%"
goto :End
rem *
:EojAOK
call SimoNOTE "Complete JobName CblCrdE9, Status is %JobStatus%"
goto :End
rem *
:End
call SimoNOTE "Conclude SysLog is %SYSLOG%"
if not "%1" == "nopause" pause
endlocal
The following (ENV1BASE.CMD) is the Windows .CMD that is used to set the common environment variables used by the jobs included in this example.
@echo OFF
rem * *******************************************************************
rem * ENV1BASE.CMD - a Windows Command File *
rem * This program is provided by SimoTime Enterprises *
rem * (C) Copyright 1987-2012 All Rights Reserved *
rem * Web Site URL: http://www.simotime.com *
rem * e-mail: helpdesk@simotime.com *
rem * *******************************************************************
rem *
rem * Text - Provide a single point to set common environment variables.
rem * Author - SimoTime Enterprises
rem * Date - January 24, 1996
rem *
rem * Set the commonly used environment variables. This is used to provide
rem * a single point for managing the commonly used environment variables.
rem *
set BaseLib1=c:\SimoSAM1\DEVL
set BaseLib8=c:\SimoSAM8
set SAM1ANIM=C:\SIMOSAM1\DEVL\SAM1SOL1\SAMBATG1\bin\x86\Debug
set BASEAPP=%BaseLib1%
set BASESYS=%BaseLib1%\SYS1
set BASECAT=%BaseLib1%\DATA
set SYSLOG=%BASESYS%\LOGS\SYSLOG_USER.DAT
set SYSOUT=%BASEAPP%\LOGS\SYSOUT_SIMSAM01.TXT
set SLZMSG=%BASEAPP%\LOGS\SLZMSG_USER.TXT
set PostNOTE=%BASEAPP%\LOGS\SYSOUT_SIMONOTE.TXT
set SimoNOTE=%BASEAPP%\LOGS\SYSOUT_SIMONOTE.TXT
set MIFOBASE="C:\Program Files (x86)\Micro Focus\Studio Enterprise Edition 6.0\Base"
set MIFOBIN=%MIFOBASE%\bin
rem *
set SimoLIBR=c:\SimoLIBR
set JESSERVERNAME=SIMOBATA
rem * set SIMOMODE=PAUSE
rem *
set MAINFRAME_FLOATING_POINT=true
set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy6;c:\SimoLIBR;%MIFOBASE%\SOURCE
set COBIDY=%BASEAPP%\COBIDY
rem * For large file support and record locking control of File Handler
set EXTFH=%BASESYS%\CONFIG\EXTFHBIG.CFG
rem * For Sort Resource Allocation and Performance
set SORTSPACE=1000000
set ES_ALLOC_OVERRIDE=%BASESYS%\CONFIG\CATMAPA1.cfg
set COBCONFIG_=%BASESYS%\CONFIG\diagnose.cfg
rem * Set environment for MFBSI (Micro Focus Batch Scheduling Interface)
set ES_EMP_EXIT_1=mfbsiemx
set MFBSI_DIR=%BASESYS%\LOGS\%ezServerName%
set MFBSIEOP_CMD=ENABLE
set MFBSIEOP_CSV=ENABLE
set MFBSIEOP_HTM=ENABLE
set MFBSIEOP_XML=ENABLE
rem * Set Behavior and Trace Flags for GETJOBDD
set JDDFLAGS=nnnWnnnn/nnnnnnnn
rem *
if "%SIMOPATH%" == "Y" goto JUMPPATH
set path=%MIFOBASE%;%MIFOBIN%;%PATH%;
set COBPATH=.;%BASEAPP%\LOADLIB;%BASESYS%\LOADLIB;C:\SimoLIBR
set LIBPATH=.;%BASEAPP%\LOADLIB;%BASESYS%\LOADLIB;C:\SimoLIBR
set TXDIR=%BASESYS%\LOADLIB;%MIFOBASE%
:JUMPPATH
set SIMOPATH=Y
set JobStatus=0000
call SimoNOTE "* Settings CmdName Env1BASE.CMD, Version 10.04.19"
call SimoNOTE "* BaseAPP is %BASEAPP%"
This section provides detailed information about the COBOL programs used in this suite of sample programs.
The following (CBLCRDC1.CBL) is a sample of the COBOL program that will read an ASCII-encoded, text file with variable length records and write to an EBCDIC-encoded file with eighty (80) byte, fixed length records.
IDENTIFICATION DIVISION.
PROGRAM-ID. CBDCRDC1.
AUTHOR. SIMOTIME ENTERPRISES.
*****************************************************************
* Copyright (C) 1987-2012 SimoTime Enterprises. *
* *
* All rights reserved. Unpublished, all rights reserved under *
* copyright law and international treaty. Use of a copyright *
* notice is precautionary only and does not imply publication *
* or disclosure. *
* *
* 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. *
* *
* Permission to use, copy and modify this software for any *
* non-commercial purpose and without fee is hereby granted, *
* 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 expressed 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 *
* *
* SimoTime Enterprises *
* 15 Carnoustie Drive *
* Novato, CA 94949-5849 *
* 415.883.6565 *
* *
* RESTRICTED RIGHTS LEGEND *
* Use, duplication, or disclosure by the Government is subject *
* to restrictions as set forth in subparagraph (c)(1)(ii) of *
* the Rights in Technical Data and Computer Software clause at *
* DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of *
* Commercial Computer Software - Restricted Rights at 48 *
* CFR 52.227-19, as applicable. Contact SimoTime Enterprises, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* MAINTENANCE
* -----------
* 1994/02/27 Simmons, Created program.
*
*****************************************************************
* Source Member: CBDCRDC1.CBL
* Copy Files: PASSGL80
*
*****************************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
*****************************************************************
* Data-structure for Title and Copyright...
*****************************************************************
01 SIM-TITLE.
05 T1 pic X(11) value '* CBDCRDC1 '.
05 T2 pic X(34) value 'Get Line ASCII, Put Record EBCDIC '.
05 T3 pic X(10) value ' v06.10.20'.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBDCRDC1 '.
05 C2 pic X(20) value 'Copyright 1987-2012 '.
05 C3 pic X(28) value '--- SimoTime Enterprises ---'.
05 C4 pic X(20) value ' All Rights Reserved'.
01 SIM-THANKS-01.
05 C1 pic X(11) value '* CBDCRDC1 '.
05 C2 pic X(32) value 'Thank you for using this softwar'.
05 C3 pic X(32) value 'e provided from SimoTime Enterpr'.
05 C4 pic X(04) value 'ises'.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* CBDCRDC1 '.
05 C2 pic X(32) value 'Please send all inquires or sugg'.
05 C3 pic X(32) value 'estions to the helpdesk@simotime'.
05 C4 pic X(04) value '.com'.
*****************************************************************
* Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. *
*****************************************************************
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CBDCRDC1 '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
01 SYSUT1-TOTAL.
05 filler pic X(23) value 'Input Record count is '.
05 SYSUT1-RDR pic 9(9) value 0.
05 filler pic X value SPACE.
01 APPL-RESULT pic S9(9) comp.
88 APPL-AOK value 0.
88 APPL-EOF value 16.
01 RC-FOR-PROGRAM pic 9(4) value 0.
COPY PASSGL80.
COPY PASSPR80.
COPY PASSXT80.
*****************************************************************
PROCEDURE DIVISION.
perform Z-POST-COPYRIGHT
move 'A2E' to XT80-REQUEST
perform GET080LS-OPEN
perform PUT080RS-OPEN
move 'READ ' to GL80-FILE-REQUEST
move ZERO to SYSUT1-RDR
move ZERO to GL80-FILE-STATUS
perform until GL80-FILE-STATUS not = 0
call 'SIMOGL80' using GL80-PASS-AREA
if GL80-FILE-STATUS = 0
move GL80-PASS-80 to XT80-DATA
call 'SIMOXT80' using XT80-PASS-AREA
move XT80-DATA to PR80-PASS-80
perform PUT080RS-WRITE
add 1 to SYSUT1-RDR
end-if
end-perform
display '* CBDCRDC1 GL80 Status '
GL80-FILE-STATUS
if GL80-FILE-STATUS = 0
or GL80-FILE-STATUS = 10
move Zero to RC-FOR-PROGRAM
end-if
move SYSUT1-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
perform PUT080RS-CLOSE
perform GET080LS-CLOSE
perform Z-THANK-YOU.
add RC-FOR-PROGRAM to ZERO giving RETURN-CODE
GOBACK.
*****************************************************************
GET080LS-READ.
exit.
*---------------------------------------------------------------*
GET080LS-OPEN.
move 'FILE ' to GL80-PASS-REQUEST
move 'OPEN ' to GL80-FILE-REQUEST
call 'SIMOGL80' using GL80-PASS-AREA
if GL80-FILE-STATUS not = 0
move GL80-FILE-STATUS to MESSAGE-TEXT
move ' - Failed the OPEN of GET080LS Sequential file '
to MESSAGE-TEXT(6:38)
perform Z-DISPLAY-MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
GET080LS-CLOSE.
move 'CLOSE ' to GL80-FILE-REQUEST
call 'SIMOGL80' using GL80-PASS-AREA
exit.
*****************************************************************
PUT080RS-WRITE.
move 'WRITE' to PR80-FILE-REQUEST
call 'SIMOPR80' using PR80-PASS-AREA
exit.
*---------------------------------------------------------------*
PUT080RS-OPEN.
move 'FILE ' to PR80-PASS-REQUEST
move 'OPEN ' to PR80-FILE-REQUEST
call 'SIMOPR80' using PR80-PASS-AREA
if PR80-FILE-STATUS = 0
move 'Successful OPEN of PUT080 Sequential file'
to MESSAGE-TEXT
else
move PR80-FILE-STATUS to MESSAGE-TEXT
move ' - Failed the OPEN of PUT080 Sequential file '
to MESSAGE-TEXT(6:38)
end-if
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*---------------------------------------------------------------*
PUT080RS-CLOSE.
move 'CLOSE ' to PR80-FILE-REQUEST
call 'SIMOPR80' using PR80-PASS-AREA
exit.
*****************************************************************
* The following Z-Routines perform administrative tasks *
* for this program. *
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
Z-ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform Z-DISPLAY-MESSAGE-TEXT
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
add 12 to ZERO giving RETURN-CODE
STOP RUN.
* exit.
*****************************************************************
Z-POST-COPYRIGHT.
move SIM-TITLE to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
move SIM-COPYRIGHT to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
Z-DISPLAY-MESSAGE-TEXT.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79)
else
display MESSAGE-BUFFER
end-if
move all SPACES to MESSAGE-TEXT
exit.
*****************************************************************
Z-THANK-YOU.
move SIM-THANKS-01 to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
move SIM-THANKS-02 to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*****************************************************************
* This example is provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
The following (CBLCRDC2.CBL) is a sample of the COBOL program that will read an EBCDIC-encoded file with eighty (80) byte, fixed length records and write to an ASCII-encoded, text file with variable length records.
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLCRDC2.
AUTHOR. SIMOTIME ENTERPRISES.
*****************************************************************
* Copyright (C) 1987-2012 SimoTime Enterprises. *
* *
* All rights reserved. Unpublished, all rights reserved under *
* copyright law and international treaty. Use of a copyright *
* notice is precautionary only and does not imply publication *
* or disclosure. *
* *
* 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. *
* *
* Permission to use, copy and modify this software for any *
* non-commercial purpose and without fee is hereby granted, *
* 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 expressed 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 *
* *
* SimoTime Enterprises *
* 15 Carnoustie Drive *
* Novato, CA 94949-5849 *
* 415.883.6565 *
* *
* RESTRICTED RIGHTS LEGEND *
* Use, duplication, or disclosure by the Government is subject *
* to restrictions as set forth in subparagraph (c)(1)(ii) of *
* the Rights in Technical Data and Computer Software clause at *
* DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of *
* Commercial Computer Software - Restricted Rights at 48 *
* CFR 52.227-19, as applicable. Contact SimoTime Enterprises, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* MAINTENANCE
* -----------
* 1994/02/27 Simmons, Created program.
*
*****************************************************************
* Source Member: CBDCRDC2.CBL
* Copy Files: PASSGR80
* PASSPL80
*****************************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
*****************************************************************
* Data-structure for Title and Copyright...
*****************************************************************
01 SIM-TITLE.
05 T1 pic X(11) value '* CBDCRDC2 '.
05 T2 pic X(34) value 'Get Record EBCDIC, Put Line ASCII '.
05 T3 pic X(10) value ' v06.10.20'.
05 T4 pic X(24) value ' http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBDCRDC2 '.
05 C2 pic X(20) value 'Copyright 1987-2012 '.
05 C3 pic X(28) value '--- SimoTime Enterprises ---'.
05 C4 pic X(20) value ' All Rights Reserved'.
01 SIM-THANKS-01.
05 C1 pic X(11) value '* CBDCRDC2 '.
05 C2 pic X(32) value 'Thank you for using this softwar'.
05 C3 pic X(32) value 'e provided from SimoTime Enterpr'.
05 C4 pic X(04) value 'ises'.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* CBDCRDC2 '.
05 C2 pic X(32) value 'Please send all inquires or sugg'.
05 C3 pic X(32) value 'estions to the helpdesk@simotime'.
05 C4 pic X(04) value '.com'.
*****************************************************************
* Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. *
*****************************************************************
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CBDCRDC2 '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
01 SYSUT1-TOTAL.
05 filler pic X(23) value 'Input Record count is '.
05 SYSUT1-RDR pic 9(9) value 0.
05 filler pic X value SPACE.
01 APPL-RESULT pic S9(9) comp.
88 APPL-AOK value 0.
88 APPL-EOF value 16.
01 RC-FOR-PROGRAM pic 9(4) value 0.
COPY PASSGR80.
COPY PASSPL80.
COPY PASSXT80.
*****************************************************************
PROCEDURE DIVISION.
perform Z-POST-COPYRIGHT
move 'E2A' to XT80-REQUEST
perform GET080RS-OPEN
perform PUT080LS-OPEN
move 'READ ' to GR80-FILE-REQUEST
move ZERO to SYSUT1-RDR
move ZERO to GR80-FILE-STATUS
perform until GR80-FILE-STATUS not = 0
call 'SIMOGR80' using GR80-PASS-AREA
if GR80-FILE-STATUS = 0
move GR80-PASS-80 to XT80-DATA
call 'SIMOXT80' using XT80-PASS-AREA
move XT80-DATA to PL80-PASS-80
perform PUT080LS-WRITE
add 1 to SYSUT1-RDR
end-if
end-perform
display '* CBDCRDC2 GR80 Status '
GR80-FILE-STATUS
if GR80-FILE-STATUS = 0
or GR80-FILE-STATUS = 10
move Zero to RC-FOR-PROGRAM
end-if
move SYSUT1-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
perform PUT080LS-CLOSE
perform GET080RS-CLOSE
perform Z-THANK-YOU.
add RC-FOR-PROGRAM to ZERO giving RETURN-CODE
GOBACK.
*****************************************************************
GET080LS-READ.
exit.
*---------------------------------------------------------------*
GET080RS-OPEN.
move 'FILE ' to GR80-PASS-REQUEST
move 'OPEN ' to GR80-FILE-REQUEST
call 'SIMOGR80' using GR80-PASS-AREA
if GR80-FILE-STATUS not = 0
move GR80-FILE-STATUS to MESSAGE-TEXT
move ' - Failed the OPEN of GET080RS Sequential file '
to MESSAGE-TEXT(6:38)
perform Z-DISPLAY-MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
GET080RS-CLOSE.
move 'CLOSE ' to GR80-FILE-REQUEST
call 'SIMOGR80' using GR80-PASS-AREA
exit.
*****************************************************************
PUT080LS-WRITE.
move 'WRITE' to PL80-FILE-REQUEST
call 'SIMOPL80' using PL80-PASS-AREA
exit.
*---------------------------------------------------------------*
PUT080LS-OPEN.
move 'FILE ' to PL80-PASS-REQUEST
move 'OPEN ' to PL80-FILE-REQUEST
call 'SIMOPL80' using PL80-PASS-AREA
if PL80-FILE-STATUS = 0
move 'Successful OPEN of PUT080 Sequential file'
to MESSAGE-TEXT
else
move PL80-FILE-STATUS to MESSAGE-TEXT
move ' - Failed the OPEN of PUT080 Sequential file '
to MESSAGE-TEXT(6:38)
end-if
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*---------------------------------------------------------------*
PUT080LS-CLOSE.
move 'CLOSE ' to PL80-FILE-REQUEST
call 'SIMOPL80' using PL80-PASS-AREA
exit.
*****************************************************************
* The following Z-Routines perform administrative tasks *
* for this program. *
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
Z-ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform Z-DISPLAY-MESSAGE-TEXT
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
add 12 to ZERO giving RETURN-CODE
STOP RUN.
* exit.
*****************************************************************
Z-POST-COPYRIGHT.
move SIM-TITLE to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
move SIM-COPYRIGHT to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
Z-DISPLAY-MESSAGE-TEXT.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79)
else
display MESSAGE-BUFFER
end-if
move all SPACES to MESSAGE-TEXT
exit.
*****************************************************************
Z-THANK-YOU.
move SIM-THANKS-01 to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
move SIM-THANKS-02 to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*****************************************************************
* This example is provided by SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
The following (CBLCRDC3.CBL) is a sample of the COBOL program that will compare the contents of the two ASCII-encoded text files.
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLCRDC3.
AUTHOR. SIMOTIME ENTERPRISES.
*****************************************************************
* This program was generated by SimoZAPS *
* A product of SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2012-01-25 Generation Time: 01:23:44:35 *
* *
* Record Record Key *
* Function Name Organization Format Max-Min Pos-Len *
* INPUT EXPECT80 ASCII/CRLF FIXED 00080 *
* *
* OUTPUT ACTUAL80 ASCII/CRLF FIXED 00080 *
* *
* *
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EXPECT80-FILE ASSIGN TO EXPECT80
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS EXPECT80-STATUS.
SELECT ACTUAL80-FILE ASSIGN TO ACTUAL80
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS ACTUAL80-STATUS.
SELECT SYSUT3-FILE ASSIGN TO SYSUT3
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS SYSUT3-STATUS.
*****************************************************************
DATA DIVISION.
FILE SECTION.
FD EXPECT80-FILE
DATA RECORD IS EXPECT80-REC
.
01 EXPECT80-REC.
05 EXPECT80-DATA-01 PIC X(00080).
FD ACTUAL80-FILE
DATA RECORD IS ACTUAL80-REC
.
01 ACTUAL80-REC.
05 ACTUAL80-DATA-01 PIC X(00080).
FD SYSUT3-FILE
DATA RECORD IS SYSUT3-REC
.
01 SYSUT3-REC.
05 SYSUT3-DATA-01 PIC X(80).
*****************************************************************
* This program was created using the SYSCOMP2.TXT file as the *
* template for the data file comparison. The positions to be *
* compared are determined by reading a control file at *
* execution time. *
* *
* For more information or questions please contact SimoTime *
* Enterprises. The version control number is 11.01.08 *
* *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
*****************************************************************
WORKING-STORAGE SECTION.
01 SIM-TITLE.
05 T1 pic X(11) value '* CBLCRDC3 '.
05 T2 pic X(34) value 'Do a Physical 80-Byte Comparison '.
05 T3 pic X(10) value ' v11.11.29'.
05 T4 pic X(24) value ' helpdesk@simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBLCRDC3 '.
05 C2 pic X(32) value 'This Data File Compare Member wa'.
05 C3 pic X(32) value 's generated by SimoTime Technolo'.
05 C4 pic X(04) value 'gies'.
01 SIM-THANKS-01.
05 C1 pic X(11) value '* CBLCRDC3 '.
05 C2 pic X(32) value 'A Data File Compare Program gene'.
05 C3 pic X(32) value 'rated by using SimoTime Technolo'.
05 C4 pic X(04) value 'gies'.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* CBLCRDC3 '.
05 C2 pic X(32) value 'Please send all inquires or sugg'.
05 C3 pic X(32) value 'estions to the helpdesk@simotime'.
05 C4 pic X(04) value '.com'.
01 EXPECT80-STATUS.
05 EXPECT80-STATUS-L pic X.
05 EXPECT80-STATUS-R pic X.
01 EXPECT80-EOF pic X value 'N'.
01 EXPECT80-OPEN-FLAG pic X value 'C'.
01 ACTUAL80-STATUS.
05 ACTUAL80-STATUS-L pic X.
05 ACTUAL80-STATUS-R pic X.
01 ACTUAL80-EOF pic X value 'N'.
01 ACTUAL80-OPEN-FLAG pic X value 'C'.
01 SYSUT3-STATUS.
05 SYSUT3-STATUS-L pic X.
05 SYSUT3-STATUS-R pic X.
01 SYSUT3-EOF pic X value 'N'.
01 SYSUT3-OPEN-FLAG pic X value 'C'.
*****************************************************************
* The following buffers are used to create a four-byte status *
* code that may be displayed. *
*****************************************************************
01 IO-STATUS.
05 IO-STAT1 pic X.
05 IO-STAT2 pic X.
01 IO-STATUS-04.
05 IO-STATUS-0401 pic 9 value 0.
05 IO-STATUS-0403 pic 999 value 0.
01 TWO-BYTES-BINARY pic 9(4) BINARY.
01 TWO-BYTES-ALPHA redefines TWO-BYTES-BINARY.
05 TWO-BYTES-LEFT pic X.
05 TWO-BYTES-RIGHT pic X.
*****************************************************************
* Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. *
*****************************************************************
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CBLCRDC3 '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
*****************************************************************
01 APPL-RESULT pic S9(9) comp.
88 APPL-AOK value 0.
88 APPL-EOF value 16.
01 READ-FLAGS.
05 READ-1 pic X value 'Y'.
05 READ-2 pic X value 'Y'.
01 DUMP-FLAGS.
05 DUMP-ASC pic X value 'Y'.
05 DUMP-EBC pic X value 'Y'.
05 DUMP-HEX pic X value 'Y'.
01 FUNCTION-FLAGS.
05 FF-01 pic X value '0'.
05 FF-02 pic X value '0'.
01 COMPACT-STATUS pic XX value 'EQ'.
01 COMPACT-PENDED pic XX value 'EQ'.
01 COMPARE-STATUS pic XX value 'EQ'.
01 FLAG-EQ pic XX value 'EQ'.
01 FLAG-NE pic XX value 'NE'.
01 FLAG-QT pic XX value 'QT'.
01 DELTA-LINE-1 pic X(1024) value all '-'.
01 DELTA-LINE-2 pic X(1024) value all '-'.
01 PTR-1 pic 9(5) value 0.
01 PTR-2 pic 9(5) value 0.
01 IDX-1 pic 9(5) value 0.
01 IDX-2 pic 9(5) value 0.
01 DELTA-MAXIMUM-X pic X(5) value '00005'.
01 DELTA-MAXIMUM redefines DELTA-MAXIMUM-X pic 9(5).
01 DELTA-PROCESS pic X(4) value 'EOF '.
01 YES-YES pic XX value 'YY'.
01 N-BYTE pic X value 'N'.
01 Y-BYTE pic X value 'Y'.
01 KEY-ACTIVE pic X value 'Y'.
01 KEY-CONTROL-1.
05 PS-1 pic 9(5) value 00000.
05 LN-1 pic 9(5) value 00000.
01 KEY-CONTROL-2.
05 PS-2 pic 9(5) value 00000.
05 LN-2 pic 9(5) value 00000.
01 EXPECT80-LRECL pic 9(5) value 00080.
01 ACTUAL80-LRECL pic 9(5) value 00080.
01 D-LEN pic 9(5) value 128.
01 D-POS pic 9(5) value 1.
01 ASC-OR-EBC pic 9(3) comp value 0.
01 ASC-OR-EBC-R redefines ASC-OR-EBC.
05 ASC-A pic X.
05 EBC-A pic X.
* Header row for positional indicator...
01 DUMP-H10.
05 FILLER pic X(5) value '....:'.
05 POS-NO pic 9(5) value 10.
01 DUMP-HEADER pic X(1024) value all '.'.
01 D-P1 pic 9(5) value 0.
01 RECORD-HEADER.
05 RECORD-ID pic X(8) value 'EXPECT80'.
05 filler pic X(2) value '..'.
05 REC-NUMBER pic 9(9) value 0.
05 filler pic X value '('.
05 RECORD-POS pic 9(5) value 0.
05 filler pic X value ':'.
05 RECORD-LEN pic 9(5) value 0.
05 filler pic X value ')'.
01 SYSLOG-OUTPUT pic X(4) value 'OUT2'.
01 SYSUT3-KEYWORD pic X(10) value SPACES.
01 INFO-STATEMENT.
05 INFO-SHORT.
10 INFO-ID pic X(8) value 'Starting'.
10 filler pic X(4) value ' - '.
10 INFO-34 pic X(34)
value 'Do a Physical 80-Byte Comparison '.
05 filler pic X(33)
value ' http://www.SimoTime.com'.
01 EXPECT80-TOTAL.
05 EXPECT80-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Record count for EXPECT80'.
01 ACTUAL80-TOTAL.
05 ACTUAL80-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Record count for ACTUAL80'.
01 SYSUT3-TOTAL.
05 SYSUT3-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Record count for SYSUT3 '.
01 COMPARE-NE-TOTAL.
05 COMPARE-NE pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 COMPARE-TAG pic X(25) value 'All Equal result for comp'.
05 filler pic X(25) value 'are of existing records '.
01 COMPACT-NE-TOTAL.
05 COMPACT-NE pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 COMPACT-TAG pic X(25) value 'All Equal result for comp'.
05 filler pic X(25) value 'act of existing records '.
01 FORMAT-TYPE pic X value 'B'.
01 WORK-05-X.
05 WORK-05-N pic 9(5).
01 COMPARE-TABLE.
05 POS-1 pic 9(5) value 0 occurs 32 times.
05 LEN-1 pic 9(5) value 0 occurs 32 times.
05 POS-2 pic 9(5) value 0 occurs 32 times.
05 LEN-2 pic 9(5) value 0 occurs 32 times.
01 CX-LIMIT pic 9(3) value 32.
01 CX-1 pic 9(3) value 0.
01 PARSE-TABLE.
05 PT-OSET pic 9(3) value 0 occurs 15 times.
05 PT-SIZE pic 9(3) value 0 occurs 15 times.
01 PT-LIMIT pic 9(3) value 15.
01 PX-1 pic 9(3) value 0.
01 PX-2 pic 9(3) value 0.
01 PX-MAX-ITEMS pic 9(3) value 15.
01 PX-ACTIVE pic 9(3) value 0.
01 PX-BUFFER-SIZE pic 9(3) value 80.
01 PX-LAST-SIG-BYTE pic 9(5) value 0.
01 B-COUNT pic 9(3) value 0.
01 DISPLAY-MODE pic X(10) value 'CONSOLE '.
01 SYSLOG-MODE pic X(10) value 'DISABLE '.
01 SYSLOG-OUTPUT-FLAG pic X value 'N'.
01 COMPARE-MSG-DATA.
05 FILLER pic X(30) value 'Error, /COMPARE '.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT1 '.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT1 POS '.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT1 POS nnn'.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT1 LEN '.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT1 LEN nnn'.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT2 '.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT2 POS '.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT2 POS nnn'.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT2 LEN '.
05 FILLER pic X(30) value 'Error, /COMPARE SYSUT2 LEN nnn'.
01 COMPARE-MSG-DATA-R redefines COMPARE-MSG-DATA.
05 COMPARE-MSG pic X(30) occurs 11 times.
01 U-CASE pic X(26) value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
01 L-CASE pic X(26) value 'abcdefghijklmnopqrstuvwxyz'.
COPY PASSHEX4.
COPY PASSLOGS.
COPY PAENVARS.
*****************************************************************
PROCEDURE DIVISION.
perform JOB-STARTING
perform
until COMPARE-STATUS = 'QT'
or EXPECT80-STATUS not = '00'
or ACTUAL80-STATUS not = '00'
if READ-1 = 'Y'
perform EXPECT80-READ
end-if
if READ-2 = 'Y'
perform ACTUAL80-READ
end-if
if EXPECT80-STATUS = '00'
and ACTUAL80-STATUS = '00'
move 'EQ' to COMPARE-STATUS
if KEY-ACTIVE = 'Y'
perform COMPARE-KEYS
end-if
if COMPARE-STATUS = FLAG-EQ
perform COMPARE-RECORDS
end-if
if COMPARE-STATUS = FLAG-NE
add 1 to COMPARE-NE
end-if
end-if
if DELTA-PROCESS = 'QUIT'
and COMPARE-NE > DELTA-MAXIMUM
move 'The Not Equal count exceeds Maximum limit...'
to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
if DELTA-PROCESS = 'EOF '
and COMPARE-NE > DELTA-MAXIMUM
move 'The Not Equal count exceeds Maximum limit...'
to MESSAGE-TEXT
perform Z-DISPLAY-TO-CONSOLE
move 'QT' to COMPARE-STATUS
end-if
end-perform
perform JOB-FINISHED
GOBACK.
*****************************************************************
COMPARE-RECORDS.
* Compare using SYSUT3 parameters...
add 1 to ZERO giving CX-1
perform until CX-1 > CX-LIMIT
if EXPECT80-REC(POS-1(CX-1):LEN-1(CX-1))
not = ACTUAL80-REC(POS-2(CX-1):LEN-2(CX-1))
move FLAG-NE to COMPARE-STATUS
if COMPARE-NE < DELTA-MAXIMUM
add POS-1(CX-1) to ZERO giving D-POS
add POS-1(CX-1) to ZERO giving RECORD-POS
add LEN-1(CX-1) to ZERO giving D-LEN
add LEN-1(CX-1) to ZERO giving PASSHEX4-LENGTH
add LEN-1(CX-1) to ZERO giving RECORD-LEN
perform DUMP-PRIMARY-RECORD
add POS-2(CX-1) to ZERO giving D-POS
add POS-2(CX-1) to ZERO giving RECORD-POS
add LEN-2(CX-1) to ZERO giving D-LEN
add LEN-2(CX-1) to ZERO giving PASSHEX4-LENGTH
add LEN-2(CX-1) to ZERO giving RECORD-LEN
perform DUMP-SECONDARY-RECORD
perform DUMP-POSITION-DIFFERENCE
end-if
end-if
if READ-FLAGS not = 'YY'
add CX-LIMIT to 1 giving CX-1
else
add 1 to CX-1
end-if
end-perform
exit.
*****************************************************************
COMPARE-KEYS.
move YES-YES to READ-FLAGS
if EXPECT80-REC(PS-1:LN-1)
< ACTUAL80-REC(PS-2:LN-2)
move N-BYTE to READ-2
move FLAG-NE to COMPARE-STATUS
perform DUMP-PRIMARY-MISSING
end-if
if EXPECT80-REC(PS-1:LN-1)
> ACTUAL80-REC(PS-2:LN-2)
move N-BYTE to READ-1
move FLAG-NE to COMPARE-STATUS
perform DUMP-SECONDARY-MISSING
end-if
exit.
*****************************************************************
DUMP-TO-LOG.
* HexDump...
* Dump DD Name, Record-Number, (position,length)
move RECORD-HEADER to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
* DUMP position indicator
perform DUMP-POSITION-INDICATOR
if DUMP-ASC = 'Y'
move PASSHEX4-ASCII(1:D-LEN) to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
if DUMP-HEX = 'Y'
move PASSHEX4-UPPER(1:D-LEN) to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move PASSHEX4-LOWER(1:D-LEN) to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
if DUMP-EBC = 'Y'
move PASSHEX4-EBCDIC(1:D-LEN) to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
exit.
*****************************************************************
* Build the position header row...
*****************************************************************
DUMP-POSITION-INDICATOR.
add 9 to D-POS giving POS-NO
perform varying D-P1 from 1 by 10 until D-P1 > 1020
move DUMP-H10 to DUMP-HEADER(D-P1:10)
inspect DUMP-HEADER(D-P1 + 5:5)
replacing leading ZEROES by '.'
add 10 to POS-NO
end-perform
move DUMP-HEADER(1:D-LEN) to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
exit.
*****************************************************************
DUMP-PRIMARY-MISSING.
move 'EXPECT80 Record is missing from ACTUAL80 file'
to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move SPACES to PASSHEX4-SOURCE
add EXPECT80-RDR to ZERO giving REC-NUMBER
add PS-1 to ZERO giving RECORD-POS
add LN-1 to ZERO giving RECORD-LEN
add PS-1 to ZERO giving D-POS
add LN-1 to ZERO giving D-LEN
move 'EXPECT80..' to RECORD-ID
move EXPECT80-REC(PS-1:LN-1) to PASSHEX4-SOURCE
call 'SIMOHEX4' using PASSHEX4-PASS-AREA
perform DUMP-TO-LOG
perform DUMP-POSITION-DIFFERENCE
exit.
*****************************************************************
DUMP-PRIMARY-RECORD.
move SPACES to PASSHEX4-SOURCE
if READ-1 = 'Y'
and EXPECT80-EOF = 'N'
move 'EXPECT80..' to RECORD-ID
add EXPECT80-RDR to ZERO giving REC-NUMBER
move EXPECT80-REC(D-POS:D-LEN) to PASSHEX4-SOURCE
call 'SIMOHEX4' using PASSHEX4-PASS-AREA
perform DUMP-TO-LOG
else
move 'EXPECT80..Record is missing from EXPECT80 file'
to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
exit.
*****************************************************************
DUMP-SECONDARY-MISSING.
move 'ACTUAL80..Record is missing from EXPECT80 file'
to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move SPACES to PASSHEX4-SOURCE
add ACTUAL80-RDR to ZERO giving REC-NUMBER
add PS-2 to ZERO giving RECORD-POS
add LN-2 to ZERO giving RECORD-LEN
add PS-2 to ZERO giving D-POS
add LN-2 to ZERO giving D-LEN
move 'ACTUAL80..' to RECORD-ID
move ACTUAL80-REC(PS-2:LN-2) to PASSHEX4-SOURCE
call 'SIMOHEX4' using PASSHEX4-PASS-AREA
perform DUMP-TO-LOG
perform DUMP-POSITION-DIFFERENCE
exit.
*****************************************************************
DUMP-SECONDARY-RECORD.
move SPACES to PASSHEX4-SOURCE
move 'ACTUAL80..' to RECORD-ID
add ACTUAL80-RDR to ZERO giving REC-NUMBER
move ACTUAL80-REC(D-POS:D-LEN) to PASSHEX4-SOURCE
call 'SIMOHEX4' using PASSHEX4-PASS-AREA
perform DUMP-TO-LOG
exit.
*****************************************************************
DUMP-POSITION-DIFFERENCE.
if READ-FLAGS = 'YY'
move all '-' to DELTA-LINE-2
add POS-1(CX-1) to ZERO giving PTR-1
add POS-2(CX-1) to ZERO giving PTR-2
add 1 to ZERO giving IDX-2
perform until IDX-2 > 1024
or IDX-2 > D-LEN
if EXPECT80-REC(PTR-1:1)
= ACTUAL80-REC(PTR-2:1)
move '=' to DELTA-LINE-2(IDX-2:1)
else
move '#' to DELTA-LINE-2(IDX-2:1)
end-if
add 1 to PTR-1
add 1 to PTR-2
add 1 to IDX-2
end-perform
else
move all '#' to DELTA-LINE-2
end-if
move DELTA-LINE-2(1:D-LEN) to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move '*' to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
exit.
*****************************************************************
JOB-FINISHED.
if EXPECT80-STATUS = '00'
and DELTA-PROCESS = 'EOF '
perform
until EXPECT80-STATUS not = '00'
if READ-1 = 'Y'
perform EXPECT80-READ
end-if
end-perform
end-if
if ACTUAL80-STATUS = '00'
and DELTA-PROCESS = 'EOF '
perform
until ACTUAL80-STATUS not = '00'
if READ-2 = 'Y'
perform ACTUAL80-READ
end-if
end-perform
end-if
perform ACTUAL80-CLOSE
perform EXPECT80-CLOSE
move 'Conclude' to INFO-ID
move INFO-SHORT to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move 'Finished' to INFO-ID
move EXPECT80-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move ACTUAL80-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
if EXPECT80-RDR not = ACTUAL80-RDR
move 'WARNING! - Record counts are not equal'
to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move 'ABENDING' to INFO-ID
end-if
if COMPARE-NE > 0
move 'ABENDING' to INFO-ID
move 'NOT' to COMPARE-TAG(1:3)
end-if
move COMPARE-NE-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
if COMPACT-NE > 0
move 'ABENDING' to INFO-ID
move 'NOT' to COMPACT-TAG(1:3)
end-if
move COMPACT-NE-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
if EXPECT80-EOF not = 'Y'
or ACTUAL80-EOF not = 'Y'
move 'ABENDING' to INFO-ID
end-if
move INFO-STATEMENT to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move INFO-SHORT to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
perform Z-THANK-YOU.
if COMPARE-NE > 0
or EXPECT80-RDR not = ACTUAL80-RDR
add 4 to ZERO giving RETURN-CODE
end-if
exit.
*****************************************************************
JOB-STARTING.
perform Z-POST-COPYRIGHT
perform Z-DETERMINE-ENVIRONMENT
perform JOB-STARTING-GET-CONTROL
perform EXPECT80-OPEN
perform ACTUAL80-OPEN
move 'Y' to READ-1
move 'Y' to READ-2
if DELTA-MAXIMUM not numeric
add 100 to ZERO giving DELTA-MAXIMUM
end-if
if PS-1 > 0
and PS-2 > 0
and LN-1 > 0
and LN-2 > 0
move 'Y' to KEY-ACTIVE
move 'Key control is ENABLED...'
to MESSAGE-TEXT
else
move 'N' to KEY-ACTIVE
move 'Key control is NOT enabled...'
to MESSAGE-TEXT
end-if
perform Z-DISPLAY-MESSAGE-TEXT
move 'DUMP' to PASSHEX4-REQUEST
add 128 to ZERO giving PASSHEX4-LENGTH
move SYSLOG-OUTPUT to SIMOLOGS-REQUEST
move SPACES to SIMOLOGS-MESSAGE
move all '*' to SIMOLOGS-MESSAGE(1:80)
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move INFO-STATEMENT to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move all '*' to SIMOLOGS-MESSAGE(1:80)
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move SIM-TITLE to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move SIM-COPYRIGHT to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
exit.
*****************************************************************
JOB-STARTING-GET-CONTROL.
perform SYSUT3-OPEN
perform INITIALIZE-TABLE-CX
perform until SYSUT3-STATUS not = '00'
perform SYSUT3-READ
if SYSUT3-STATUS = '00'
move SYSUT3-REC to MESSAGE-TEXT-1
perform Z-DISPLAY-MESSAGE-TEXT
if SYSUT3-REC(1:1) = '/'
perform INITIALIZE-TABLE-PX
inspect SYSUT3-REC converting L-CASE to U-CASE
perform PARSE-BUFFER
perform PROCESS-CONTROL-RECORD
else
if SYSUT3-REC(1:1) not = '*'
move 'Preceding Control statement is invalid'
to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
end-if
else
if SYSUT3-EOF = 'Y'
move 'SYSUT3 at EOF...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
end-if
end-if
end-perform
add CX-1 to ZERO giving CX-LIMIT
perform SYSUT3-CLOSE
if SYSLOG-OUTPUT-FLAG = 'Y'
if SYSLOG-MODE = 'ENABLE '
evaluate DISPLAY-MODE
when 'CONSOLE ' move 'OPR2' to SYSLOG-OUTPUT
when 'SYSOUT ' move 'OUT2' to SYSLOG-OUTPUT
when other move 'LOG1' to SYSLOG-OUTPUT
end-evaluate
else
evaluate DISPLAY-MODE
when 'CONSOLE ' move 'OPR1' to SYSLOG-OUTPUT
when 'SYSOUT ' move 'OUT1' to SYSLOG-OUTPUT
end-evaluate
end-if
end-if
exit.
*****************************************************************
INITIALIZE-TABLE-CX.
add 1 to ZERO giving CX-1
perform until CX-1 > CX-LIMIT
move 0 to POS-1(CX-1)
move 0 to LEN-1(CX-1)
move 0 to POS-2(CX-1)
move 0 to LEN-2(CX-1)
add 1 to CX-1
end-perform
move ZERO to RETURN-CODE
subtract CX-1 from CX-1
exit.
*****************************************************************
INITIALIZE-TABLE-PX.
add 1 to ZERO giving PX-1
perform until PX-1 > PT-LIMIT
move 0 to PT-OSET(PX-1)
move 0 to PT-SIZE(PX-1)
add 1 to PX-1
end-perform
add 1 to ZERO giving PX-1
add 1 to ZERO giving PX-2
exit.
*****************************************************************
PARSE-BUFFER.
if SYSUT3-REC(PX-1:1) not = SPACE
add PX-1 to ZERO giving PX-LAST-SIG-BYTE
end-if
perform until PX-1 > PX-BUFFER-SIZE
if SYSUT3-REC(PX-1:1) = SPACE
add 1 to B-COUNT
if B-COUNT = 1
and PT-SIZE(PX-2) > 0
if PX-2 < PX-MAX-ITEMS
add 1 to PX-2
add 1 to PX-MAX-ITEMS
else
move PX-BUFFER-SIZE to PX-2
end-if
end-if
else
subtract B-COUNT from B-COUNT
add 1 to PT-SIZE(PX-2)
if PT-SIZE(PX-2) = 1
move PX-1 to PT-OSET(PX-2)
end-if
end-if
add 1 to PX-1
end-perform
exit.
*****************************************************************
PROCESS-CONTROL-RECORD.
add 1 to ZERO giving PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) < 11
move SPACES to SYSUT3-KEYWORD
move SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
to SYSUT3-KEYWORD
evaluate SYSUT3-KEYWORD
when '/COMPARE '
perform PROCESS-CONTROL-RECORD-COMPARE
when '/DISPLAY '
add 1 to PX-1
move SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
to DISPLAY-MODE
move 'Y' to SYSLOG-OUTPUT-FLAG
when '/SYSLOG '
add 1 to PX-1
move SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
to SYSLOG-MODE
move 'Y' to SYSLOG-OUTPUT-FLAG
when other
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-evaluate
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
PROCESS-CONTROL-RECORD-COMPARE.
add 1 to CX-1
add 2 to ZERO giving PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) = 6
if SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
not = 'SYSUT1'
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) = 3
if SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
not = 'POS'
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) < 6
move SPACES to WORK-05-X
move SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
to WORK-05-X
perform RIGHT-ADJUST-05
if WORK-05-X is NUMERIC
add WORK-05-N to ZERO giving POS-1(CX-1)
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) = 3
if SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
not = 'LEN'
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) < 6
move SPACES to WORK-05-X
move SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
to WORK-05-X
perform RIGHT-ADJUST-05
if WORK-05-X is NUMERIC
add WORK-05-N to ZERO giving LEN-1(CX-1)
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) = 6
if SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
not = 'SYSUT2'
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) = 3
if SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
not = 'POS'
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) < 6
move SPACES to WORK-05-X
move SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
to WORK-05-X
perform RIGHT-ADJUST-05
if WORK-05-X is NUMERIC
add WORK-05-N to ZERO giving POS-2(CX-1)
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) = 3
if SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
not = 'LEN'
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
add 1 to PX-1
if PT-OSET(PX-1) > ZERO
and PT-SIZE(PX-1) < 6
move SPACES to WORK-05-X
move SYSUT3-REC(PT-OSET(PX-1):PT-SIZE(PX-1))
to WORK-05-X
perform RIGHT-ADJUST-05
if WORK-05-X is NUMERIC
add WORK-05-N to ZERO giving LEN-2(CX-1)
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
else
move COMPARE-MSG(PX-1) to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
RIGHT-ADJUST-05.
if WORK-05-X(5:1) = SPACES
perform until WORK-05-X(5:1) not = SPACE
move WORK-05-X(4:1) to WORK-05-X(5:1)
move WORK-05-X(3:1) to WORK-05-X(4:1)
move WORK-05-X(2:1) to WORK-05-X(3:1)
move WORK-05-X(1:1) to WORK-05-X(2:1)
move "0" to WORK-05-X(1:1)
end-perform
end-if
exit.
*****************************************************************
* I/O Routines for the Control File... *
*****************************************************************
SYSUT3-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close SYSUT3-FILE
if SYSUT3-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with SYSUT3' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SYSUT3-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
SYSUT3-READ.
read SYSUT3-FILE
if SYSUT3-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
add 1 to SYSUT3-RDR
else
if SYSUT3-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 SYSUT3-EOF
else
move 'READ Failure with SYSUT3' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move SYSUT3-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
SYSUT3-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input SYSUT3-FILE
if SYSUT3-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to SYSUT3-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with SYSUT3' to MESSAGE-TEXT
perform Z-DISPLAY-TO-CONSOLE
perform Z-DISPLAY-MESSAGE-TEXT
move SYSUT3-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* I/O Routines for the Primary File... *
*****************************************************************
EXPECT80-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close EXPECT80-FILE
if EXPECT80-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with EXPECT80' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move EXPECT80-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
EXPECT80-READ.
read EXPECT80-FILE
if EXPECT80-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
add 1 to EXPECT80-RDR
else
if EXPECT80-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 EXPECT80-EOF
else
move 'READ Failure with EXPECT80' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move EXPECT80-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
EXPECT80-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input EXPECT80-FILE
if EXPECT80-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to EXPECT80-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with EXPECT80' to MESSAGE-TEXT
perform Z-DISPLAY-TO-CONSOLE
perform Z-DISPLAY-MESSAGE-TEXT
move EXPECT80-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* I/O Routines for the Secondary File... *
*****************************************************************
ACTUAL80-READ.
read ACTUAL80-FILE
if ACTUAL80-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
add 1 to ACTUAL80-RDR
else
if ACTUAL80-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 ACTUAL80-EOF
else
move 'READ Failure with ACTUAL80' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move ACTUAL80-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
ACTUAL80-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input ACTUAL80-FILE
if ACTUAL80-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to ACTUAL80-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with ACTUAL80' to MESSAGE-TEXT
perform Z-DISPLAY-TO-CONSOLE
perform Z-DISPLAY-MESSAGE-TEXT
move ACTUAL80-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
ACTUAL80-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close ACTUAL80-FILE
if ACTUAL80-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'C' to ACTUAL80-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with ACTUAL80' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move ACTUAL80-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* The following Z-ROUTINES provide administrative functions *
* for this program. *
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
Z-ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform Z-DISPLAY-MESSAGE-TEXT
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
add 12 to ZERO giving RETURN-CODE
STOP RUN.
* exit.
*****************************************************************
Z-DETERMINE-ENVIRONMENT.
add 16833 to ASC-OR-EBC
if ASC-A = 'A'
move 'Compiled for an ASCII environment...'
to MESSAGE-TEXT
else
if EBC-A = 'A'
move 'Compiled for an EBCDIC environment...'
to MESSAGE-TEXT
else
move 'Compiled for an UNKNOWN environment...'
to MESSAGE-TEXT
end-if
end-if
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*****************************************************************
* Display to SYSOUT Device... *
*****************************************************************
Z-DISPLAY-MESSAGE-TEXT.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79)
else
display MESSAGE-BUFFER
end-if
move all SPACES to MESSAGE-TEXT
exit.
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
Z-DISPLAY-TO-CONSOLE.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79) upon console
else
display MESSAGE-BUFFER upon console
end-if
exit.
*****************************************************************
* Display the file status bytes. This routine will display as *
* four digits. If the full two byte file status is numeric it *
* will display as 00nn. If the 1st byte is a numeric nine (9) *
* the second byte will be treated as a binary number and will *
* display as 9nnn. *
*****************************************************************
Z-DISPLAY-IO-STATUS.
if IO-STATUS not NUMERIC
or IO-STAT1 = '9'
move IO-STAT1 to IO-STATUS-04(1:1)
subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
move IO-STAT2 to TWO-BYTES-RIGHT
add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-TO-CONSOLE
perform Z-DISPLAY-MESSAGE-TEXT
else
move '0000' to IO-STATUS-04
move IO-STATUS to IO-STATUS-04(3:2)
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-TO-CONSOLE
perform Z-DISPLAY-MESSAGE-TEXT
end-if
exit.
*****************************************************************
Z-POST-COPYRIGHT.
move SIM-TITLE to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
move SIM-COPYRIGHT to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*****************************************************************
Z-THANK-YOU.
move SIM-THANKS-01 to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
move SIM-THANKS-02 to MESSAGE-BUFFER
perform Z-DISPLAY-MESSAGE-TEXT
exit.
*****************************************************************
* This program was generated by SimoZAPS *
* A product of SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2012-01-25 Generation Time: 01:23:44:46 *
*****************************************************************
The purpose of this program is to provide examples for accessing record sequential files with a fixed record length of eighty (80) bytes or line sequential files with a maximum record length of eighty (80) bytes.
This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers. In the world of programming there are many ways to solve a problem. This document and the links to other documents are intended to provide a choice of alternatives.
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software, documentation or training material 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, documentation or learning material for any purpose. It is provided "AS IS" without any expressed 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, documentation or training material.
This section includes links to documents with additional information that is beyond the scope and purpose of this document. The first sub-section requires an internet connection, the second sub-section references locally available documents.
Note: A SimoTime License is required for the items to be made available on a local server.
The following links will require an internet connect.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information.
This suite of programs and documentation is available for download. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
Take a moment to check out The SimoCARD Programs that are available for review and evaluation. This document provides addtional information about processing and converting various file formats that contain 80 byte records. These files may be referred to as CARD image files, this is a carry-over from the days of 80 column cards.
Take a moment to check out a list of the SimoMODS Programs that are available for review and evaluation.
Explore the User Guide for the SIMOZAPS Utility Program. This program has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.
Explore The ASCII and EBCDIC translation tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.
Explore The Micro Focus Web Site for more information about products and services available from Micro Focus.
The following links may be accessible without an internet connection.
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.
Check out The SimoTime Glossary for a list of terms and definitions used in the documents provided by SimoTime.
This document was created and is maintained by SimoTime Enterprises.
If you have any questions, suggestions, comments or feedback please call or send an e-mail to: helpdesk@simotime.com
We appreciate hearing from you.
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 |
| Sample use of Callable Routines for Accessing Eighty-Column Card Files |
| Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |