Multiple Record Types
Convert & Accumulate Totals
  Table of Contents  v-16.01.01 - datmrt01.htm 
  Introduction
  The CMD Files
  Create a Test Files
  Baseline File
  Mixed Numeric Formats & Record Structures
  Accumulate sub-Totals by Record Type
  The JCL Members
  Create a Test Files
  Baseline File
  Mixed Numeric Formats & Record Structures
  Accumulate sub-Totals by Record Type
  EBCDIC to ASCII Conversion
  The COBOL Programs
  File Create, Mixed Record Types
  Accumulate sub-Totals by Record Type
  Convert, File Format & Record Content
  Conversion Routine for Record Type 01
  Conversion Routine for Record Type 02
  Conversion Routine for Record Type 03
  COBOL Copy Files & HTML Notes
  Record Type 01
  Record Type 02
  Record Type 03
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

The primary objective for this suite of programs is to describe and demonstrate how COBOL may be used to create and process a file containing multiple record types that use various numeric formats. The records contain a combination of text strings and numeric values stored in various formats such as signed-zoned-decimal, packed and binary.

A secondary objective is to describe and demonstrate how to convert the record content from an EBCDIC-encoded format to an ASCII-encoded format while maintaining the integrity and format of the numeric values.

Item Description
1 Create a file with multiple record types
2 Read a file with multiple record types and accumulate numeric totals by record groups.
3 Convert an EBCDIC encoded file with multiple record types to an ASCII encoded file with multiple record types.
  Objectives

The following shows the structure of the records in the sample file. The first three (3) bytes of every record are used for the same purpose.

Position Description
1 Record Status, A=Active, D=Delete, S=Suspend
2-3 Record Type, the following will show the structure of the remaining positions (or columns) in the record.
4-80 The format (or use) of columns 4-80 will vary based on the record type as define in columns 2-3.
Record Type Position Description
01 4-51 A 48 byte text string
  52-60 A nine (9) byte numeric field using a zoned-decimal format
  60-80 Filler
02 4-35 A 32 byte text string
  36-40 A five (5) byte numeric field using a packed (or COMP-3) format.
  41-80 Filler
03 4-19 A 16 byte text string
  19-22 A four (4) byte numeric field using a binary (or COMP) format.
  23-80 Filler

A suite of command files is provided to run the programs in a non-mainframe oriented environment on a Windows System using Micro Focus technologies.

The COBOL programs were written and tested using the VS COBOL II dialect. Also, the COBOL programs will work with COBOL for MVS and COBOL/370. JCL members are provided to run the jobs as MVS batch jobs on an IBM Mainframe System or on a Linux, UNIX or Windows System using Micro Focus technologies.

Note:  The COBOL programs were actually generated using SimoTime technologies. The generated programs are then compiled and tested on a Windows System using Micro Focus Enterprise Developer/Server.


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-2017
SimoTime Technologies
All Rights Reserved

Table of Contents Previous Section Next Section The CMD Files

There are three (3) Windows Command files provided with this suite of sample programs. The following describes each of the command files in more detail.

Table of Contents Previous Section Next Section Create a Test Files

The following two sub-sections will describe how to create the test files used by this suite of programs.

Table of Contents Previous Section Next Section Baseline File

This job (DATMRTW1.cmd) will use the Windows "ECHO" command to create an ASCII/Text file of data to be used to create a single file with multiple record types. Once an ASCII/Text file is created it will be used to create a record sequential file of fixed length records in a Micro Focus file format.

@echo OFF
rem  * *******************************************************************
rem  *               DATMRTE1.cmd - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2017 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Create a Sequential Data Set on disk.
rem  * Author - SimoTime Technologies
rem  * Date   = January 24, 1996
rem  *
rem  * The 1st step will set the global or comman environment variables.
rem  *
rem  * The 2nd job step (CreateTEXT) will create a new ASCII/Text file.
rem  *
rem  * The 3rd step will convert the Line Sequential file to a Record
rem  * Sequential file.
rem  *
rem  * The 4th step will perform the End-of-Job tasks.
rem  *
rem  * This set of programs will run on a Personal Computer with Windows
rem  * and Micro Focus Net Express.
rem  *
rem  * *******************************************************************
rem  * Step 1 of 4, Set the global or comman environment variables
rem  *
     set CmdName=DATMRTE1
     call ..\ENV1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%.cmd"
     call SimoNOTE "Starting CmdName %CmdName%, User is %USERNAME%"
     call SimoNOTE "StepInfo Delete previously created files"
     set DATMRTT1=%BaseLib1%\DATA\Txt1\DATMRTT1.TXT
rem  *
rem  * *******************************************************************
rem  * Step 2 of 4, Create and populate a new ASCII/TEXT file...
rem  *
     call SimoNOTE "StepInfo Create an ASCII/Text File"
     if exist %DATMRTT1% del %DATMRTT1%
rem  * ..1....:....2....:....3....:....4....:....5....:....6....:....7.
echo A01Text-48 with signed zoned decimal numeric data  000000101>>%DATMRTT1%
echo A02Text-32 with packed data                        000000204>>%DATMRTT1%
echo A03T16 binary data                                 000000307>>%DATMRTT1%
echo A01Text-48 with signed zoned decimal numeric data  000000102>>%DATMRTT1%
echo A02Text-32 with packed data                        000000205>>%DATMRTT1%
echo A01Text-48 with signed zoned decimal numeric data  000000103>>%DATMRTT1%
echo A03T16 binary data                                 000000308>>%DATMRTT1%
echo A01Text-48 with signed zoned decimal numeric data  000000114>>%DATMRTT1%
echo A01Text-48 with signed zoned decimal numeric data  000000115>>%DATMRTT1%
echo A03T16 binary data                                 000000309>>%DATMRTT1%
echo A02Text-32 with packed data                        000000206>>%DATMRTT1%
     if exist %DATMRTT1% call SimoNOTE "DataMake %DATMRTT1%"
     if not exist %DATMRTT1% set JobStatus=9001
     if not %JobStatus% == 0000 goto :EojNok
rem  *
rem  * *******************************************************************
rem  * Step 3 of 4, ConvertASCII/TEXT file to Record Sequential File...
rem  *
     call SimoNOTE "StepInfo Convert Line Sequential to Record Sequential"
     set GETLS080=%DATMRTT1%
     set PUTRS080=%BaseLib1%\DATA\Asc1\DATMRTW1.DAT
     if exist %PUTRS080% del %PUTRS080%
     run CV80ALAR
     if not ERRORLEVEL = 0 set JobStatus=0030
     if not %JobStatus% == 0000 goto :EojNok
     call SimoNOTE "DataTake %GETLS080%"
     call SimoNOTE "DataMake %PUTRS080%"
