|
CBLVLRC1, File Compare Record-by-Record, ASCII/Text Files |
![]() |
| The SimoTime Home Page |
This document includes the source code for a program that compares two ASCII/Text files.
We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
The following source code (CBLVLRC1.cbl) is the COBOL program that compares two ASCII/Text Data Files on a record by record basis.
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLVLRC1.
AUTHOR. SIMOTIME TECHNOLOGIES.
*****************************************************************
* This program was generated by SimoZAPS *
* A product of SimoTime Technologies *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2020-06-25 Generation Time: 19:20:17:28 *
* *
* Record Record Key *
* Function Name Organization Format Max-Min Pos-Len *
* PRIMARY LS80UT01 ASCII/CRLF VARIABLE 00080 *
* *
* SECONDARY LS80UT02 ASCII/CRLF VARIABLE 00080 *
* *
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT LS80UT01-FILE ASSIGN TO LS80UT01
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS LS80UT01-STATUS.
SELECT LS80UT02-FILE ASSIGN TO LS80UT02
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS LS80UT02-STATUS.
*****************************************************************
DATA DIVISION.
FILE SECTION.
FD LS80UT01-FILE
DATA RECORD IS LS80UT01-REC
.
01 LS80UT01-REC.
05 LS80UT01-DATA-01 PIC X(00080).
FD LS80UT02-FILE
DATA RECORD IS LS80UT02-REC
.
01 LS80UT02-REC.
05 LS80UT02-DATA-01 PIC X(00080).
*****************************************************************
* This program was created using the SYSCOMP1.txt file as the *
* template for the data file comparison. The positions to be *
* compared are determined at compile time. *
* *
* For more information or questions please contact SimoTime *
* Technologies. The version control number is 20.00.00 *
* *
* 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 '* CBLVLRC1 '.
05 T2 pic X(34) value 'Compare LSEQ of 1-80 with key 1-12'.
05 T3 pic X(10) value ' v20.00.00'.
05 T4 pic X(24) value ' helpdesk@simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CBLVLRC1 '.
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 '* CBLVLRC1 '.
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 '* CBLVLRC1 '.
05 C2 pic X(32) value 'Please send all comments or sugg'.
05 C3 pic X(32) value 'estions to the helpdesk@simotime'.
05 C4 pic X(04) value '.com'.
01 LS80UT01-STATUS.
05 LS80UT01-STATUS-L pic X.
05 LS80UT01-STATUS-R pic X.
01 LS80UT01-EOF pic X value 'N'.
01 LS80UT01-OPEN-FLAG pic X value 'C'.
01 LS80UT01-LRECL pic 9(5) value 00080.
01 LS80UT02-STATUS.
05 LS80UT02-STATUS-L pic X.
05 LS80UT02-STATUS-R pic X.
01 LS80UT02-EOF pic X value 'N'.
01 LS80UT02-OPEN-FLAG pic X value 'C'.
01 LS80UT02-LRECL pic 9(5) value 00080.
*****************************************************************
* 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 '* CBLVLRC1 '.
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 KEY-ACTIVE pic X value 'Y'.
01 KEY-CONTROL-1.
05 K-PS-1 pic 9(5) value 00001.
05 K-LN-1 pic 9(5) value 00012.
01 KEY-CONTROL-2.
05 K-PS-2 pic 9(5) value 00001.
05 K-LN-2 pic 9(5) value 00012.
01 KEYRECID-ACTIVE pic X value 'N'.
01 KEYRECID-CONTROL-1.
05 E-PS-1 pic 9(5) value 00000.
05 E-LN-1 pic 9(5) value 00000.
01 KEYRECID-CONTROL-2.
05 E-PS-2 pic 9(5) value 00000.
05 E-LN-2 pic 9(5) value 00000.
01 READ-FLAGS.
05 READ-1 pic X value 'Y'.
05 READ-2 pic X value 'Y'.
01 DUMP-FLAGS.
05 DUMP-RPI pic X value 'Y'.
05 DUMP-ASC pic X value 'Y'.
05 DUMP-EBC pic X value 'N'.
05 DUMP-HEX pic X value 'N'.
05 DUMP-DET-GRP.
10 DUMP-DET pic X value 'Y'.
10 DUMP-DET-2 pic XX value 'NE'.
05 DUMP-SUM pic X value 'Y'.
05 DUMP-STATUS pic x VALUE 'Y'.
01 DUMP-PGM pic X(8) value 'DISABLED'.
01 DPOS-UT1 pic 9(5) value 1.
01 DLEN-UT1 pic 9(5) value 00000.
01 DPOS-UT2 pic 9(5) value 1.
01 DLEN-UT2 pic 9(5) value 00000.
01 FUNCTION-FLAGS.
05 FF-01 pic X value '1'.
05 FF-02 pic X value '0'.
05 FF-03 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 BYPASS-UT1-CTR pic 9(3) value 0.
01 BYPASS-UT2-CTR pic 9(3) value 0.
01 WORK-05 pic X(5) value SPACES.
01 WORK-LENGTH pic 9(5) value 0.
01 DELTA-MAX-ABEND.
05 FILLER pic X(10) value 'ABENDING, '.
05 FILLER pic X(24) value 'Not Equal count exceeds '.
05 FILLER pic X(22) value 'user-defined limit of '.
05 DELTA-MAXIMUM-X pic X(9) value '000000010'.
05 DELTA-MAXIMUM redefines DELTA-MAXIMUM-X pic 9(9).
05 FILLER pic X(19) value ', ABEND process is '.
05 DELTA-PROCESS pic X(4) value 'EOF '.
01 IFNECODE-GROUP.
05 IFNECODE-VALUE pic 9(4) value 0012.
01 YES-YES pic XX value 'YY'.
01 N-BYTE pic X value 'N'.
01 Y-BYTE pic X value 'Y'.
01 GROUP-DELIMITER pic X value 'Y'.
01 LEN-UT1 pic 9(5) value 128.
01 POS-UT1 pic 9(5) value 1.
01 LEN-UT2 pic 9(5) value 128.
01 POS-UT2 pic 9(5) value 1.
01 LEN-1 pic 9(5) value 128.
01 POS-1 pic 9(5) value 1.
01 LEN-2 pic 9(5) value 128.
01 POS-2 pic 9(5) value 1.
01 D-LEN pic 9(5) value 128.
01 D-POS pic 9(5) value 1.
01 W-LEN pic 9(5) value 0.
01 W-POS pic 9(5) value 10.
01 DUMP-RECL-MAX-S pic X value 'N'.
01 DUMP-RECL-MAX pic 9(5) value 00000.
01 CONTINUE-FLAG pic X value 'Y'.
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.
05 FILLER pic X(10) value '....:.....'.
01 DUMP-W10.
05 FILLER pic X(5) value '....:'.
05 W10-POS-NO pic X(5) value '00000'.
05 FILLER pic X(10) value '....:.....'.
01 DUMP-HEADER pic X(1024) value all '.'.
01 D-P1 pic 9(5) value 0.
01 WK-1 pic 9(5) value 0.
01 WK-2 pic 9(5) value 0.
01 RECORD-HEADER.
05 RECORD-ID pic X(8) value 'LS80UT01'.
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(2) value ') '.
05 REC-CTYPE pic X(10) value 'UNKNOWN '.
05 filler pic X(2) value SPACES.
05 REC-CMODE pic X(10) value 'UNKNOWN '.
01 SYSLOG-OUTPUT pic X(4) value 'OUT1'.
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 'Compare LSEQ of 1-80 with key 1-12'.
05 filler pic X(33)
value ' http://www.SimoTime.com'.
01 UT1-MISSING.
05 filler pic X(5) value 'This '.
05 filler pic X(31)
value 'record is MISSING from LS80UT01'.
05 filler pic X(7) value ' - the '.
05 filler pic X(29)
value 'record is PRESENT in LS80UT02'.
01 UT2-MISSING.
05 filler pic X(5) value 'This '.
05 filler pic X(29)
value 'record is PRESENT in LS80UT01'.
05 filler pic X(7) value ' - the '.
05 filler pic X(31)
value 'record is MISSING from LS80UT02'.
01 LS80UT01-TOTAL.
05 LS80UT01-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Record count for LS80UT01'.
01 LS80UT02-TOTAL.
05 LS80UT02-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Record count for LS80UT02'.
01 LS80UT01-OMIT.
05 LS80UT01-OMT pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Bypass count for LS80UT01'.
01 LS80UT02-OMIT.
05 LS80UT02-OMT pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Bypass count for LS80UT02'.
01 COMPARE-NE-TOTAL.
05 COMPARE-NE pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 COMPARE-TAG.
10 filler pic X(25) value 'NOT Equal count for compa'.
10 filler pic X(25) value 're of existing records '.
01 COMPACT-NE-TOTAL.
05 COMPACT-NE pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 COMPACT-TAG.
10 filler pic X(25) value 'NOT Equal count for compa'.
10 filler pic X(25) value 'ct of existing records '.
01 COMPARE-EQ-TOTAL.
05 COMPARE-EQ pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Number of matching record'.
05 filler pic X(25) value ' pairs for Compare Task '.
01 COMPACT-EQ-TOTAL.
05 COMPACT-EQ pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(25) value 'Number of matching record'.
05 filler pic X(25) value ' pairs for Compact Task '.
01 FORMAT-TYPE pic X value 'B'.
COPY PASSHEX4.
COPY PASSLOGS.
COPY PAENVARS.
*****************************************************************
PROCEDURE DIVISION.
perform JOB-STARTING
perform
until COMPARE-STATUS = 'QT'
or LS80UT01-STATUS not = '00'
or LS80UT02-STATUS not = '00'
if READ-1 = 'Y'
perform LS80UT01-READ
end-if
if READ-2 = 'Y'
perform LS80UT02-READ
end-if
if LS80UT01-STATUS = '00'
and LS80UT02-STATUS = '00'
move 'EQ' to COMPARE-STATUS
move 'N' to DUMP-STATUS
move all '-' to DELTA-LINE-1
move all '-' to DELTA-LINE-2
if KEY-ACTIVE = 'Y'
and COMPARE-STATUS = FLAG-EQ
perform COMPARE-KEYS
end-if
if COMPARE-STATUS = FLAG-EQ
perform COMPARE-RECORDS
end-if
if DUMP-STATUS = 'Y'
if GROUP-DELIMITER = 'Y'
perform DUMP-ASTERISK-ONE
end-if
add DLEN-UT1 to ZERO giving D-LEN
if DUMP-RPI = 'Y'
perform DUMP-POSITION-INDICATOR
end-if
perform DUMP-PRIMARY-RECORD
perform DUMP-POSITION-DIFFERENCES-1
perform DUMP-SECONDARY-RECORD
perform DUMP-POSITION-DIFFERENCES-2
add DLEN-UT2 to ZERO giving D-LEN
move 'N' to DUMP-STATUS
end-if
if COMPARE-STATUS = FLAG-NE
add 1 to COMPARE-NE
end-if
else
move 'NE' to COMPARE-STATUS
end-if
if COMPARE-STATUS = 'EQ'
add 1 to COMPARE-EQ
end-if
if DELTA-PROCESS = 'QUIT'
and COMPARE-NE > DELTA-MAXIMUM
perform JOB-FINISHED
move DELTA-MAX-ABEND to MESSAGE-TEXT
perform Z-ABEND-PROGRAM
end-if
if DELTA-PROCESS = 'EOF '
and COMPARE-NE > DELTA-MAXIMUM
move DELTA-MAX-ABEND to MESSAGE-TEXT
perform Z-DISPLAY-TO-CONSOLE
move 'QT' to COMPARE-STATUS
end-if
end-perform
perform JOB-FINISHED
GOBACK.
*****************************************************************
COMPARE-RECORDS.
* Physical Comparison with NE Output of DISABLED
move 'COMPARISON' to REC-CTYPE
move 'PHYSICAL ' to REC-CMODE
if LS80UT01-REC(00001:00080) not = LS80UT02-REC(00001:00080)
move FLAG-NE to COMPARE-STATUS
add 1 to COMPARE-NE
move 'Y' to DUMP-STATUS
end-if
if DUMP-DET = 'Y'
add 00001 to ZERO giving POS-UT1
add 00001 to ZERO giving POS-UT2
add 00080 to ZERO giving LEN-UT1
add 00080 to ZERO giving LEN-UT2
add 00080 to ZERO giving PASSHEX4-LENGTH
perform CALC-DELTA-FOR-NE-EQ-NO
end-if
exit.
*****************************************************************
COMPARE-KEYS.
move YES-YES to READ-FLAGS
if LS80UT01-REC(K-PS-1:K-LN-1)
< LS80UT02-REC(K-PS-2:K-LN-2)
move N-BYTE to READ-2
move FLAG-NE to COMPARE-STATUS
if COMPARE-NE < DELTA-MAXIMUM
and DUMP-DET-GRP = 'YNE'
perform DUMP-SECONDARY-MISSING
end-if
end-if
if LS80UT01-REC(K-PS-1:K-LN-1)
> LS80UT02-REC(K-PS-2:K-LN-2)
move N-BYTE to READ-1
move FLAG-NE to COMPARE-STATUS
if COMPARE-NE < DELTA-MAXIMUM
and DUMP-DET-GRP = 'YNE'
perform DUMP-PRIMARY-MISSING
end-if
end-if
exit.
*****************************************************************
CALC-DELTA-FOR-NE-EQ-NO.
add POS-UT1 to ZERO giving PTR-1
add POS-UT2 to ZERO giving PTR-2
perform until PTR-1 > POS-UT1 + LEN-UT1 - 1
or PTR-2 > POS-UT2 + LEN-UT2 - 1
if LS80UT01-REC(PTR-1:1)
= LS80UT02-REC(PTR-2:1)
move '=' to DELTA-LINE-1(PTR-1:1)
move '=' to DELTA-LINE-2(PTR-2:1)
else
move '#' to DELTA-LINE-1(PTR-1:1)
move '#' to DELTA-LINE-2(PTR-2:1)
end-if
add 1 to PTR-1
add 1 to PTR-2
end-perform
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 Record Position Indicator
* if DUMP-RPI = 'Y'
* perform DUMP-POSITION-INDICATOR
* end-if
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-ASTERISK-ONE.
move SPACES to SIMOLOGS-MESSAGE
move '*' to SIMOLOGS-MESSAGE(1:1)
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
exit.
*****************************************************************
DUMP-POSITION-INDICATOR.
add 10 to ZERO giving POS-NO
subtract 1 from D-POS giving WK-1
divide 10 into WK-1 giving WK-1 remainder WK-2
add 1 to WK-2
perform varying D-P1 from 1 by 10 until D-P1 > 1020
move DUMP-H10 to DUMP-W10
inspect W10-POS-NO replacing leading ZEROES by '.'
move DUMP-W10(WK-2:10) to DUMP-HEADER(D-P1:10)
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.
if GROUP-DELIMITER = 'Y'
move SPACES to SIMOLOGS-MESSAGE
move all '*' to SIMOLOGS-MESSAGE(1:79)
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
add DPOS-UT1 to ZERO giving RECORD-POS
add DLEN-UT1 to ZERO giving RECORD-LEN
add DPOS-UT1 to ZERO giving D-POS
add DLEN-UT1 to ZERO giving D-LEN
* Present in LS80UT02, missing from LS80UT01...
move UT1-MISSING to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
add DLEN-UT2 to ZERO giving D-LEN
if DUMP-RPI = 'Y'
perform DUMP-POSITION-INDICATOR
end-if
perform DUMP-SECONDARY-RECORD
move SPACES to DELTA-LINE-2
move all '#' to DELTA-LINE-2(1:DLEN-UT2)
perform DUMP-POSITION-DIFFERENCES-2
exit.
*****************************************************************
DUMP-PRIMARY-RECORD.
add DPOS-UT1 to ZERO giving RECORD-POS
add DLEN-UT1 to ZERO giving RECORD-LEN
add DPOS-UT1 to ZERO giving D-POS
add DLEN-UT1 to ZERO giving D-LEN
move 'LS80UT01..' to RECORD-ID
add LS80UT01-RDR to ZERO giving REC-NUMBER
move LS80UT01-REC(D-POS:D-LEN) to PASSHEX4-SOURCE
call 'SIMOHEX4' using PASSHEX4-PASS-AREA
perform DUMP-TO-LOG
exit.
*****************************************************************
DUMP-SECONDARY-MISSING.
if GROUP-DELIMITER = 'Y'
move SPACES to SIMOLOGS-MESSAGE
move all '*' to SIMOLOGS-MESSAGE(1:79)
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
add DPOS-UT2 to ZERO giving RECORD-POS
add DLEN-UT2 to ZERO giving RECORD-LEN
add DPOS-UT2 to ZERO giving D-POS
add DLEN-UT2 to ZERO giving D-LEN
* Present in LS80UT01, missing from LS80UT02...
move UT2-MISSING to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
add DLEN-UT1 to ZERO giving D-LEN
if DUMP-RPI = 'Y'
perform DUMP-POSITION-INDICATOR
end-if
perform DUMP-PRIMARY-RECORD
move SPACES to DELTA-LINE-1
move all '#' to DELTA-LINE-1(1:DLEN-UT1)
perform DUMP-POSITION-DIFFERENCES-1
exit.
*****************************************************************
DUMP-SECONDARY-RECORD.
move SPACES to PASSHEX4-SOURCE
add DPOS-UT2 to ZERO giving RECORD-POS
add DLEN-UT2 to ZERO giving RECORD-LEN
add DPOS-UT2 to ZERO giving D-POS
add DLEN-UT2 to ZERO giving D-LEN
move 'LS80UT02..' to RECORD-ID
add LS80UT02-RDR to ZERO giving REC-NUMBER
move LS80UT02-REC(D-POS:D-LEN) to PASSHEX4-SOURCE
call 'SIMOHEX4' using PASSHEX4-PASS-AREA
perform DUMP-TO-LOG
exit.
*****************************************************************
DUMP-POSITION-DIFFERENCES-1.
if DUMP-RECL-MAX-S = 'Y'
and DUMP-RECL-MAX < LS80UT01-LRECL
add DUMP-RECL-MAX to ZERO giving WORK-LENGTH
else
add LS80UT01-LRECL to ZERO giving WORK-LENGTH
end-if
move DELTA-LINE-1(1:DLEN-UT1) to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
exit.
*****************************************************************
DUMP-POSITION-DIFFERENCES-2.
if DUMP-RECL-MAX-S = 'Y'
and DUMP-RECL-MAX < LS80UT02-LRECL
add DUMP-RECL-MAX to ZERO giving WORK-LENGTH
else
add LS80UT02-LRECL to ZERO giving WORK-LENGTH
end-if
move DELTA-LINE-2(1:DLEN-UT2) to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
exit.
*****************************************************************
JOB-FINISHED.
if LS80UT01-STATUS = '00'
and DELTA-PROCESS = 'EOF '
perform until LS80UT01-STATUS not = '00'
perform LS80UT01-READ
add 1 to COMPARE-NE
end-perform
end-if
if LS80UT02-STATUS = '00'
and DELTA-PROCESS = 'EOF '
perform until LS80UT02-STATUS not = '00'
perform LS80UT02-READ
add 1 to COMPARE-NE
end-perform
end-if
perform LS80UT02-CLOSE
perform LS80UT01-CLOSE
if GROUP-DELIMITER = 'Y'
move SPACES to SIMOLOGS-MESSAGE
move all '*' to SIMOLOGS-MESSAGE(1:79)
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
move 'Conclude' to INFO-ID
move INFO-SHORT to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move 'Finished' to INFO-ID
move LS80UT01-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
if LS80UT01-OMT > ZERO
move LS80UT01-OMIT to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
move LS80UT02-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
if LS80UT02-OMT > ZERO
move LS80UT02-OMIT to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
if LS80UT01-RDR not = LS80UT02-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 FF-01 = '1'
if COMPARE-NE = 0
inspect COMPARE-TAG
replacing first ' of existing records '
by ' is ZERO '
else
move 'ABENDING' to INFO-ID
end-if
move COMPARE-NE-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move COMPARE-EQ-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
if FF-02 = '1'
if COMPACT-NE = 0
inspect COMPACT-TAG
replacing first ' of existing records '
by ' is ZERO '
else
move 'ABENDING' to INFO-ID
end-if
move COMPACT-NE-TOTAL to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
end-if
if LS80UT01-EOF not = 'Y'
or LS80UT02-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 LS80UT01-RDR not = LS80UT02-RDR
add IFNECODE-VALUE to ZERO giving RETURN-CODE
end-if
exit.
*****************************************************************
JOB-STARTING.
perform Z-POST-COPYRIGHT
perform Z-DETERMINE-ENVIRONMENT
perform LS80UT01-OPEN
perform LS80UT02-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 K-PS-1 > 0
and K-PS-2 > 0
and K-LN-1 > 0
and K-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:79)
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
move all '*' to SIMOLOGS-MESSAGE(1:79)
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
move INFO-STATEMENT to SIMOLOGS-MESSAGE
call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
exit.
*****************************************************************
* I/O Routines for the Primary File... *
*****************************************************************
LS80UT01-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close LS80UT01-FILE
if LS80UT01-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 LS80UT01' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move LS80UT01-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
LS80UT01-READ.
read LS80UT01-FILE
if LS80UT01-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
add 1 to LS80UT01-RDR
else
if LS80UT01-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 LS80UT01-EOF
else
move 'READ Failure with LS80UT01' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move LS80UT01-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
LS80UT01-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input LS80UT01-FILE
if LS80UT01-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to LS80UT01-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with LS80UT01' to MESSAGE-TEXT
perform Z-DISPLAY-TO-CONSOLE
perform Z-DISPLAY-MESSAGE-TEXT
move LS80UT01-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* I/O Routines for the Secondary File... *
*****************************************************************
LS80UT02-READ.
read LS80UT02-FILE
if LS80UT02-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
add 1 to LS80UT02-RDR
else
if LS80UT02-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 LS80UT02-EOF
else
move 'READ Failure with LS80UT02' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move LS80UT02-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
LS80UT02-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input LS80UT02-FILE
if LS80UT02-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to LS80UT02-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with LS80UT02' to MESSAGE-TEXT
perform Z-DISPLAY-TO-CONSOLE
perform Z-DISPLAY-MESSAGE-TEXT
move LS80UT02-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
LS80UT02-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close LS80UT02-FILE
if LS80UT02-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'C' to LS80UT02-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with LS80UT02' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move LS80UT02-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 Technologies *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2020-06-25 Generation Time: 19:20:17:30 *
*****************************************************************
The following are the COBOL copy files used by the program.
The following (PASSHEX4.cpy) is the source code for the copy file that defines the data structure of the pass area used to call SIMOHEX4.
*****************************************************************
* Data Structure or Pass Area used for calling SIMOHEX4. *
*****************************************************************
* Copyright (C) 1987-2019 SimoTime Technologies *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Technologies *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* PASSHEX4-REQUEST - This must contain the following value. *
* DUMP, Dump Buffer in Hexadecimal format. *
* PASSHEX4-RESULT - Zero indicates a successful completion. *
* Non-Zero indicates a failure in processing *
* the request. *
* PASSHEX4-LENGTH - Specifies the length of the text strings *
* for the PASSHEX4-SOURCE. If the length
* exceeds 1024 then it will be reset to 128. *
* PASSHEX4-SOURCE - This is the input field for the SimoHEX4 *
* routine. This field will not be modified. *
* The contents will be translated into a *
* haxadecimal format and the results of the *
* translation will be placed in the *
* following fields. *
* PASSHEX4-ASCII - This is a translation of possible ASCII. *
* PASSHEX4-UPPER - This is leftmost (or high order) nibble. *
* PASSHEX4-LOWER - This is rightmost (or low order) nibble. *
* PASSHEX4-EBCDIC - This is a translation of possible EBCDIC. *
*****************************************************************
01 PASSHEX4-PASS-AREA.
* The following are provided by the calling program,
05 PASSHEX4-REQUEST PIC X(4).
* The PASSHEX4-RESULT may be modified by SimoHEX4...
05 PASSHEX4-RESULT PIC 9(4).
05 PASSHEX4-LENGTH PIC 9(5).
05 PASSHEX4-SOURCE PIC X(1024).
* The following are modified by SimoHEX4...
05 PASSHEX4-DUMP-INFO.
10 PASSHEX4-ASCII PIC X(1024).
10 PASSHEX4-UPPER PIC X(1024).
10 PASSHEX4-LOWER PIC X(1024).
10 PASSHEX4-EBCDIC PIC X(1024).
*** PASSHEX4 - End-of-Copy File - - - - - - - - - - - PASSHEX4 *
*****************************************************************
*
The following (PASSLOGS.cpy) is the source code for the copy file that defines the data structure of the pass area used to call SIMOLOGS.
*****************************************************************
* PASSLOGS is a COBOL Copy File *
* Data Structure or Pass Area used for calling SIMOLOGS. *
* Copyright (C) 1987-2019 SimoTime Technologies *
* All Rights Reserved *
*****************************************************************
* Provided by SimoTime Technologies *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* SIMOLOGS-REQUEST Type of request, must be one of the *
* following values. *
* BOTH - Display message on the console, *
* Write message to the SYSLOG file. *
* FILE - Write message to the SYSLOG file. *
* NOTE - Display message on the console, *
* Write message to the SYSLOG file. *
* SHOW - Display message on the console. *
* *
* OPR1 - Display message to Console Operator. *
* OPR2 - Display message to Console Operator, *
* write message to the SYSLOG file. *
* OUT1 - Display message to SYSOUT. *
* OUT2 - Display message to SYSOUT, *
* write message to SYSLOG file. *
* LOG1 - Write message to the SYSLOG file. *
* SIMOLOGS-STATUS This is an indicator as to the success *
* or failure of the request. A value of *
* zero (0000) indicates the routine was *
* successful. A non-zero value indicates *
* a failure. *
* SIMOLOGS-MESSAGE Contains the message text. *
*****************************************************************
01 SIMOLOGS-PASS-AREA.
05 SIMOLOGS-REQUEST pic X(4).
05 SIMOLOGS-STATUS pic 9999.
05 SIMOLOGS-MESSAGE pic X(1024).
*** PASSLOGS - End-of-Copy File - - - - - - - - - - - PASSLOGS *
*****************************************************************
*
This document includes the source code for a program that compares two ASCII/Text files. This document may be used to assist 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 documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the Contact or Feedback section of this document.
Software Agreement and Disclaimer
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. 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 Technologies.
SimoTime Technologies 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 Technologies 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 are 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 may be to the current server or to the Internet.
Explore How to FTP (using BINARY mode) a File with Variable Length Records from a Mainframe System to a Windows System and then convert the Mainframe format to a Micro Focus format. The mainline program will call the SIMOVREC and SIMOBSIO modules that are available from SimoTime in a separate package.
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 that are used to interpret the results of accessing VSAM data sets and/or QSAM files.
Explore the File Formats and various Numeric Formats being used in a multi-system complex consisting of Mainframe (z/OS), Linux, UNIX or Windows systems.
The following links will require an internet connect.
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.
Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.
| 1. | Send an e-mail to our helpdesk. |
| 1.1. | helpdesk@simotime.com. |
| 2. | Our telephone numbers are as follows. |
| 2.1. | 1 415 763-9430 office-helpdesk |
| 2.2. | 1 415 827-7045 mobile |
We appreciate hearing from you.
SimoTime Technologies was founded in 1987 and 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. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.
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. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.
Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.
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 |
| COBOL program, Compare Two ASCII/Text Files |
| Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |