Data File Repro and Compare
 IDCAMS and Micro Focus COBOL
http://www.simotime.com
When technology complements business    Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 10.03.20 
  Introduction
  JCL Member for OS/390 or Mainframe Express
 
  JCL Member, Create a Sequential File using IEBGENER
  JCL Member, Delete/Define a VSAM Cluster using IDCAMS
  JCL Member, Populate a VSAM Cluster using IDCAMS with REPRO
  JCL Member, Copy a KSDS to Sequential using IDCAMS with REPRO
  JCL Member, Compare two Data Files using a COBOL Program
  A COBOL Program for Data File Compare
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

This example will use IEBGENER to create a sequential file. This file will be used by IDCAMS to populate a VSAM, KSDS. The KSDS will then be copied to a sequential file with variable length records. The first file created will then be compared to the last file created using a COBOL program. This example includes JCL members and a COBOL program. In the world of programming there are many ways to solve a problem. This suite of programs is provided as one of the many possible solutions for data file format conversion and comparison.

The files used in this suite of sample programs use fixed length records of eighty-bytes or variable length records with a maximum record length of eighty bytes. When the files are compared and if a difference is found the COBOL compare program will call SIMOHEX4.CBL and SIMOLOGS.CBL. These programs and their associated copy files are part of the SIMOMODS package. Refer to the Downloads and Links to Similar Pages section of this document for additional information.

JCL Members for ZOS, Mainframe Express or Server
(Next) (Previous) (Table-of-Contents)

The following JCL Members provide examples of how to create a sequential file, delete and define a VSAM Cluster, populate a VSAM Data Set and compare two files or data sets.

JCL Member, Create a Sequential File using IEBGENER
(Next) (Previous) (Table-of-Contents)

The following is the mainframe JCL (DATFMTJ1.JCL) that is required to run as a job that creates a sequenial file.

//DATFMTJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2010 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Create a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* The first job step (RSEQDELT) will delete any previously created
//* file. The second job step (RSEQCRT1) will create a new file.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//*                      ************
//*                      * DATFMTJ1 *
//*                      ********jcl*
//*                           *
//*                           *
//*                      ************     ************
//*                      * IEFBR14  ******* DATFMTD1 *
//*                      ********utl*     ***delete***
//*                           *
//*                           *
//*     ************     ************     ************
//*     *  SYSIN   ******* IEBGENER ******* DATFMTD1 *
//*     ********jcl*     ********utl*     *******rseq*
//*                           *
//*                           *
//*                      ************
//*                      *   EOJ    *
//*                      ************
//*
//* *******************************************************************
//* Step   1 of 2  Delete any previously created file...
//*
//RSEQDELT EXEC PGM=IEFBR14
//DATFMTD1 DD  DSN=SIMOTIME.DATA.DATFMTD1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step   2 of 2  Create and populate a new RSEQ file...
//*
//RSEQCRT1 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
//SYSUT1   DD  *
0001Text string for record one
0002Record 2
0003A text string stored in record three
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.DATFMTD1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//

JCL Member, Delete/Define a VSAM Cluster using IDCAMS
(Next) (Previous) (Table-of-Contents)

The following is the mainframe JCL (DATFMTJ2.JCL) that is required to delete and define a VSAM Cluster.

//DATFMTJ2 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2010 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Delete/Define a VSAM Cluster, KSDS data set using IDCAMS.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* This job will create a VSAM, KSDS data set. The key is four
//* characters starting at the first position in the record.
//* The record length is 80 characters.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step   1   This is a single step job.
//*
//KSDSMAKE EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
 DELETE    SIMOTIME.DATA.DATFMTD2   -
           FILE (DATFMTD2)          -
           PURGE                    -
           ERASE                    -
           CLUSTER
 SET       MAXCC = 0
 DEFINE    CLUSTER  (NAME(SIMOTIME.DATA.DATFMTD2)             -
                    TRACKS(45,15)                             -
                    INDEXED)                                  -
           DATA     (NAME(SIMOTIME.DATA.DATFMTD2.DAT)         -
                    KEYS(4,0)                                -
                    RECORDSIZE(4,80)                          -
                    FREESPACE(10,15)                          -
                    CISZ(8192))                               -
           INDEX    (NAME(SIMOTIME.DATA.DATFMTD2.IDX))