rem  *
rem  * *******************************************************************
rem  * Step 4 of 4, End of job routines...
rem  *
:EojAok
     call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus% "
     goto :End
:EojNok
     call SimoNOTE "NOTE ABENDING CmdName %CmdName%, Job Status is %JobStatus% "
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section Mixed Numeric Formats & Record Structures

This job (DATMRTW2.cmd) will use a COBOL program to read a record sequential file and write to a record sequential file containing multiple record types with different mainframe numeric formats.

@echo OFF
rem  * *******************************************************************
rem  *               DATMRTW2.cmd - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2017 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Create a file with multiple record types and multiple
rem  *          field types within the records.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read an 80-byte file that contains JUSTIFY
rem  * information. The job will also write a file containing the results
rem  * of the justify functions..
rem  *
rem  * This set of programs will run on a mainframe under MVS or on a
rem  * Personal Computer with Windows and Micro Focus Net Express.
rem  *
rem  *                     ************
rem  *                     * DATMRTW2 *
rem  *                     ********cmd*
rem  *                          *
rem  *                          *
rem  *                     ************     ************
rem  *                     * ezSetEnv *******  SetEnv  *
rem  *                     ********cmd*  *  *******task*
rem  *                          *
rem  *                          *
rem  *    ************     ************     ************
rem  *    * DATMRTD1 ******* DATMRTC1 ******* DATMRTD2 *
rem  *    *******rseq*     ********cbl*     *******rseq*
rem  *                          *
rem  *                          *
rem  *                     ************
rem  *                     *   EOJ    *
rem  *                     ************
rem  *
rem  * *******************************************************************
rem  * Step 1 of 4, Set global or Common Environment Variables
rem  *
     set CmdName=DATMRTW2
     call ..\ENV1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%.cmd"
     call SimoNOTE "Starting CmdName %CmdName%"
rem  *
rem  * Step 2 of 4, Do specific file mapping and delete any previously
rem  *              created file...
rem  *
     call SimoNOTE "StepInfo Delete previously created file"
     set DATMRTD1=%BaseLib1%\DATA\ASC1\DATMRTD1.DAT
     set DATMRTD2=%BaseLib1%\DATA\WRK1\DATMRTD2.DAT
     if exist %DATMRTD2% del %DATMRTD2%
rem  *
rem  * *******************************************************************
rem  * Step 3 of 4, Create a file with multiple record types
rem  *
     call SimoNOTE "StepInfo Execute Multiple Record Types in a File"
     run DATMRTC1
     if not ERRORLEVEL = 0 set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     call SimoNOTE "DataTake %DATMRTD1%"
     call SimoNOTE "DataMake %DATMRTD2%"
rem  *
     if exist %DATMRTD2% goto :EojAok
     set JobStatus=0020
     goto :EojNok
rem  *
rem  * *******************************************************************
rem  * Step 4 of 4, End of Job Routines
rem  *
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section Accumulate sub-Totals by Record Type

This job (DATMRTW3.cmd) will use a COBOL program to read a file with multiple record types and accumulate sub-totals by record types.

@echo OFF
rem  * *******************************************************************
rem  *               DATMRTW3.cmd - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2017 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Accumulate subtotals by record type
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read an 80-byte file that contains multiple record
rem  * types and accumulate sub-totals by record type.
rem  *
rem  * This set of programs will run on a mainframe under MVS or on a
rem  * Personal Computer with Windows and Micro Focus Net Express.
rem  *
rem  *                     ************
rem  *                     * DATMRTW3 *
rem  *                     ********cmd*
rem  *                          *
rem  *                          *
rem  *                     ************     ************
rem  *                     * ezSetEnv *******  SetEnv  *
rem  *                     ********cmd*  *  *******task*
rem  *                          *
rem  *                          *
rem  *    ************     ************     ************
rem  *    * DATMRTD2 ******* DATMRTC2 ******* DATMRTD3 *
rem  *    *******rseq*     ********cbl*     *******rseq*
rem  *                          *
rem  *                          *
rem  *                     ************
rem  *                     *   EOJ    *
rem  *                     ************
rem  *
rem  * *******************************************************************
rem  * Step 1 of 4, Set global or Common Environment Variables
rem  *
     set CmdName=DATMRTE3
     call ..\ENV1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%.cmd"
     call SimoNOTE "Starting CmdName %CmdName%"
rem  *
rem  * Step 2 of 4, Do specific file mapping and delete any previously
rem  *              created file...
rem  *
     call SimoNOTE "StepInfo Delete previously created file"
     set DATMRTD2=%BaseLib1%\DATA\Wrk1\DATMRTD2.DAT
     set DATMRTD3=%BaseLib1%\DATA\Wrk1\DATMRTD3.DAT
     if exist %DATMRTD3% del %DATMRTD3%
rem  *
rem  * *******************************************************************
rem  * Step 3 of 4, Create a file with multiple record types
rem  *
     call SimoNOTE "StepInfo Execute Multiple Record Types in a File"
     run DATMRTC2
     if not ERRORLEVEL = 0 set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     call SimoNOTE "DataTake %DATMRTD2%"
     call SimoNOTE "DataMake %DATMRTD3%"
rem  *
     if exist %DATMRTD3% goto :EojAok
     set JobStatus=0020
     goto :EojNok
rem  *
rem  * *******************************************************************
rem  * Step 4 of 4, End of Job Routines
rem  *
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section The JCL Members

There are four (4) JCL members provided with this suite of sample programs. The jobs are described in more detail in the following sections.

Table of Contents Previous Section Next Section Create a Test Files

The following two sub-sections will describe how to create the test files used by this suite of programs.

Table of Contents Previous Section Next Section Baseline File

This following job (DATMRTJ1.jcl) will use IEBGENER to create a file that contains the base data in a text format.

//DATMRTJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       DATMRTJ1.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2017 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 Technologies
//* Date   - January 24, 1996
//*
//* The 1st job step will delete any previously created files.
//*
//* The 2nd job step uses IEBGENER to 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.
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created files...
//*
//RSEQDELT EXEC PGM=IEFBR14
//DATMRTD1 DD  DSN=SIMOTIME.DATA.DATMRTD1,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...
//*
//CRTDATD1 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
A01Text-48 with signed zoned decimal numeric data  000000101
A02Text-32 with packed data                        000000204
A03T16 binary data                                 000000307
A01Text-48 with signed zoned decimal numeric data  000000102
A02Text-32 with packed data                        000000205
A01Text-48 with signed zoned decimal numeric data  000000103
A03T16 binary data                                 000000309
A01Text-48 with signed zoned decimal numeric data  000000114
A01Text-48 with signed zoned decimal numeric data  000000115
A03T16 binary data                                 000000308
A02Text-32 with packed data                        000000206
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.DATMRTD1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*

Table of Contents Previous Section Next Section Mixed Numeric Formats & Record Structures

The following is the JCL Member (DATMRTJ2.jcl) that is required to run as a job on a Mainframe System or on a Windows System with Micro Focus Mainframe Express or Server for Mainframe. The first job step will delete any files created by a previous execution. The second job step will read the file created by IEBGENER and write a file containing multiple record types and different numeric formats.

//DATMRTJ2 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       DATMRTJ2.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Create a Sequential File with Multiple Record Types.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The 1st job step will delete any previously created files.
//*
//* The 2nd job step executes a COBOL program that creates a new file
//* that contains multiple record types.
//*
//* 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 of 2, Delete any previously created files...
//*
//RSEQDELT EXEC PGM=IEFBR14
//DATMRTD2 DD  DSN=SIMOTIME.DATA.DATMRTD2,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create A file with multiple record types that contain
//*              packed and binary values...
//*
//CRTDATD2 EXEC PGM=DATMRTC1
//DATMRTD1 DD  DSN=SIMOTIME.DATA.DATMRTD1,DISP=SHR
//DATMRTD2 DD  DSN=SIMOTIME.DATA.DATMRTD2,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section Accumulate sub-Totals by Record Type

The following is the mainframe JCL member (DATMRTJ3.jcl) that will read the file with multiple record types and accumulate sub-totals by record groups. The sub-totals are posted to an output file.

//DATMRTJ3 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       DATMRTJ3.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Read a sequential file and accumulate subtotals by
//*          record groups.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The 1st job step will delete any previously created
//* file.
//*
//* The 2nd job step will read the file with multiple record types
//* and accumulate sub-totals by record groups.
//*
//* 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 of 2, Delete any previously created file...
//*
//RSEQDELT EXEC PGM=IEFBR14
//DATMRTD3 DD  DSN=SIMOTIME.DATA.DATMRTD3,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create file with multiple record types that contain
//*              packed and binary values...
//*
//MKREPORT EXEC PGM=DATMRTC2
//DATMRTD2 DD  DSN=SIMOTIME.DATA.DATMRTD2,DISP=SHR
//DATMRTD3 DD  DSN=SIMOTIME.DATA.DATMRTD3,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section EBCDIC to ASCII Conversion

The following is the mainframe JCL member (DATMRTJ4.jcl) that will read the EBCDIC-encoded file with multiple record types and write to an ASCII-encoded output file.

//DATMRTJ4 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       DATMRTJ4.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Read EBCDIC RSEQ-80 and write ASCII RSEQ-80
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The 1st job step will delete any previously created
//* file.
//*
//* The 2nd job step will read the file with multiple record types
//* and accumulate sub-totals by record groups.
//*
//* 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 of 2, Delete any previously created file...
//*
//RSEQDELT EXEC PGM=IEFBR14
//DATMRTD4 DD  DSN=SIMOTIME.DATA.DATMRTD4,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Convert file with multiple record types that contain
//*              packed and binary values...
//*
//CVTDATD2 EXEC PGM=DATMRTIO
//DATMRTGE DD  DSN=SIMOTIME.DATA.DATMRTD2,DISP=SHR
//DATMRTPA DD  DSN=SIMOTIME.DATA.DATMRTD4,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section The COBOL Programs

This section describes each of the COBOL programs provide in this suite of sample programs.

Table of Contents Previous Section Next Section File Create, Mixed Record Types

