Data File Transitions
When technology complements business   Transfer, Share, Convert and Compare
Copyright © 1987-2008  SimoTime Enterprises, LLC  All Rights Reserved http://www.simotime.com

 
Introduction Version 06.11.01
 
  Programming Objectives
  System Requirements
  JCL (Z/OS Job Control Language) for use with Mainframe Express or Mainframe
 
  JCL, Create a Record Sequential File with Customer Data using IEBGENER
  JCL, Delete the VSAM Cluster for the Customer Master File
  JCL, Define a VSAM Cluster for the Customer Master File
  JCL, Update the Customer Master File using Information from the Sequential File
  JCL, Print Four Across Mailing Labels
  JCL, Read Customer Master File and Reproduce a Sequential File using IDCAMS
  CMD (Windows Command File) for use with Net Express
 
  CMD, FTP a Sequential File from a Mainframe System to a Windows System
  CMD, Convert EBCDIC-encoded, Record Sequential File to an ASCII-encoded Indexed File
  CMD, Compare Two Data Files
  CMD, Create Comma Separated Values File from Customer Master File
 
  CMD, Read Customer Master File and write to Record Sequential File with CSV Formatted Records
  CMD, Read Record Sequential File with CSV Formatted Records and Write ASCII/Text File
  The COBOL Demonstration Programs
 
  COBOL, Update the Customer Master File using Information from the Sequential File
  COBOL, Convert Record Sequential, EBCDIC File to a Keyed-Indexed, ASCII File
 
  COBOL, Mainline Program for File I/O with Call to Routine for Record Content Conversion
  COBOL, Callable Routine to Convert the Fields within a Record based on the Copy File Definition
  COBOL, Compare Two Data Files
  COBOL, Create a Comma Separated Values File by Extracting Data from the Customer Master File
 
  COBOL, Read Customer Master File and write to Record Sequential File with CSV Formatted Records
  COBOL, Read a Record Sequential File and Write a Line Sequential File
  Special Handling, Advanced or Shared Functions
 
  Special Handling, Compiler Directives
  Special Handling, Setting the Environment
  Special Handling, Displaying and Logging Messages
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Glossary of Terms
  Comments or Suggestions
  About SimoTime

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

In today's world there is a variety of systems that store data in a variety of formats using a variety of devices. The current processes for storing, retrieving, processing, transferring, sharing, converting or comparing data are continually evolving. New systems, devices and processes for managing data are being introduced and providing for higher volumes of data storage and faster access rates at lower cost per unit of storage.

This document and the associated suite of sample programs will focus on the transfer, share, convert and compare processes across multiple systems using currently available technologies.

For additional information of if you have any questions, suggestions or comments please call or send an e-mail to:  helpdesk@simotime.com 

Programming Objectives
(Next) (Previous) (Table-of-Contents)

This example illustrates the following functions.