/*
//*

JCL Member, Populate a VSAM Cluster using IDCAMS with REPRO
(Next) (Previous) (Table-of-Contents)

The following is the mainframe JCL (DATFMTJ3.JCL) that is required to populate an empty VSAM cluster with data from a sequential file. This example uses IDCAMS with the REPRO function.

//DATFMTJ3 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   THIS PROGRAM IS PROVIDED BY:                    *
//*                    SIMOTIME ENTERPRISES, LLC                      *
//*           (C) COPYRIGHT 1987-2010 ALL RIGHTS RESERVED             *
//*             WEB SITE URL:   HTTP://WWW.SIMOTIME.COM               *
//*                   E-MAIL:   HELPDESK@SIMOTIME.COM                 *
//* *******************************************************************
//*
//* TEXT   - COPY (or REPRO) from an RSEQ to a KSDS
//* AUTHOR - SIMOTIME ENTERPRISES
//* DATE   - JANUARY 01, 1989
//*
//* *******************************************************************
//* Step 1 of 1,  Copy data into an existing VSAM Cluster...
//*
//RSEQKSDS EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=A
//DATFMTD1 DD  DSN=SIMOTIME.DATA.DATFMTD1,DISP=(SHR)
//DATFMTD2 DD  DSN=SIMOTIME.DATA.DATFMTD2,DISP=(MOD,KEEP,KEEP)
//SYSIN DD *
 REPRO -
  INFILE(DATFMTD1) -
  OUTFILE(DATFMTD2)
/*

JCL Member, Copy a KSDS to Sequential using IDCAMS with REPRO
(Next) (Previous) (Table-of-Contents)

The following is the mainframe JCL (DATFMTJ4.JCL) that is required to copy the records from a VSAM, KSDS to a sequential file with variable length records. This example uses IDCAMS with the REPRO function.

//DATFMTJ4 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   THIS PROGRAM IS PROVIDED BY:                    *
//*                    SIMOTIME ENTERPRISES, LLC                      *
//*           (C) COPYRIGHT 1987-2010 ALL RIGHTS RESERVED             *
//*             WEB SITE URL:   HTTP://WWW.SIMOTIME.COM               *
//*                   E-MAIL:   HELPDESK@SIMOTIME.COM                 *
//* *******************************************************************
//*
//* TEXT   - COPY (OR REPRO) A KSDS TO A SEQUENTIAL FILE
//* AUTHOR - SIMOTIME ENTERPRISES
//* DATE   - JANUARY 01, 1989
//*
//* *******************************************************************
//* Step   1 of 2  Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//DATFMTD3 DD  DSN=SIMOTIME.DATA.DATFMTD3,DISP=(MOD,DELETE,DELETE),
//             SPACE=(TRK,(10,1),RLSE),
//             DCB=(RECFM=V,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step   2 of 2  Create and populate a new QSAM file...
//*
//KSDTOSEQ EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=A
//DATFMTD2 DD  DSN=SIMOTIME.DATA.DATFMTD2,DISP=(SHR)
//DATFMTD3 DD  DSN=SIMOTIME.DATA.DATFMTD3,DISP=(NEW,CATLG,DELETE),
//             SPACE=(TRK,(10,1),RLSE),
//             DCB=(RECFM=V,LRECL=84,DSORG=PS)
//SYSIN DD *
 REPRO -
  INFILE(DATFMTD2) -
  OUTFILE(DATFMTD3)
/*

JCL Member, Compare two Data Files using a COBOL Program
(Next) (Previous) (Table-of-Contents)

The following is the mainframe JCL (DATFMTJ5.JCL) that is required to execute a COBOL program that compares the contents of two files.

//DATFMTJ5 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   THIS PROGRAM IS PROVIDED BY:                    *
//*                    SIMOTIME ENTERPRISES, LLC                      *
//*           (C) COPYRIGHT 1987-2010 ALL RIGHTS RESERVED             *
//*             WEB SITE URL:   HTTP://WWW.SIMOTIME.COM               *
//*                   E-MAIL:   HELPDESK@SIMOTIME.COM                 *
//* *******************************************************************
//*
//* TEXT   - Compare two Sequential Files
//* AUTHOR - SIMOTIME ENTERPRISES
//* DATE   - JANUARY 01, 1989
//*
//* *******************************************************************
//* Step 1 of 1, Compare the files...
//*
//*
//DFCOMPS1 EXEC PGM=DATFMTC1
//SYSOUT   DD  SYSOUT=*
//DATFMTD1 DD  DSN=SIMOTIME.DATA.DATFMTD1,DISP=(SHR)
//DATFMTD3 DD  DSN=SIMOTIME.DATA.DATFMTD3,DISP=(SHR)
//*

A COBOL Program for Data File Compare
(Next) (Previous) (Table-of-Contents)

The following (DATFMTC1.CBL) is a sample of the COBOL demonstration program that will compare the contents of two data files. This COBOL program was generated by the SimoZaps utility program from SimoTime Enterprises. It will compare the contents of a record sequential file with fixed length records to the contents of a record sequential file with variable length records.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    DATFMTC1.
       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: 2008-11-14  Generation Time: 00:03:38:79    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  INPUT     DATFMTD1 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *  OUTPUT    DATFMTD3 SEQUENTIAL    VARIABLE   00080            *
      *                                              00001            *
      *                                                               *
      *                Translation Mode is UNKNOWN                    *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT DATFMTD1-FILE  ASSIGN TO       DATFMTD1
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS DATFMTD1-STATUS.
           SELECT DATFMTD3-FILE  ASSIGN TO       DATFMTD3
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS DATFMTD3-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  DATFMTD1-FILE
           DATA RECORD    IS DATFMTD1-REC
           .
       01  DATFMTD1-REC.
           05  DATFMTD1-DATA-01 PIC X(00080).

       FD  DATFMTD3-FILE
           DATA RECORD    IS DATFMTD3-REC
           RECORDING MODE IS V
           RECORD VARYING FROM 00001 TO 00080
           DEPENDING ON DATFMTD3-LRECL
           .
       01  DATFMTD3-REC.
           05  DATFMTD3-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     *
      * Enterprises.                                                  *
      *                                                               *
      *        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 '* DATFMTC1 '.
           05  T2 pic X(34) value 'Compare RSEQ Fix 80 & Var 1 to 80 '.
           05  T3 pic X(10) value ' v08.08.05'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* DATFMTC1 '.
           05  C2 pic X(20) value 'Created by SimoZAPS,'.
           05  C3 pic X(20) value '  a utility package '.
           05  C4 pic X(28) value 'of SimoTime Enterprises, LLC'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* DATFMTC1 '.
           05  C2 pic X(32) value 'This File Compare program was ge'.
           05  C3 pic X(32) value 'nerated by SimoTime Enterprises,'.
           05  C4 pic X(04) value ' LLC'.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* DATFMTC1 '.
           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  DATFMTD1-STATUS.
           05  DATFMTD1-STATUS-L     pic X.
           05  DATFMTD1-STATUS-R     pic X.
       01  DATFMTD1-EOF              pic X       value 'N'.
       01  DATFMTD1-OPEN-FLAG        pic X       value 'C'.

       01  DATFMTD3-STATUS.
           05  DATFMTD3-STATUS-L     pic X.
           05  DATFMTD3-STATUS-R     pic X.
       01  DATFMTD3-EOF              pic X       value 'N'.
       01  DATFMTD3-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 '* DATFMTC1 '.
           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  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      pic X(1024) value all '-'.
       01  PTR-1           pic 9(5)    value 0.
       01  PTR-2           pic 9(5)    value 0.
       01  IDX-2           pic 9(5)    value 0.
       01  DELTA-MAXIMUM-X pic X(5)    value '00025'.
       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  DATFMTD1-LRECL    pic 9(5)    value 00080.
       01  LEN-1           pic 9(5)    value 128.
       01  POS-1           pic 9(5)    value 1.
       01  DATFMTD3-LRECL    pic 9(5)    value 00080.
       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  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.
       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 'DATFMTD1'.
           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  INFO-STATEMENT.
           05  INFO-SHORT.
               10  INFO-ID pic X(8)    value 'Starting'.
               10  filler  pic X(31)
                   value   ' - Data File Content Comparison'.
           05  filler      pic X(40)
               value ', generated by SimoTime Enterprises, LLC'.

       01  DATFMTD1-TOTAL.
           05  DATFMTD1-RDR  pic 9(9)  value 0.
           05  filler      pic X(3)  value ' - '.
           05  filler      pic X(25) value 'Record count for DATFMTD1'.
       01  DATFMTD3-TOTAL.
           05  DATFMTD3-RDR  pic 9(9)  value 0.
           05  filler      pic X(3)  value ' - '.
           05  filler      pic X(25) value 'Record count for DATFMTD3'.
       01  COMPARE-NE-TOTAL.
           05  COMPARE-NE  pic 9(9)  value 0.
           05  filler      pic X(3)  value ' - '.
           05  filler      pic X(25) value 'Summary for unequal items'.

       01  FORMAT-TYPE     pic X     value 'B'.

       COPY PASSHEX4.
       COPY PASSLOGS.

      *****************************************************************
       PROCEDURE DIVISION.
           perform JOB-STARTING

           perform
               until COMPARE-STATUS = 'QT'
               or    DATFMTD1-STATUS not = '00'
               or    DATFMTD3-STATUS not = '00'
               if  READ-1 = 'Y'
                   perform DATFMTD1-READ
               end-if
               if  READ-2 = 'Y'
                   perform DATFMTD3-READ
               end-if
               if  DATFMTD1-STATUS = '00'
               and DATFMTD3-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
           end-perform

           perform JOB-FINISHED

           GOBACK.

      *****************************************************************
       COMPARE-RECORDS.
      *>   Compare...
           if DATFMTD1-REC(00001:00080) not = DATFMTD3-REC(00001:00080)
              move FLAG-NE to COMPARE-STATUS
              if  COMPARE-NE < DELTA-MAXIMUM
                  add 00001 to ZERO  giving POS-1
                  add 00001 to ZERO  giving POS-2
                  add 00080 to ZERO  giving LEN-1
                  add 00080 to ZERO  giving LEN-2
                  add 00080 to ZERO  giving PASSHEX4-LENGTH
                  perform DUMP-PRIMARY-RECORD
                  perform DUMP-SECONDARY-RECORD
                  perform DUMP-POSITION-DIFFERENCE
              end-if
           end-if
           exit.

      *****************************************************************
       COMPARE-KEYS.
           move YES-YES to READ-FLAGS
           if  DATFMTD1-REC(PS-1:LN-1)
            <  DATFMTD3-REC(PS-2:LN-2)
               move N-BYTE to READ-2
               move FLAG-NE to COMPARE-STATUS
               perform DUMP-PRIMARY-MISSING
           end-if
           if  DATFMTD1-REC(PS-1:LN-1)
            >  DATFMTD3-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 'DATFMTD1 Record is missing from DATFMTD3 file'
             to SIMOLOGS-MESSAGE
           call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
           move SPACES to PASSHEX4-SOURCE
           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 'DATFMTD1..' to RECORD-ID
           move DATFMTD1-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.
               add POS-1 to ZERO giving RECORD-POS
               add LEN-1 to ZERO giving RECORD-LEN
               add POS-1 to ZERO giving D-POS
               add LEN-1 to ZERO giving D-LEN
               move 'DATFMTD1..' to RECORD-ID
               add DATFMTD1-RDR to ZERO giving REC-NUMBER
               move DATFMTD1-REC(D-POS:D-LEN) to PASSHEX4-SOURCE
               call 'SIMOHEX4' using PASSHEX4-PASS-AREA
               perform DUMP-TO-LOG
           exit.

      *****************************************************************
       DUMP-SECONDARY-MISSING.
           move 'DATFMTD3 Record is missing from DATFMTD1 file'
             to SIMOLOGS-MESSAGE
           call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
           move SPACES to PASSHEX4-SOURCE
           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 'DATFMTD3..' to RECORD-ID
           move DATFMTD3-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
               add POS-2 to ZERO giving RECORD-POS
               add LEN-2 to ZERO giving RECORD-LEN
               add POS-2 to ZERO giving D-POS
               add LEN-2 to ZERO giving D-LEN
               move 'DATFMTD3..' to RECORD-ID
               add DATFMTD3-RDR to ZERO giving REC-NUMBER
               move DATFMTD3-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
               add POS-1 to ZERO giving PTR-1
               add POS-2 to ZERO giving PTR-2
               add 1 to ZERO giving IDX-2
               perform until IDX-2 > 1024
                          or IDX-2 > D-LEN
                   if  DATFMTD1-REC(PTR-1:1)
                    =  DATFMTD3-REC(PTR-2:1)
                       move '=' to DELTA-LINE(IDX-2:1)
                   else
                       move '#' to DELTA-LINE(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
           end-if
           move DELTA-LINE(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.
           perform DATFMTD3-CLOSE
           perform DATFMTD1-CLOSE

           move 'Summary ' to INFO-ID
           move INFO-SHORT to SIMOLOGS-MESSAGE
           call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
           move 'Finished' to INFO-ID

           move DATFMTD1-TOTAL to SIMOLOGS-MESSAGE
           call 'SIMOLOGS' using SIMOLOGS-PASS-AREA

           move DATFMTD3-TOTAL to SIMOLOGS-MESSAGE
           call 'SIMOLOGS' using SIMOLOGS-PASS-AREA

           if  DATFMTD1-RDR not = DATFMTD3-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
           end-if

           move COMPARE-NE-TOTAL to SIMOLOGS-MESSAGE
           call 'SIMOLOGS' using SIMOLOGS-PASS-AREA

           if  DATFMTD1-EOF not = 'Y'
           or  DATFMTD3-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  DATFMTD1-RDR not = DATFMTD3-RDR
               add 4 to ZERO giving RETURN-CODE
           end-if
           exit.

      *****************************************************************
       JOB-STARTING.
           perform Z-POST-COPYRIGHT
           perform Z-DETERMINE-ENVIRONMENT
           perform DATFMTD1-OPEN
           perform DATFMTD3-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 'NOTE' 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.

      *****************************************************************
      * I/O Routines for the Primary File...                          *
      *****************************************************************
       DATFMTD1-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close DATFMTD1-FILE
           if  DATFMTD1-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 DATFMTD1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATFMTD1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATFMTD1-READ.
           read DATFMTD1-FILE
           if  DATFMTD1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               add 1 to DATFMTD1-RDR
           else
               if  DATFMTD1-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 DATFMTD1-EOF
               else
                   move 'READ Failure with DATFMTD1' to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TEXT
                   move DATFMTD1-STATUS to IO-STATUS
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       DATFMTD1-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input DATFMTD1-FILE
           if  DATFMTD1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to DATFMTD1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with DATFMTD1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATFMTD1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * I/O Routines for the Secondary File...                        *
      *****************************************************************
       DATFMTD3-READ.
           read DATFMTD3-FILE
           if  DATFMTD3-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               add 1 to DATFMTD3-RDR
           else
               if  DATFMTD3-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 DATFMTD3-EOF
               else
                   move 'READ Failure with DATFMTD3' to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TEXT
                   move DATFMTD3-STATUS to IO-STATUS
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       DATFMTD3-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input DATFMTD3-FILE
           if  DATFMTD3-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to DATFMTD3-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with DATFMTD3' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATFMTD3-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATFMTD3-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close DATFMTD3-FILE
           if  DATFMTD3-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to DATFMTD3-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with DATFMTD3' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATFMTD3-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 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.

      *****************************************************************
      * 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-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-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: 2008-11-14  Generation Time: 00:03:38:79    *
      *****************************************************************

Summary
(Next) (Previous) (Table-of-Contents)

The purpose of this suite of programs is to provide examples of how to create, copy and compare various data files and VSAM Data Sets using JCL, IEBGENER, IDCAMS and a COBOL program.

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

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, modify and distribute this software for a 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 express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software.

Downloads and Links to Similar Pages
(Next) (Previous) (Table-of-Contents)

This program is one of a suite of programs that provide for converting between data files and VSAM, Keyed-Sequential-Data-Set (KSDS). The complete Z-Pack may be downloaded from http://www.simotime.com/sim4dzip.htm#zPackDatFmt01 or view the complete list of SimoTime Examples at http://www.simotime.com/sim4dzip.htm.

Note: You must be attached to the Internet to download a Z-Pack or view the list.

Simply click on the following  SimoMODS Callable Routines and Utility Programs  to review additional information about the shared or common routines and programs available from SimoTime Enterprises.

Check out  The VSAM-QSAM-SORT Connection  for more examples of mainframe Data File management and accessing techniques with sample code.

To review all the information available on this site start at  The SimoTime Home Page .

Comments or Suggestions
(Next) (Previous) (Table-of-Contents)

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

We appreciate your comments and feedback.

About SimoTime Enterprises
(Next) (Previous) (Table-of-Contents)

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
Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
When technology complements business