This program (DATMRTC1.cbl) will add records to a file. The records to be added will contain different record formats with a user-defined identifier for each record format.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    DATMRTC1.
       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: 2014-07-29  Generation Time: 09:40:47:96    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   DATMRTD1 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *  SECONDARY DATMRTD2 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *                                                               *
      *            Translation Mode is User Defined                   *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT DATMRTD1-FILE  ASSIGN TO       DATMRTD1
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS DATMRTD1-STATUS.
           SELECT DATMRTD2-FILE  ASSIGN TO       DATMRTD2
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS DATMRTD2-STATUS.

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

       FD  DATMRTD2-FILE
           DATA RECORD    IS DATMRTD2-REC
           .
       01  DATMRTD2-REC.
           05  DATMRTD2-DATA-01 PIC X(00080).

      *****************************************************************
      * This program was created with the SYSMASK1.TXT file as input. *
      * The SYSMASK1 provides for the sequential reading of the input *
      * file and the sequential writing of the output file.           *
      *                                                               *
      * If the output file is indexed then the input file must be in  *
      * sequence by the field that will be used to provide the key    *
      * for the output file. This is a sequential load process.       *
      *                                                               *
      * If the key field is not in sequence then refer to SYSMASK2    *
      * to provide for a random add or update of the indexed file.    *
      *                                                               *
      * This program mask will have the ASCII/EBCDIC table inserted   *
      * for use by the /TRANSLATE function of SimoZAPS.               *
      *                                                               *
      * For additional information contact SimoTime Technologies.     *
      *        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 '* DATMRTC1 '.
           05  T2 pic X(34) value 'Print a Report by Record Type     '.
           05  T3 pic X(10) value ' v13.10.01'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* DATMRTC1 '.
           05  C2 pic X(32) value 'This Data File Convert Member wa'.
           05  C3 pic X(32) value 's generated by SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  DATMRTD1-STATUS.
           05  DATMRTD1-STATUS-L     pic X.
           05  DATMRTD1-STATUS-R     pic X.
       01  DATMRTD1-EOF              pic X       value 'N'.
       01  DATMRTD1-OPEN-FLAG        pic X       value 'C'.

       01  DATMRTD2-STATUS.
           05  DATMRTD2-STATUS-L     pic X.
           05  DATMRTD2-STATUS-R     pic X.
       01  DATMRTD2-EOF              pic X       value 'N'.
       01  DATMRTD2-OPEN-FLAG        pic X       value 'C'.

       01  DATMRTD1-LRECL            pic 9(5)    value 00080.
       01  DATMRTD2-LRECL            pic 9(5)    value 00080.
       01  DATMRTD1-LRECL-MAX        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 '* DATMRTC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

      *****************************************************************
       01  PROGRAM-NAME            pic X(8)     value 'DATMRTC1'.

       01  INFO-STATEMENT.
           05  INFO-SHORT.
               10  INFO-ID pic X(8)    value 'Starting'.
               10  filler  pic X(2)    value ', '.
               10  filler  pic X(34)
                   value   'Print a Report by Record Type     '.
           05  filler      pic X(24)
               value ' http://www.SimoTime.com'.

       01  APPL-RESULT             pic S9(9)    comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       01  WRITE-FLAG      pic X       value 'Y'.

       01  DATMRTD1-TOTAL.
           05  DATMRTD1-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for DATMRTD1'.
       01  DATMRTD2-TOTAL.
           05  DATMRTD2-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for DATMRTD2'.

      *****************************************************************
      *    User defined working storage...
      *    USERDATA       DATMRTWS_CRT.inc
       01  WORK-03                     PIC X(3).
       01  DATMRTWS-RECORD.
           05  DATMRTWS-STATUS         PIC X.
           05  DATMRTWS-TYPE           PIC XX.
           05  DATMRTWS-TEXT           PIC X(48).
           05  DATMRTWS-NUMBER         PIC S9(9).
           05  FILLER                  PIC X(20).

       COPY DATMRTB1.
       COPY DATMRTB2.
       COPY DATMRTB3.
      *****************************************************************
       PROCEDURE DIVISION.
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move INFO-STATEMENT to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           perform Z-POST-COPYRIGHT
           perform DATMRTD1-OPEN
           perform DATMRTD2-OPEN

           perform until DATMRTD1-STATUS not = '00'
               perform DATMRTD1-READ
               if  DATMRTD1-STATUS = '00'
                   add 1 to DATMRTD1-RDR
                   perform BUILD-OUTPUT-RECORD
                   if  WRITE-FLAG = 'Y'
                       perform DATMRTD2-WRITE
                       if  DATMRTD2-STATUS = '00'
                           add 1 to DATMRTD2-ADD
                       end-if
                   end-if
               end-if
           end-perform

      *    USREOJ Processing not specified...

           move DATMRTD1-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           move DATMRTD2-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           if  APPL-EOF
               move 'Complete' to INFO-ID
           else
               move 'ABENDING' to INFO-ID
           end-if
           move INFO-STATEMENT to MESSAGE-TEXT(1:79)
           perform Z-DISPLAY-MESSAGE-TEXT

           perform DATMRTD2-CLOSE
           perform DATMRTD1-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    USEREXEC *INC  DATMRTUI_CRT.inc
           move 'N' to WRITE-FLAG
           move DATMRTD1-DATA-01(1:3) to WORK-03
           evaluate WORK-03
               when 'A01' perform BUILD-OUTPUT-RECORD-01
                          move 'Y' to WRITE-FLAG
               when 'A02' perform BUILD-OUTPUT-RECORD-02
                          move 'Y' to WRITE-FLAG
               when 'A03' perform BUILD-OUTPUT-RECORD-03
                          move 'Y' to WRITE-FLAG
           end-evaluate
           exit.

      *****************************************************************
       BUILD-OUTPUT-RECORD-01.
           move DATMRTD1-REC to DATMRTD2-REC
           exit.

      *****************************************************************
       BUILD-OUTPUT-RECORD-02.
           move ALL SPACES to DATMRT02-RECORD
           move DATMRTD1-REC to DATMRTWS-RECORD
           move DATMRTWS-STATUS to DATMRT02-STATUS
           move DATMRTWS-TYPE   to DATMRT02-TYPE
           move DATMRTWS-TEXT   to DATMRT02-TEXT
           add  DATMRTWS-NUMBER to ZERO giving DATMRT02-NUMBER
           move DATMRT02-RECORD to DATMRTD2-REC
           exit.

      *****************************************************************
       BUILD-OUTPUT-RECORD-03.
           move ALL SPACES to DATMRT03-RECORD
           move DATMRTD1-REC to DATMRTWS-RECORD
           move DATMRTWS-STATUS to DATMRT03-STATUS
           move DATMRTWS-TYPE   to DATMRT03-TYPE
           move DATMRTWS-TEXT   to DATMRT03-TEXT
           add  DATMRTWS-NUMBER to ZERO giving DATMRT03-NUMBER
           move DATMRT03-RECORD to DATMRTD2-REC
           exit.

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

      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       DATMRTD2-WRITE.
           if  DATMRTD2-OPEN-FLAG = 'C'
               perform DATMRTD2-OPEN
           end-if
           write DATMRTD2-REC
           if  DATMRTD2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  DATMRTD2-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'WRITE Failure with DATMRTD2' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTD2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATMRTD2-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT DATMRTD2-FILE
           if  DATMRTD2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to DATMRTD2-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with DATMRTD2' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTD2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATMRTD2-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close DATMRTD2-FILE
           if  DATMRTD2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to DATMRTD2-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with DATMRTD2' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTD2-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.

      *****************************************************************
      * 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.
           display SIM-TITLE
           display SIM-COPYRIGHT
           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: 2014-07-29  Generation Time: 09:40:47:99    *
      *****************************************************************

Table of Contents Previous Section Next Section Accumulate sub-Totals by Record Type