1. Demonstrate how to use JCL and IEBGENER to create an EBCDIC-encoded, sequential file with eighty byte fixed length records.
1.1. The CUSC80J1.JCL member will create a sequential file of 80-byte records with customer information.
1.2. Uses IEFBR14 to delete a previously create file and then uses IEBGENER to create a new file.
1.3. This job will run with ZOS, MFE or ES/MTO configured for an EBCDIC-encoding
2. Demonstrate how to use JCL and IDCAMS to define an EBCDIC-encoded, VSAM, KSDS cluster with 512 byte records.
2.1. The CUSCRTJ1.JCL member will create a VSAM cluster for a Customer Master File.
Note: if the CUSCRTJ1 job ends with a CC=8 this is usually caused be the existance of a Customer Master File. This existing file may be deleted by running the CUSDELJ1.JCL job.
2.2. The new KSDS will have 512-byte records with the primary key starting at position 1 with a key length of 12 bytes
2.3. This job will run with ZOS, MFE or ES/MTO configured for an EBCDIC-encoding
3. Demonstrate how to use JCL and a COBOL program to read a sequential file, reformat the data (i.e. six byte key to twelve byte key) and populate an EBCDIC-encoded VSAM, KSDS.
3.1. The CUSI80J1.JCL member will execute a COBOL program that will read a record sequential file of 80-byte records. The fields sizes will be increased and the expanded field and record will be used to add records to the Customer Master File. If a record with an equal key is encountered it will be updated with the new information.
3.2. This job will run with ZOS, MFE or ES/MTO configured for an EBCDIC-encoding
4. Demonstrate how to use JCL and a COBOL program to read the EBCDIC-encoded VSAM, KSDS and produces four-across mailing labels.
4.1. The STAMLRJ1.JCL member will read the EBCDIC-encoded Customer Master file and create a print-oriented file of four-across mailing labels with the records sorted in postal code sequence
4.2. The format of the print-oriented file is an EBCDIC-encoded Record Sequential file of 192 byte records.
4.3. This job will run with ZOS, MFE or ES/MTO configured for an EBCDIC-encoding
5. Demonstrate how to use JCL and IDCAMS and the REPRO function to read an EBCDIC-encoded VSAM, KSDS and create an EBCDIC-encoded Sequential File.
5.1. The CUSK2RJ1.JCL member will use IDCAMS to read the customer master file and create a record sequential file. The record layout is the same for the input and output.
5.2. The record sequential file may be transferred from the Mainframe System to a Windows System using FTP in BINARY mode.
5.3. This job will run with ZOS, MFE or ES/MTO configured for an EBCDIC-encoding
6. Describe how to use FTP from a Windows System to transfer the EBCDIC-encoded sequential file in BINARY mode from the Mainframe System to a Windows System.
6.1. The  ftp4cmd1.htm  document describes the FTP commands required.
7. Demonstrate how to do file format and file content conversion from an EBCDIC-encoded Record Sequential to an ASCII-encoded VSAM, KSDS. The content conversion must be done at the field level.
5.1. The CUREKAE1.CMD Windows Command File executes a COBOL program that will read the Record Sequential File and write a new ASCII-encoded Customer Master File.
5.2. The record sequential file may have been transferred from the Mainframe System to a Windows System using FTP in BINARY mode.
5.3. This job will run with Micro Focus Net Express (NXE) or ES/MTO configured for ASCII-encoding when the COBOL program is compiled with CHARSET(ASCII). This job will run with MFE or ES/MTO configured for EBCDIC-encoding when the COBOL program is compiled with CHARSET(EBCDIC).
8. Demonstrate how to use a COBOL program to read the ASCII-encoded VSAM, KSDS and produces four-across mailing labels.
8.1. The STAMLRJ1.JCL member will read the ASCII-encoded Customer Master file and create a print-oriented file of four-across mailing labels with the records sorted in postal code sequence
8.2. The format of the print-oriented file is an ASCII-encoded Record Sequential file of 192 byte records.
8.3. This job will run with NXE or ES/MTO configured for an ASCII-encoding
8.4. The STAMLRE1.CMD Windows Command File is provided to run this job without using JCL.
9. Demonstrate how to compare two data files
9.1. The  CUP303E1.CMD  member will compare the ASCII-encoded, record sequential file created in the Mainframe and ZOS environment to the ASCII-encoded Customer Master file created in the Windows and Micro Focus environment.
9.2. This job executes a COBOL program to do the file compare. Based on the files being in sequence by a key field the compare routine will track inserts and deletes.
9.3. This job will run with NXE or ES/MTO configured for ASCII-encoding when the COBOL program is compiled with CHARSET(ASCII). This job will run with MFE or ES/MTO configured for EBCDIC-encoding when the COBOL program is compiled with CHARSET(EBCDIC).
9.4. The CUP303E1.CMD Windows Command File is provided to run this job without using JCL.
10. Demonstrate how to extract data from a VSAM, KSDS to a Sequential file with the record structure in a Comma Separated Values format.
10.1. The CUSCSVE1.CMD Windows Command File executes a COBOL program that will read the Customer Master File and write to a record sequential file with the records constructed in a Comma Separated Values format.
10.2. May be ported to run on the UNIX platforms supported by Micro Focus COBOL.
10.3. This job will run with NXE or ES/MTO configured for an ASCII-encoded environment.
10.4. The CUSCSVE2.CMD Windows Command File executes a COBOL program that will read an ASCII-encoded, Record Sequential file and write to a Line Sequential file. The Line Sequential File (or ASCII/Text File) may be viewed with NotePAD or easily imported into an Excel spreadsheet since it has a CSV extension as part of the file name.
10.5. The CUSCSVJ1.JCL member executes a COBOL program that will read the Customer Master File and write to a record sequential file with the records constructed in a Comma Separated Values format. If this job is executed on a Z/OS Mainframe System it will create an EBCDIC-encoded record sequential file. If the record sequential file is transferred to a Windows System via FTP using ASCII-Mode it will be converted from a Record Sequential, EBCDIC-encoded file to an ASCII/Text file on the Windows System.

System Requirements
(Next) (Previous) (Table-of-Contents)

This suite of samples programs will run on the following platforms.

1. All of the programs in this example will compile and execute on Windows/XP System using Micro Focus Net Express 5.0 with the Server for Mainframe Migration option.
2. May be ported to run on the UNIX platforms supported by Micro Focus COBOL.

The batch application that prints the mailing labels and the on-line application for Customer File Maintenance are not included in the Z-Pack for this example. These may be downloaded from the SimoTime Web Site as separate examples.

The compare program used in this example uses the SIMOLOGS and SIMODUMP programs of the SimoMODS package. These may be downloaded from the SimoTime Web Site.

For more information refer to the  Downloads and Links to Similar Pages  of this document.

JCL for Execution with Mainframe Express or Mainframe
(Next) (Previous) (Table-of-Contents)

This section describes the JCL members (or Mainframe Job Control Language) used in this suite of sample programs.

JCL, Create a Record Sequential File with Customer Data using IEBGENER
(Next) (Previous) (Table-of-Contents)