This program (DATMRTC2.cbl) will read the file with multiple record types and accumulate a record count for each record type along with a subtotal for the various numeric formats used in each record type.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    DATMRTC2.
       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: 2014-07-29  Generation Time: 09:40:48:21    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   DATMRTD2 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *  SECONDARY DATMRTD3 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *                                                               *
      *            Translation Mode is User Defined                   *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT DATMRTD2-FILE  ASSIGN TO       DATMRTD2
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS DATMRTD2-STATUS.
           SELECT DATMRTD3-FILE  ASSIGN TO       DATMRTD3
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS DATMRTD3-STATUS.

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

       FD  DATMRTD3-FILE
           DATA RECORD    IS DATMRTD3-REC
           .
       01  DATMRTD3-REC.
           05  DATMRTD3-DATA-01 PIC X(00080).

      *****************************************************************
      * This program was created with the SYSMASK1.TXT file as input. *
      * The SYSMASK1 provides for the sequential reading of the input *
      * file and the sequential writing of the output file.           *
      *                                                               *
      * If the output file is indexed then the input file must be in  *
      * sequence by the field that will be used to provide the key    *
      * for the output file. This is a sequential load process.       *
      *                                                               *
      * If the key field is not in sequence then refer to SYSMASK2    *
      * to provide for a random add or update of the indexed file.    *
      *                                                               *
      * This program mask will have the ASCII/EBCDIC table inserted   *
      * for use by the /TRANSLATE function of SimoZAPS.               *
      *                                                               *
      * For additional information contact SimoTime Technologies.     *
      *        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 '* DATMRTC2 '.
           05  T2 pic X(34) value 'Print a Report by Record Type     '.
           05  T3 pic X(10) value ' v13.10.01'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* DATMRTC2 '.
           05  C2 pic X(32) value 'This Data File Convert Member wa'.
           05  C3 pic X(32) value 's generated by SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  DATMRTD2-STATUS.
           05  DATMRTD2-STATUS-L     pic X.
           05  DATMRTD2-STATUS-R     pic X.
       01  DATMRTD2-EOF              pic X       value 'N'.
       01  DATMRTD2-OPEN-FLAG        pic X       value 'C'.

       01  DATMRTD3-STATUS.
           05  DATMRTD3-STATUS-L     pic X.
           05  DATMRTD3-STATUS-R     pic X.
       01  DATMRTD3-EOF              pic X       value 'N'.
       01  DATMRTD3-OPEN-FLAG        pic X       value 'C'.

       01  DATMRTD2-LRECL            pic 9(5)    value 00080.
       01  DATMRTD3-LRECL            pic 9(5)    value 00080.
       01  DATMRTD2-LRECL-MAX        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 '* DATMRTC2 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

      *****************************************************************
       01  PROGRAM-NAME            pic X(8)     value 'DATMRTC2'.

       01  INFO-STATEMENT.
           05  INFO-SHORT.
               10  INFO-ID pic X(8)    value 'Starting'.
               10  filler  pic X(2)    value ', '.
               10  filler  pic X(34)
                   value   'Print a Report by Record Type     '.
           05  filler      pic X(24)
               value ' http://www.SimoTime.com'.

       01  APPL-RESULT             pic S9(9)    comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       01  WRITE-FLAG      pic X       value 'Y'.

       01  DATMRTD2-TOTAL.
           05  DATMRTD2-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for DATMRTD2'.
       01  DATMRTD3-TOTAL.
           05  DATMRTD3-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for DATMRTD3'.

      *****************************************************************
      *    User defined working storage...
      *    USERDATA       DATMRTWS_RPT.inc
      *    -----------------------------------------------------------*
      *    User INCLUDE member for WORKING STORAGE.
       01  WORK-03                     PIC X(3).
       01  DATMRTWS-RECORD.
           05  DATMRTWS-STATUS         PIC X.
           05  DATMRTWS-TYPE           PIC XX.
           05  DATMRTWS-TEXT           PIC X(48).
           05  DATMRTWS-NUMBER         PIC S9(9).
           05  FILLER                  PIC X(20).

       01  SUB-TOTAL-01   PIC 9(7)     value 0.
       01  SUB-TOTAL-02   PIC 9(7)     value 0.
       01  SUB-TOTAL-03   PIC 9(7)     value 0.
       01  SUB-TOTAL-99   PIC 9(7)     value 0.
       01  REC-COUNT-01   PIC 9(7)     value 0.
       01  REC-COUNT-02   PIC 9(7)     value 0.
       01  REC-COUNT-03   PIC 9(7)     value 0.
       01  REC-COUNT-99   PIC 9(7)     value 0.

       01  SUMMARY-LINE-01.
           05  FILLER     PIC X(12)    value '  Group-01  '.
           05  RECORDS-01 PIC Z,ZZZ,ZZ9+.
           05  FILLER     PIC X(18)    value '  record count    '.
           05  SUMMARY-01 PIC Z,ZZZ,ZZ9+.
           05  FILLER     PIC X(18)    value '  sub-total       '.
       01  SUMMARY-LINE-02.
           05  FILLER     PIC X(12)    value '  Group-02  '.
           05  RECORDS-02 PIC Z,ZZZ,ZZ9+.
           05  FILLER     PIC X(18)    value '  record count    '.
           05  SUMMARY-02 PIC Z,ZZZ,ZZ9+.
           05  FILLER     PIC X(18)    value '  sub-total       '.
       01  SUMMARY-LINE-03.
           05  FILLER     PIC X(12)    value '  Group-03  '.
           05  RECORDS-03 PIC Z,ZZZ,ZZ9+.
           05  FILLER     PIC X(18)    value '  record count    '.
           05  SUMMARY-03 PIC Z,ZZZ,ZZ9+.
           05  FILLER     PIC X(18)    value '  sub-total       '.
       01  SUMMARY-LINE-99.
           05  FILLER     PIC X(12)    value '  Group-All '.
           05  RECORDS-99 PIC Z,ZZZ,ZZ9+.
           05  FILLER     PIC X(18)    value '  record count    '.
           05  SUMMARY-99 PIC Z,ZZZ,ZZ9+.
           05  FILLER     PIC X(18)    value '  Final TOTAL     '.

       COPY DATMRTB1.
       COPY DATMRTB2.
       COPY DATMRTB3.
      *    -----------------------------------------------------------*
      *****************************************************************
       PROCEDURE DIVISION.
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move INFO-STATEMENT to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           perform Z-POST-COPYRIGHT
           perform DATMRTD2-OPEN
           perform DATMRTD3-OPEN

           perform until DATMRTD2-STATUS not = '00'
               perform DATMRTD2-READ
               if  DATMRTD2-STATUS = '00'
                   add 1 to DATMRTD2-RDR
                   perform BUILD-OUTPUT-RECORD
                   if  WRITE-FLAG = 'Y'
                       perform DATMRTD3-WRITE
                       if  DATMRTD3-STATUS = '00'
                           add 1 to DATMRTD3-ADD
                       end-if
                   end-if
               end-if
           end-perform

      *    USREOJ Processing...
           perform POST-USREOJ-INFORMATION

           move DATMRTD2-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           move DATMRTD3-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           if  APPL-EOF
               move 'Complete' to INFO-ID
           else
               move 'ABENDING' to INFO-ID
           end-if
           move INFO-STATEMENT to MESSAGE-TEXT(1:79)
           perform Z-DISPLAY-MESSAGE-TEXT

           perform DATMRTD3-CLOSE
           perform DATMRTD2-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    USEREXEC *INC  DATMRTUI_RPT.inc
           move 'N' to WRITE-FLAG
           move DATMRTD2-DATA-01(1:3) to WORK-03
           evaluate WORK-03
             when 'A01' perform POST-RECORD-01
             when 'A02' perform POST-RECORD-02
             when 'A03' perform POST-RECORD-03
           end-evaluate
           exit.

      *****************************************************************
       POST-RECORD-01.
           move DATMRTD2-REC to DATMRT01-RECORD
           add DATMRT01-NUMBER to SUB-TOTAL-01
           add 1 to REC-COUNT-01
           exit.

      *****************************************************************
       POST-RECORD-02.
           move DATMRTD2-REC to DATMRT02-RECORD
           add DATMRT02-NUMBER to SUB-TOTAL-02
           add 1 to REC-COUNT-02
           exit.

      *****************************************************************
       POST-RECORD-03.
           move DATMRTD2-REC to DATMRT03-RECORD
           add DATMRT03-NUMBER to SUB-TOTAL-03
           add 1 to REC-COUNT-03
           exit.

      *****************************************************************
       POST-USREOJ-INFORMATION.
           move SIM-TITLE to DATMRTD3-REC
           perform DATMRTD3-WRITE
           move SIM-COPYRIGHT to DATMRTD3-REC
           perform DATMRTD3-WRITE
           move ALL SPACES to DATMRTD3-REC
           perform DATMRTD3-WRITE

           add SUB-TOTAL-01 to ZERO giving SUMMARY-01
           add REC-COUNT-01 to ZERO giving RECORDS-01
           move SUMMARY-LINE-01 to DATMRTD3-REC
           perform DATMRTD3-WRITE
           if  DATMRTD3-STATUS = '00'
               add 1 to DATMRTD3-ADD
           end-if

           add SUB-TOTAL-02 to ZERO giving SUMMARY-02
           add REC-COUNT-02 to ZERO giving RECORDS-02
           move SUMMARY-LINE-02 to DATMRTD3-REC
           perform DATMRTD3-WRITE
           if  DATMRTD3-STATUS = '00'
               add 1 to DATMRTD3-ADD
           end-if

           add SUB-TOTAL-03 to ZERO giving SUMMARY-03
           add REC-COUNT-03 to ZERO giving RECORDS-03
           move SUMMARY-LINE-03 to DATMRTD3-REC
           perform DATMRTD3-WRITE
           if  DATMRTD3-STATUS = '00'
               add 1 to DATMRTD3-ADD
           end-if

           compute SUB-TOTAL-99 = SUB-TOTAL-01
                                + SUB-TOTAL-02
                                + SUB-TOTAL-03
           add SUB-TOTAL-99 to ZERO giving SUMMARY-99
           compute REC-COUNT-99 = REC-COUNT-01
                                + REC-COUNT-02
                                + REC-COUNT-03
           add REC-COUNT-99 to ZERO giving RECORDS-99
           move SUMMARY-LINE-99 to DATMRTD3-REC
           perform DATMRTD3-WRITE
           if  DATMRTD3-STATUS = '00'
               add 1 to DATMRTD3-ADD
           end-if
           exit.

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

      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       DATMRTD3-WRITE.
           if  DATMRTD3-OPEN-FLAG = 'C'
               perform DATMRTD3-OPEN
           end-if
           write DATMRTD3-REC
           if  DATMRTD3-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  DATMRTD3-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'WRITE Failure with DATMRTD3' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTD3-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATMRTD3-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT DATMRTD3-FILE
           if  DATMRTD3-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to DATMRTD3-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with DATMRTD3' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTD3-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATMRTD3-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close DATMRTD3-FILE
           if  DATMRTD3-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to DATMRTD3-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with DATMRTD3' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTD3-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.

      *****************************************************************
      * 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.
           display SIM-TITLE
           display SIM-COPYRIGHT
           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: 2014-07-29  Generation Time: 09:40:48:24    *
      *****************************************************************

Table of Contents Previous Section Next Section Convert, File Format & Record Content

The following COBOL program (DATMRTIO.cbl) is the mainline program for doing the file I/O and calling the conversion routines based on the record type being processed.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    DATMRTIO.
       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: 2014-07-29  Generation Time: 09:40:48:49    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   DATMRTGE SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *  SECONDARY DATMRTPA SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *                                                               *
      *            Translation Mode is User Defined                   *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT DATMRTGE-FILE  ASSIGN TO       DATMRTGE
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS DATMRTGE-STATUS.
           SELECT DATMRTPA-FILE  ASSIGN TO       DATMRTPA
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS DATMRTPA-STATUS.

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

       FD  DATMRTPA-FILE
           DATA RECORD    IS DATMRTPA-REC
           .
       01  DATMRTPA-REC.
           05  DATMRTPA-DATA-01 PIC X(00080).

      *****************************************************************
      * This program was created with the SYSMASK1.TXT file as input. *
      * The SYSMASK1 provides for the sequential reading of the input *
      * file and the sequential writing of the output file.           *
      *                                                               *
      * If the output file is indexed then the input file must be in  *
      * sequence by the field that will be used to provide the key    *
      * for the output file. This is a sequential load process.       *
      *                                                               *
      * If the key field is not in sequence then refer to SYSMASK2    *
      * to provide for a random add or update of the indexed file.    *
      *                                                               *
      * This program mask will have the ASCII/EBCDIC table inserted   *
      * for use by the /TRANSLATE function of SimoZAPS.               *
      *                                                               *
      * For additional information contact SimoTime Technologies.     *
      *        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 '* DATMRTIO '.
           05  T2 pic X(34) value 'Convert Multiple Record types, E2A'.
           05  T3 pic X(10) value ' v13.10.01'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* DATMRTIO '.
           05  C2 pic X(32) value 'This Data File Convert Member wa'.
           05  C3 pic X(32) value 's generated by SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  DATMRTGE-STATUS.
           05  DATMRTGE-STATUS-L     pic X.
           05  DATMRTGE-STATUS-R     pic X.
       01  DATMRTGE-EOF              pic X       value 'N'.
       01  DATMRTGE-OPEN-FLAG        pic X       value 'C'.

       01  DATMRTPA-STATUS.
           05  DATMRTPA-STATUS-L     pic X.
           05  DATMRTPA-STATUS-R     pic X.
       01  DATMRTPA-EOF              pic X       value 'N'.
       01  DATMRTPA-OPEN-FLAG        pic X       value 'C'.

       01  DATMRTGE-LRECL            pic 9(5)    value 00080.
       01  DATMRTPA-LRECL            pic 9(5)    value 00080.
       01  DATMRTGE-LRECL-MAX        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 '* DATMRTIO '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

      *****************************************************************
       01  PROGRAM-NAME            pic X(8)     value 'DATMRTIO'.

       01  INFO-STATEMENT.
           05  INFO-SHORT.
               10  INFO-ID pic X(8)    value 'Starting'.
               10  filler  pic X(2)    value ', '.
               10  filler  pic X(34)
                   value   'Convert Multiple Record types, E2A'.
           05  filler      pic X(24)
               value ' http://www.SimoTime.com'.

       01  APPL-RESULT             pic S9(9)    comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       01  WRITE-FLAG      pic X       value 'Y'.

       01  DATMRTGE-TOTAL.
           05  DATMRTGE-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for DATMRTGE'.
       01  DATMRTPA-TOTAL.
           05  DATMRTPA-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for DATMRTPA'.

      *****************************************************************
      *    User defined working storage...
      *****************************************************************
       PROCEDURE DIVISION.
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move INFO-STATEMENT to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           perform Z-POST-COPYRIGHT
           perform DATMRTGE-OPEN
           perform DATMRTPA-OPEN

           perform until DATMRTGE-STATUS not = '00'
               perform DATMRTGE-READ
               if  DATMRTGE-STATUS = '00'
                   add 1 to DATMRTGE-RDR
                   perform BUILD-OUTPUT-RECORD
                   if  WRITE-FLAG = 'Y'
                       perform DATMRTPA-WRITE
                       if  DATMRTPA-STATUS = '00'
                           add 1 to DATMRTPA-ADD
                       end-if
                   end-if
               end-if
           end-perform

      *    USREOJ Processing not specified...

           move DATMRTGE-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           move DATMRTPA-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           if  APPL-EOF
               move 'Complete' to INFO-ID
           else
               move 'ABENDING' to INFO-ID
           end-if
           move INFO-STATEMENT to MESSAGE-TEXT(1:79)
           perform Z-DISPLAY-MESSAGE-TEXT

           perform DATMRTPA-CLOSE
           perform DATMRTGE-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    USEREXEC *INC  DATMRTUI_IOP.inc
           move DATMRTGE-REC to DATMRTPA-REC
           evaluate DATMRTGE-REC(2:2)
             when x'F0F1' call 'DATMRTR1' using DATMRTPA-REC
             when x'F0F2' call 'DATMRTR2' using DATMRTPA-REC
             when x'F0F3' call 'DATMRTR3' using DATMRTPA-REC
           end-evaluate
           add 00080 to ZERO giving DATMRTPA-LRECL
           exit.

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

      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       DATMRTPA-WRITE.
           if  DATMRTPA-OPEN-FLAG = 'C'
               perform DATMRTPA-OPEN
           end-if
           write DATMRTPA-REC
           if  DATMRTPA-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  DATMRTPA-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'WRITE Failure with DATMRTPA' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTPA-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATMRTPA-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT DATMRTPA-FILE
           if  DATMRTPA-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to DATMRTPA-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with DATMRTPA' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTPA-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       DATMRTPA-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close DATMRTPA-FILE
           if  DATMRTPA-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to DATMRTPA-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with DATMRTPA' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move DATMRTPA-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.

      *****************************************************************
      * 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.
           display SIM-TITLE
           display SIM-COPYRIGHT
           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: 2014-07-29  Generation Time: 09:40:48:52    *
      *****************************************************************