The following member (CUSC80J1.JCL) is a two (2) step job. The first step will use IEFBR14 with a DD statement to delete a file that was created by a previous execution of this job. The second step will use IEBGENER and in-line data to create a sequential file of 80-byte records with customer information.

//CUSC80J1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2008 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Create a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* The first job step (QSAMDELT) will delete any previously created
//* file. The second job step (QSAMCRT1) will create a new file.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//*                      ************
//*                      * QUSC80J1 *
//*                      ********jcl*
//*                           *
//*                           *
//*                      ************     ************
//*                      * IEFBR14  ******* CUST0080 *
//*                      ********utl*     ***delete***
//*                           *
//*                           *
//*     ************     ************     ************
//*     *  SYSIN   ******* IEBGENER ******* CUST0080 *
//*     ********jcl*     ********utl*     *******qsam*
//*                           *
//*                           *
//*                      ************
//*                      *   EOJ    *
//*                      ************
//*
//* *******************************************************************
//* Step   1 of 2  Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//CUST0080 DD  DSN=SIMOTIME.DATA.CUST0080,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 QSAM file...
//*
//QSAMCRT1 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
//SYSUT1   DD  *
000100 Anderson       Adrian    1113 Peachtree Plaza    Atlanta        GA 26101
000200 Brown          Billie    224 Baker Boulevard     Baltimore      MD 35702
000300 Carson         Cameron   336 Crenshaw Blvd.      Cupertino      CA 96154
000400 Davidson       Dion      448 Main Street         Wilmington     DE 27323
000500 Everest        Evan      55 5TH Avenue           New York       NY 10341
000600 Franklin       Francis   6612 66TH Avenue        Bedrock        NY 11903
000700 Garfunkel      Gwen      777 77TH Street         New York       NY 16539
000800 Harrison       Hilary    888 88TH Street         Pocatello      ID 79684
000900 Isley          Isabel    999 99TH Avenue         Indianapolis   IN 38762
001000 Johnson        Jamie     1010 Paradise Drive     Larkspur       CA 90504
001100 Kemper         Kelly     1111 Oak Circle         Kansas City    KS 55651
001200 Lemond         Lesley    1212 Lockwood Road      Mohave Desert  AZ 80303
001300 Mitchell       Marlow    1313 Miller Creek Road  Anywhere       TX 77123
001400 Newman         Noel      1414 Park Avenue        Santa Monica   CA 90210
001500 Osborn         Owen      1515 Center Stage       Rolling Rock   PA 36613
001600 Powell         Pierce    PO Box 1616             Ventura        CA 97712
001700 Quigley        Quincy    1717 Farm Hill Road     Oshkosh        WI 43389
001800 Ripley         Ray       1818 Alien Lane         Wayout         KS 55405
001900 Smith          Sammy     1919 Carnoustie Drive   Novato         CA 94919
002000 Tucker         Taylor    2020 Sanger Lane        St. Paul       MN 43998
002100 Underwood      Ulysses   2121 Wall Street        New York       NY 17623
002200 Van Etten      Valerie   2222 Vine Street        Hollywood      CA 98775
002300 Wilson         Wiley     2323 Main Street        Boston         MA 01472
002400 Xray           Xavier    2424 24TH Street        Nashville      TN 44190
002500 Young          Yanni     2525 Yonge Street       Toronto        ON 6B74A6
002600 Zenith         Zebulon   2626 26TH Street        Dallas         TX 71922
123456 Doe            John      123 Main Street         Anywhere       OR 88156
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.CUST0080,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//

JCL, Delete the VSAM Cluster for the Customer Master File
(Next) (Previous) (Table-of-Contents)

The following member (CUSDELJ1.JCL) is a one (1) step job. The job will use IDCAMS to delete the VSAM cluster for the Customer Master File.

//CUDDELJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2008 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//* Subject: JCL to delete a VSAM Data Set using the IDCAMS Utility   *
//* Author:  SimoTime Enterprises                                     *
//* Date:    January 1, 1998                                          *
//*-------------------------------------------------------------------*
//* The following example is more than what is usually required to    *
//* delete a VSAM Data Set. However, the purpose is to illustrate the *
//* functions of the IDCAMS utility.                                  *
//*  PURGE: A VSAM Data Set may be date-protected. The DEFINE Cluster *
//*         has the option of specifying a retention date. If this    *
//*         retention date has not expired then the PURGE option will *
//*         be required in order to delete the data set.              *
//*         The default is NOPURGE.                                   *
//*  ERASE: The standard operation by the VSAM DELETE is to delete    *
//*         the catalog entry of the cluster and mark the space used  *
//*         by the cluster as reclaimable. The data contents of the   *
//*         cluster is no longer generally available but it is still  *
//*         present until the area is reused. This introduces a       *
//*         potential problem or security exposure for sensitive data.*
//*         The information could be retrieved using some special     *
//*         class of DUMP/RESTORE utilities that are often used by    *
//*         data center staff. The ERASE function will write over the *
//*         data area used by the cluster and the original data is    *
//*         destroyed. The default is NOERASE.                        *
//*********************************************************************
//*
//         EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 DELETE    SIMOTIME.DATA.CUSTMAST   -
           FILE (CUSTMAST)          -
           PURGE                    -
           ERASE                    -
           CLUSTER
 SET       MAXCC = 0