Table of Contents Previous Section Next Section Conversion Routine for Record Type 01

The following routine (DATMRTR1.cbl) is called to convert a record type 01 from EBCDIC to ASCII.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    DATMRTR1.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             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: 2014/07/29  Generation Time: 09:40:48:95    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  IX-1  PIC 9(5) VALUE 0.
       01  RM-1  PIC 9(5) VALUE 0.
       01  RO-1  PIC 9(5) VALUE 0.
       01  IX-2  PIC 9(5) VALUE 0.
       01  RM-2  PIC 9(5) VALUE 0.
       01  RO-2  PIC 9(5) VALUE 0.

       COPY ASCEBCB1.
       COPY ASCEBCB2.

      *****************************************************************
       LINKAGE SECTION.
       COPY DATMRTB1.

      *****************************************************************
       PROCEDURE DIVISION using DATMRT01-RECORD.
           inspect DATMRT01-STATUS          converting E-INFO to A-INFO
           inspect DATMRT01-TYPE            converting E-INFO to A-INFO
           inspect DATMRT01-TEXT            converting E-INFO to A-INFO
      *    Decimal........ DATMRT01-NUMBER
           inspect DATMRT01-RECORD(52:9)    converting E-NUMB to A-NUMB
      *    Filler......... A Non-Unique Reference to a Data Item
           inspect DATMRT01-RECORD(61:20)   converting E-INFO to A-INFO
           GOBACK.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             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: 2014/07/29  Generation Time: 09:40:48:95    *
      *****************************************************************

Table of Contents Previous Section Next Section Conversion Routine for Record Type 02

The following routine (DATMRTR2.cbl) is called to convert a record type 02 from EBCDIC to ASCII.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    DATMRTR2.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             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: 2014/07/29  Generation Time: 09:40:49:34    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  IX-1  PIC 9(5) VALUE 0.
       01  RM-1  PIC 9(5) VALUE 0.
       01  RO-1  PIC 9(5) VALUE 0.
       01  IX-2  PIC 9(5) VALUE 0.
       01  RM-2  PIC 9(5) VALUE 0.
       01  RO-2  PIC 9(5) VALUE 0.

       COPY ASCEBCB1.
       COPY ASCEBCB2.

      *****************************************************************
       LINKAGE SECTION.
       COPY DATMRTB2.

      *****************************************************************
       PROCEDURE DIVISION using DATMRT02-RECORD.
           inspect DATMRT02-STATUS          converting E-INFO to A-INFO
           inspect DATMRT02-TYPE            converting E-INFO to A-INFO
           inspect DATMRT02-TEXT            converting E-INFO to A-INFO
      *    Packed......... DATMRT02-NUMBER
      *    The /PACKEDFLD option is set to SPACECONVERT
           if DATMRT02-RECORD(36:5) = all x'40'
              inspect DATMRT02-RECORD(36:5)
                                           replacing all x'40' by x'20'
           end-if
      *    Filler......... A Non-Unique Reference to a Data Item
           inspect DATMRT02-RECORD(41:40)   converting E-INFO to A-INFO
           GOBACK.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             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: 2014/07/29  Generation Time: 09:40:49:34    *
      *****************************************************************

Table of Contents Previous Section Next Section Conversion Routine for Record Type 03

The following routine (DATMRTR3.cbl) is called to convert a record type 03 from EBCDIC to ASCII.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    DATMRTR3.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             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: 2014/07/29  Generation Time: 09:40:49:71    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  IX-1  PIC 9(5) VALUE 0.
       01  RM-1  PIC 9(5) VALUE 0.
       01  RO-1  PIC 9(5) VALUE 0.
       01  IX-2  PIC 9(5) VALUE 0.
       01  RM-2  PIC 9(5) VALUE 0.
       01  RO-2  PIC 9(5) VALUE 0.

       COPY ASCEBCB1.
       COPY ASCEBCB2.

      *****************************************************************
       LINKAGE SECTION.
       COPY DATMRTB3.

      *****************************************************************
       PROCEDURE DIVISION using DATMRT03-RECORD.
           inspect DATMRT03-STATUS          converting E-INFO to A-INFO
           inspect DATMRT03-TYPE            converting E-INFO to A-INFO
           inspect DATMRT03-TEXT            converting E-INFO to A-INFO
      *    Binary......... DATMRT03-NUMBER
      *    Filler......... A Non-Unique Reference to a Data Item
           inspect DATMRT03-RECORD(24:57)   converting E-INFO to A-INFO
           GOBACK.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             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: 2014/07/29  Generation Time: 09:40:49:71    *
      *****************************************************************

Table of Contents Previous Section Next Section COBOL Copy Files & HTML Notes

This section describes the three different record formats for the sequential file. For each record in the file the 1st byte is always the record status. An "A" indicates the record is "Active". The character "D" in the first position indicates the record is flagged for deletion.

The next two byte (or positions 2-3) identify the record type. Valid entries for record type are 01, 02 and 03. The following sections describe each of the record types and the associated copy files.

The COBOL copy files provide information for an application program to build a data structure in Working Storage. However, the copy file does not provide explicit information about the start positions of fields within the records or the physical size of the various numeric formats. The HTML document provides this information.

The following sections describe each of the record types and the associated copy file.

Table of Contents Previous Section Next Section Record Type 01

This copy file (DATMRTB1.cpy) defines the record layout for type "01" record.

      *****************************************************************
      *               DATMRTB1.CPY - a COBOL Copy File                *
      *       Copy File for a file with multiple record types.        *
      *          The Record Definition for a Type 1 record.           *
      *   A 48 byte text string and a signed-zoned-decimal number.    *
      *         Copyright (C) 1987-2017 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       *
      *****************************************************************
      *
       01  DATMRT01-RECORD.
           05  DATMRT01-STATUS         PIC X.
           05  DATMRT01-TYPE           PIC XX.
           05  DATMRT01-TEXT           PIC X(48).
           05  DATMRT01-NUMBER         PIC S9(9).
           05  FILLER                  PIC X(20).
      *
      ***  DATMRTB1 - End-of-Copy File - - - - - - - - - - - DATMRTB1 *
      *****************************************************************
      *

The Record Structure for a type "01" record is defined in an HTML document that is generated using the preceding COBOL copy file.

Table of Contents Previous Section Next Section Record Type 02

This copy file (DATMRTB2.cpy) defines the record layout for type "02" record.

      *****************************************************************
      *               DATMRTB2.CPY - a COBOL Copy File                *
      *       Copy File for a file with multiple record types.        *
      *          The Record Definition for a Type 2 record.           *
      *          A 32 byte text string and a packed number.           *
      *         Copyright (C) 1987-2017 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       *
      *****************************************************************
      *
       01  DATMRT02-RECORD.
           05  DATMRT02-STATUS         PIC X.
           05  DATMRT02-TYPE           PIC XX.
           05  DATMRT02-TEXT           PIC X(32).
           05  DATMRT02-NUMBER         PIC S9(9)        COMP-3.
           05  FILLER                  PIC X(40).
      *
      ***  DATMRTB2 - End-of-Copy File - - - - - - - - - - - DATMRTB2 *
      *****************************************************************
      *

The Record Structure for a type "02" record is defined in an HTML document that is generated using the preceding COBOL copy file.

Table of Contents Previous Section Next Section Record Type 03

This copy file (DATMRTB3.cpy) defines the record layout for type "03" record.

      *****************************************************************
      *               DATMRTB3.CPY - a COBOL Copy File                *
      *       Copy File for a file with multiple record types.        *
      *           The Record Definition for a Type 3 record.          *
      *           A 16 byte text string and a binary number.          *
      *         Copyright (C) 1987-2017 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       *
      *****************************************************************
      *
       01  DATMRT03-RECORD.
           05  DATMRT03-STATUS         PIC X.
           05  DATMRT03-TYPE           PIC XX.
           05  DATMRT03-TEXT           PIC X(16).
           05  DATMRT03-NUMBER         PIC S9(7)V99     COMP.
           05  FILLER                  PIC X(57).
      *
      ***  DATMRTB3 - End-of-Copy File - - - - - - - - - - - DATMRTB3 *
      *****************************************************************
      *

The Record Structure for a type "03" record is defined in an HTML document that is generated using the preceding COBOL copy file.

Table of Contents Previous Section Next Section Summary

The primary objective for this suite of programs is to describe and demonstrate how COBOL may be used to create and process a file containing multiple record types that use various numeric formats. 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 document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

The 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 send an e-mail to: helpdesk@simotime.com or call 415 883-6565. We appreciate hearing from you.

Table of Contents Previous Section Next Section 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.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the Link to Internet icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the Link to Server icon.

Link to Internet   Link to Server   Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe System were copied and deployed in a Microsoft Windows environment with Micro Focus Enterprise Server.

Link to Internet   Link to Server   Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.

Link to Internet   Link to Server   Explore the capabilities of the SimoZAPS Utility Program. This includes generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII while maintaining mainframe (or COBOL) numeric formats and integrity. 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.

Link to Internet   Link to Server   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.

Link to Internet   Link to Server   Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

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.

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 Micro Focus Web Site for more information about products and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Comments or Feedback

This document was created and is copyrighted and maintained by SimoTime Technologies.

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.

Table of Contents Previous Section Next Section Company Overview

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
Data File with Multiple Record Types, Processing and Conversion
Copyright © 1987-2017
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com