/*

JCL, Define a VSAM Cluster for the Customer Master File
(Next) (Previous) (Table-of-Contents)

The following member (CUSCRTJ1.JCL) is a one (1) step job. The job will use IDCAMS to create the VSAM cluster for the Customer Master File.

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

JCL, Update the Customer Master File using Information from the Sequential File
(Next) (Previous) (Table-of-Contents)

The following member (CUSI80J1.JCL) is a one (1) step job that uses a COBOL program to read a sequential file, reformat the data (i.e. six byte key to twelve byte key) and populate the Customer Master File that is an EBCDIC-encoded VSAM, Key-Sequenced-Data-Set (KSDS).

//CUSI80J1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2008 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text    - Read 80-Byte input and populate a VSAM, KSDS.
//* Author  - SimoTime Enterprises
//* Date    - November 24, 2004
//* Version - 07.01.22
//*
//* This job uses a COBOL program to read a sequential file.
//* The sequential file is then used as input to update the KSDS.
//*
//* *******************************************************************
//* Step   1 of 1  Delete previous files.
//*
//*
//STEP010  EXEC PGM=CUSI80C1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//CUST0080 DD  DSN=SIMOTIME.DATA.CUST0080,
//             DISP=SHR
//CUSTMAST DD  DSN=SIMOTIME.DATA.CUSTMAST,
//             DISP=SHR
//SYSOUT   DD  SYSOUT=*
//*

JCL, Print Four Across Mailing Labels
(Next) (Previous) (Table-of-Contents)

The following member (STAMLRJ1.JCL) is a four (4) step job. The first step is housekeeping to clean up any work files left from a previous execution of this job. The second step uses a COBOL program to read the Customer Master File and extract records that have a non-P.O. Box address to a Record Sequential file. The third step uses the SORT utility program to sort the sequential file into a new sequential file in Postal Code sequence. The fourth step uses a COBOL program to read the sorted file and create an output file of four-across mailing labels.. that uses a COBOL program to read a sequential file, reformat the data (i.e. six byte key to twelve byte key) and populate the Customer Master File that is an EBCDIC-encoded VSAM, Key-Sequenced-Data-Set (KSDS).

JCL, Read Customer Master File and Reproduce a Sequential File using IDCAMS
(Next) (Previous) (Table-of-Contents)

The following member (CUSK2RJ1.JCL) is a two (2) step job. The first step will use IEFBR14 with a DD statement to delete a file that was created by a previous execution of this job. The second step will use IDCAMS and the REPRO function to read the Customer Master File and create a sequential file with the same record structure. and content.

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

CMD for Execution with Net Express and Windows
(Next) (Previous) (Table-of-Contents)

This section describes the CMD or Windows Command Files used in this suite of sample programs.

CMD, FTP a Sequential File from a Mainframe System to Windows System
(Next) (Previous) (Table-of-Contents)

The following is the FTP statements required to transfer a Record Sequential file from a Mainframe System to a Windows System. The FTP Utility program will download the EBCDIC-encoded, Record-Sequential file from the Mainframe System to the Windows System in BINARY mode.

userid
Password
CD ..
PWD
BINARY
GET  SIMOTIME.DATA.ZDDFSE01  C:\MFI01\FTPLIB01\ZDDFSE01.DAT
QUIT

CMD, Convert EBCDIC-encoded, Record Sequential File to an ASCII-encoded Indexed File
(Next) (Previous) (Table-of-Contents)

The following member (CUREKAE1.CMD) is the Windows Command File that will use the FTP Utility program to download the EBCDIC-encoded, Record-Sequential file from the Mainframe System to the Windows System.

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2008 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read EBCDIC Customer Master, write ASCII Customer Master.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read an EBCDIC-encoded Customer Master File and write
rem  * write to a new ASCII-encoded Customer Master File.
rem  *
rem  *    ************
rem  *    * CUREKAE1 *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    * Env1PROD *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    * SimoNOTE *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    *   RUN    *****************************
rem  *    ********rts*                           *
rem  *         *           ************     ************     ************
rem  *         *           * CUSRE512 ******* CUREKAC1 ******* CUSKS512 *
rem  *         *           *******rseq*     ********cbl*     *******ksds*
rem  *    ************
rem  *    *   EOJ    *
rem  *    ************
rem  *
rem  * *******************************************************************
rem  * Step 1, Set Environment Variables
rem  *         Delete any previously created ASCII-encoded file...
rem  *
     call Env1PROD
     set CmdName=CUSE2AE1
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
     call SimoNOTE "Identify JobStep Step-1, Housekeeping tasks"
     set CUSRE512=%BaseLib1%\DataLibE\DYN1\SIMOTIME.DATA.CUSR512.DAT
     set CUSKS512=%BaseLib1%\DataLibA\Wrk1\SIMOTIME.DATA.CUSKS12.DAT
     if exist %CUSKS512% del %CUSKS512%
rem  *
rem  * *******************************************************************
rem  * Step 2, Read EBCDIC-encoded KSDS, create a new ASCII-encoded KSDS
rem  *
     call SimoNOTE "Identify JobStep Step-2, Execute EBCDIC to ASCII Conversion"
     run CUREKAC1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto EojNOK
     if exist %CUSKS512% goto EojAOK
     set JobStatus=0020
     goto EojNOK
:EojAOK
     call SimoNOTE "Produced  %CUSKS512%"
     call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNOK
     call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus%"
     echo %DATE% - %TIME% Starting User ABEND Processing...>>%SYSLOG%
     set >>%SYSLOG%
     echo %DATE% - %TIME% Complete User ABEND Processing...>>%SYSLOG%
     goto :End
:End
     call SimoNOTE "Conclude SysOut is %SYSOUT%"
     if not "%1" == "nopause" pause
     exit /B %JobStatus%

CMD, Compare Two Data Files
(Next) (Previous) (Table-of-Contents)

The following member (CUP303E1.CMD) is the Windows Command File that will use a COBOL program to compare the contents of two data files. The files contain records that are defined by the copy file for the Customer Master File (CUSTCB01.CPY).

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2008 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read a file of JUSTIFY info, do justify, write output.
rem  * Author - SimoTime Enterprises
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  * *******************************************************************
rem  * Step   1   Set the environment...
rem  *
     call Env1PROD
     set CmdName=CUP303E1
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%"
     set CUACTUAL=%BaseLib1%\DataLibA\Dyn1\SIMOTIME.DATA.CUSTMAST.DAT
     set CUEXPECT=%BaseLib1%\DataLibE\Dyn1\SIMOTIME.DATA.CUSTMAST.DAT
rem  *
rem  * *******************************************************************
rem  * Step   2   Edit input, create a new output file...
rem  *
     run CUP303C1
     if not ERRORLEVEL = 0 set JobStatus=0001
     if not %JobStatus% == 0000 goto :EojNok
rem  *
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     call SimoNOTE "Conclude SysLog is %SYSLOG%"
     if not "%1" == "nopause" pause

CMD, Create Comma Separated Values File from Customer Master File
(Next) (Previous) (Table-of-Contents)

The creation of a sequential file with the records structured to a Comma Separated Values format is done in two (2) steps in order to take advantage of a COBOL program that runs on the mainframe. On the mainframe a COBOL program reads the Customer Master File and creates a record sequential file. This record sequential file may be downloaded to a Windows system using FTP in ASCII mode. This will convert an EBCDIC-encoded Record Sequential file into an ASCII-encoded Line Sequential (or ASCII/Text) file that can easily be imported into an Excel spreadsheet.

If the COBOL program that runs on the mainframe is transferred to a Windows system and compiled with Micro Focus COBOL running on Windows it will still create a Record Sequential file. Rather than modify the program a second program is used to read the Record Sequential file and write to a new Line Sequential file. This second program performs the same function as the FTP file transfer in ASCII mode accomplished.

CMD, Read Customer Master File and write to Record Sequential File with CSV Formatted Records
(Next) (Previous) (Table-of-Contents)

The following member (CUSCSVE1.CMD) is the Windows Command File that will use a COBOL program to read the Customer Master File and create a record sequential file with the records structured to a Comma Separated Values format.

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2008 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read Customer Master File, write ASCII-Record-Sequential.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read the Customer Master File and write to a Line
rem  * Sequential file with records formatted with Comma Separated Values.
rem  *
rem  * *******************************************************************
rem  * Step   1   Delete any previously created file...
rem  *
     call Env1PROD
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
     set CmdName=CusCsvE1
rem  *
     call SimoNOTE "*******************************************************%CmdName%.CMD"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
:DeleteQSAM
     call SimoNOTE "Identify JobStep DeleteQSAM"
     set CUSTMAST=%BaseLib1%\DataLibA\Dyn1\SIMOTIME.DATA.CUSTMAST.DAT
     set CUSTRCSV=%BaseLib1%\DataLibA\Dyn1\SIMOTIME.DATA.CUSTRCSV.DAT
     if exist %CUSTRCSV% del %CUSTRCSV%
rem  *
rem  * *******************************************************************
rem  * Step   2   Edit input, create a new output file...
rem  *
:ExecuteFileFormatConversion
     call SimoNOTE "Identify JobStep ExecuteFileFormatConversion
     run CUSCSVC1
     echo %errorlevel%
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto EojNOK
     if exist %CUSTRCSV% goto EojAOK
     set JobStatus=0020
     goto EojNOK
:EojAOK
     call SimoNOTE "Produced %CUSTRCSV%"
     call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus%"
     goto End
:EojNOK
     call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus%"
     echo %DATE% - %TIME% Starting User ABEND Processing...>>%SYSLOG%
     set >>%SYSLOG%
     echo %DATE% - %TIME% Complete User ABEND Processing...>>%SYSLOG%
     goto End
:End
     call SimoNOTE "Conclude SysOut is %SYSOUT%"
     if not "%1" == "nopause" pause
     exit /B %JobStatus%

CMD, Read Record Sequential File with CSV Formatted Records and Write ASCII/Text File
(Next) (Previous) (Table-of-Contents)

The following member (CUSCSVE2.CMD) is the Windows Command File that will use a COBOL program to read the record sequential file and create a line sequential file with the records structured to a Comma Separated Values format.

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2008 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read ASCII-Record-Sequential, write ASCII/Text file.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read a Record Sequential File and write to a Line
rem  * Sequential file.
rem  *
rem  *    ************
rem  *    * CUSCSVE2 *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************     ************     ************
rem  *    *   run    ******* SIMOLOGS ******* CONSOLE  *
rem  *    ********rts*  *  ********cbl*  *  ************
rem  *         *        *                *
rem  *         *        *                *  ************
rem  *         *        *                ****  SYSLOG  *
rem  *         *        *                   ********txt*
rem  *         *        *
rem  *         *        **************************
rem  *         *                                 *
rem  *         *           ************     ************     ************
rem  *         *           * Dat01KRS ******* R2L01KC1 ******* Dat01KLS *
rem  *         *           ********dat*     ********cbl*     ********csv*
rem  *         *
rem  *    ************
rem  *    *   EOJ    *
rem  *    ************
rem  *
rem  * *******************************************************************
rem  * Step   1   Delete any previously created file...
rem  *
     call Env1PROD
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
     set CmdName=R2L01KE2
rem  *
     call SimoNOTE "*******************************************************%CmdName%.CMD"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
:DeleteQSAM
     call SimoNOTE "Identify JobStep DeleteQSAM"
     set Dat01KRS=%BaseLib1%\DataLibA\Dyn1\SIMOTIME.DATA.CUSTRCSV.DAT
     set Dat01KLS=%BaseLib1%\DataLibA\Wrk1\SIMOTIME.DATA.CUSTLCSV.CSV
     if exist %Dat01KLS% del %Dat01KLS%
rem  *
rem  * *******************************************************************
rem  * Step   2   Edit input, create a new output file...
rem  *
:ExecuteFileFormatConversion
     call SimoNOTE "Identify JobStep ExecuteFileFormatConversion
     run R2L01KC1
     echo %errorlevel%
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto EojNOK
     if exist %Dat01KLS% goto EojAOK
     set JobStatus=0020
     goto EojNOK
:EojAOK
     call SimoNOTE "Produced %Dat01KLS%"
     call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus%"
     goto End
:EojNOK
     call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus%"
     echo %DATE% - %TIME% Starting User ABEND Processing...>>%SYSLOG%
     set >>%SYSLOG%
     echo %DATE% - %TIME% Complete User ABEND Processing...>>%SYSLOG%
     goto End
:End
     call SimoNOTE "Conclude SysOut is %SYSOUT%"
     if not "%1" == "nopause" pause
     exit /B %JobStatus%

The COBOL Demonstration Programs
(Next) (Previous) (Table-of-Contents)

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

COBOL, Update the Customer Master File using Information from a Sequential File
(Next) (Previous) (Table-of-Contents)

The following program (CUSI80C1.CBL) will read a sequential file, reformat the data (i.e. six byte key to twelve byte key) and populate the Customer Master File that is a VSAM, Key-Sequenced-Data-Set (KSDS).

       IDENTIFICATION DIVISION.
       PROGRAM-ID.     CUSI80C1.
       AUTHOR.        SIMOTIME ENTERPRISES.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2007-11-05  Generation Time: 23:39:52:81    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  INPUT     CUST0080 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *  OUTPUT    CUSTMAST INDEXED       VARIABLE   00512    00001   *
      *                                              00012    00012   *
      *                                                               *
      *            Translation Mode is ASCII to ASCII                 *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT CUST0080-FILE  ASSIGN TO       CUST0080
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS CUST0080-STATUS.
           SELECT CUSTMAST-FILE  ASSIGN TO       CUSTMAST
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS RANDOM
                  RECORD KEY    IS CUSTMAST-PKEY-00001-00012
                  FILE STATUS   IS CUSTMAST-STATUS.

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

       FD  CUSTMAST-FILE
           DATA RECORD    IS CUSTMAST-REC
           .
       01  CUSTMAST-REC.
           05  CUSTMAST-PKEY-00001-00012        PIC X(00012).
           05  CUSTMAST-DATA-00013-00500        PIC X(00500).

      *****************************************************************
      * This program was created using the SYSMASK2.TXT file as input.*
      *                                                               *
      * The SYSMASK2 provides for the sequential reading of the input *
      * file and the random writing of the output file.               *
      *                                                               *
      * If the output file is indexed then the input file does not    *
      * need to be in sequence by the field that will be used to      *
      * provide the key for the output file.                          *
      *                                                               *
      * New records will be added and existing records will be        *
      * updated. If duplicate keys are provided from the input file   *
      * then only the information from the last duplicate key record  *
      * of the input file will be reflected in the output file.       *
      *                                                               *
      * This program mask will have the ASCII/EBCDIC table inserted   *
      * for use by the /TRANSLATE function of SimoZAPS.               *
      *                                                               *
      * For additional information contact SimoTime Enterprises.      *
      *                                                               *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CUSI80C1 '.
           05  T2 pic X(34) value 'File Copy and Reformatting, 80/512'.
           05  T3 pic X(10) value ' v07.11.04'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CUSI80C1 '.
           05  C2 pic X(20) value 'Created by SimoZAPS,'.
           05  C3 pic X(20) value '  a utility package '.
           05  C4 pic X(28) value 'of SimoTime Enterprises, LLC'.

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

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

       01  CUST0080-LRECL    pic 9(5)    value 00080.
       01  CUSTMAST-LRECL    pic 9(5)    value 00512.

      *****************************************************************
      * 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 '* CBL512C1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

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

       01  CUST0080-TOTAL.
           05  CUST0080-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Read count for CUST0080'.

       01  CUSTMAST-TOTAL-ADDS.
           05  CUSTMAST-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(17)   value 'Adds for CUSTMAST'.
       01  CUSTMAST-TOTAL-UPDATES.
           05  CUSTMAST-UPD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(20)   value 'Updates for CUSTMAST'.


      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT
           perform CUST0080-OPEN
           perform CUSTMAST-OPEN

           perform UNTIL CUST0080-EOF = 'Y'
               if  CUST0080-EOF = 'N'
                   perform CUST0080-READ
                   if  CUST0080-EOF = 'N'
                       add 1 to CUST0080-RDR
                       perform BUILD-OUTPUT-RECORD
                       perform CUSTMAST-READ
                       perform BUILD-OUTPUT-RECORD
                       if  CUSTMAST-RECORD-FOUND = 'Y'
                           add 1 to CUSTMAST-UPD
                           perform CUSTMAST-REWRITE
                       else
                           add 1 to CUSTMAST-ADD
                           perform CUSTMAST-WRITE
                       end-if
                   end-if
               end-if
           end-perform.

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

           move CUSTMAST-TOTAL-ADDS to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           move CUSTMAST-TOTAL-UPDATES to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           if  APPL-EOF
               move 'is Complete...' to MESSAGE-TEXT
           else
               move 'is ABENDING...' to MESSAGE-TEXT
           end-if
           perform Z-DISPLAY-MESSAGE-TEXT

           perform CUSTMAST-CLOSE
           perform CUST0080-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *>   TransMODE is A2A...
      *>   TransINIT process...
           move ALL SPACES to CUSTMAST-REC
      *>   TransCOPY...
           move CUST0080-REC(00001:00006) to CUSTMAST-REC(00007:00006)
      *>   TransCOPY...
           move CUST0080-REC(00008:00015) to CUSTMAST-REC(00014:00015)
      *>   TransCOPY...
           move CUST0080-REC(00023:00010) to CUSTMAST-REC(00042:00010)
      *>   TransCOPY...
           move CUST0080-REC(00033:00024) to CUSTMAST-REC(00082:00024)
      *>   TransCOPY...
           move CUST0080-REC(00057:00015) to CUSTMAST-REC(00178:00015)
      *>   TransCOPY...
           move CUST0080-REC(00072:00003) to CUSTMAST-REC(00206:00003)
      *>   TransCOPY...
           move CUST0080-REC(00075:00006) to CUSTMAST-REC(00234:00006)
      *>   TransFILL...
           move
           '000000'
           to CUSTMAST-REC(00001:00006)
      *>   TransFILL...
           move
           X'0000250F'
           to CUSTMAST-REC(00300:00004)
           exit.

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

      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       CUSTMAST-WRITE.
           if  CUSTMAST-OPEN-FLAG = 'C'
               perform CUSTMAST-OPEN
           end-if
           write CUSTMAST-REC
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  CUSTMAST-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 CUSTMAST' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-REWRITE.
           if  CUSTMAST-OPEN-FLAG = 'C'
               perform CUSTMAST-OPEN
           end-if
           rewrite CUSTMAST-REC
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  CUSTMAST-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 'REWRITE Failure with CUSTMAST' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open I-O CUSTMAST-FILE
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to CUSTMAST-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with CUSTMAST' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-READ.
           move 'N' to CUSTMAST-RECORD-FOUND
           move 'N' to CUSTMAST-EOF
           add  12  to ZERO giving APPL-RESULT
           read CUSTMAST-FILE
           evaluate CUSTMAST-STATUS
               when '00'   move 'Y' to CUSTMAST-RECORD-FOUND
                           subtract APPL-RESULT from APPL-RESULT
               when '23'   move 'N' to CUSTMAST-RECORD-FOUND
                           subtract APPL-RESULT from APPL-RESULT
               when '10'   move 'N' to CUSTMAST-RECORD-FOUND
                           move 'Y' to CUSTMAST-EOF
                           subtract APPL-RESULT from APPL-RESULT
           end-evaluate.
           if  APPL-AOK
               CONTINUE
           else
               move 'READ Failure with CUSTMAST' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close CUSTMAST-FILE
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to CUSTMAST-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with CUSTMAST' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTMAST-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 Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2007-11-05  Generation Time: 23:39:52:82    *
      *****************************************************************

COBOL, Convert Record Sequential, EBCDIC File to a Keyed-Indexed, ASCII File
(Next) (Previous) (Table-of-Contents)

The following programs will read an EBCDIC-encoded, Record Sequential file and update (or add records to) the Customer Master File that is an ASCII-encoded, VSAM, Key-Sequenced-Data-Set (KSDS). The mainline or primary program does the file I/O and calls a COBOL routine to do the conversion of the individual records. The secondary or called program does the conversion of the record at the filed level based on the copy file definition.

The following two (2) sections of this document describes the mainline and secondary programs used to do the file format and file content conversion.

COBOL, Mainline Program for File I/O with Call to Routine for Record Content Conversion
(Next) (Previous) (Table-of-Contents)

The following program (CUREKAC1.CBL) will read an EBCDIC-encoded, Record Sequential file and update existing records or add new records to the Customer Master File that is an ASCII-encoded, VSAM, Key-Sequenced-Data-Set (KSDS). This program does the file I/O and calls a second program to do the conversion of the records at the field level based on the copy file definition.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.     CUREKAC1.
       AUTHOR.        SIMOTIME ENTERPRISES.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2007-11-06  Generation Time: 15:44:22:93    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  INPUT     CUSRE512 SEQUENTIAL    FIXED      00512            *
      *                                                               *
      *  OUTPUT    CUSKS512 INDEXED       VARIABLE   00512    00001   *
      *                                              00512    00012   *
      *                                                               *
      *                Translation Mode is UNKNOWN                    *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT CUSRE512-FILE  ASSIGN TO       CUSRE512
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS CUSRE512-STATUS.
           SELECT CUSKS512-FILE  ASSIGN TO       CUSKS512
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS SEQUENTIAL
                  RECORD KEY    IS CUSKS512-PKEY-00001-00012
                  FILE STATUS   IS CUSKS512-STATUS.

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

       FD  CUSKS512-FILE
           DATA RECORD    IS CUSKS512-REC
           .
       01  CUSKS512-REC.
           05  CUSKS512-PKEY-00001-00012        PIC X(00012).
           05  CUSKS512-DATA-00013-00500        PIC X(00500).

      *****************************************************************
      * This program was created using the SYSMASK3.TXT file as the   *
      * template for the File I/O. It is intended for use with the    *
      * TransCALL facility that makes a call to a routine that does   *
      * the actual conversion between EBCDIC and ASCII. For more      *
      * information or questions contact SimoTime Enterprises.        *
      *                                                               *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      * The SYSMASK3 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.                                          *
      *                                                               *
      * If the key field is not in sequence then refer to SYSMASK4    *
      * to provide for a random add or update of the indexed file.    *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CUREKAC1 '.
           05  T2 pic X(34) value 'Convert CUSRE512 EBCDIC to ASCII  '.
           05  T3 pic X(10) value ' v07.11.04'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CUREKAC1 '.
           05  C2 pic X(20) value 'Created by SimoZAPS,'.
           05  C3 pic X(20) value '  a utility package '.
           05  C4 pic X(28) value 'of SimoTime Enterprises, LLC'.

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

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

       01  CUSRE512-LRECL    pic 9(5)    value 00512.
       01  CUSKS512-LRECL    pic 9(5)    value 00512.

      *****************************************************************
      * 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 '* CUREKAC1 '.
           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 'CUREKAC1'.

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

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

      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT
           perform CUSRE512-OPEN
           perform CUSKS512-OPEN

           perform until CUSRE512-STATUS not = '00'
               perform CUSRE512-READ
               if  CUSRE512-STATUS = '00'
                   add 1 to CUSRE512-RDR
                   perform BUILD-OUTPUT-RECORD
                   perform CUSKS512-WRITE
                   if  CUSKS512-STATUS = '00'
                       add 1 to CUSKS512-ADD
                   end-if
               end-if
           end-perform

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

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

           if  APPL-EOF
               move 'is Complete...' to MESSAGE-TEXT
           else
               move 'is ABENDING...' to MESSAGE-TEXT
           end-if
           perform Z-DISPLAY-MESSAGE-TEXT

           perform CUSKS512-CLOSE
           perform CUSRE512-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *>   TransCALL process...
           move CUSRE512-REC to CUSKS512-REC
           call 'CUREKAR1'                        using CUSKS512-REC
           add 00512 to ZERO giving CUSKS512-LRECL
           exit.

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

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