Customer File - VSAM, KSDS
Extract Fixed Field, Convert to CSV
  Table of Contents  v-24.01.01 - cusext01.htm 
  Introduction
  Abbreviations
  Possibilities and Considerations
  Job Scripts
  JCL Members
  Convert KSDS to RCSV
  Windows CMD Files
  Convert KSDS to RCSV
  Convert KSDS to LCSV
  The COBOL Program Members
  I/O Program, KSDS to RCSV
  Data Extract & Convert Routine
  I/O Program, KSDS to LCSV
  The Program Generation Process
  The Process Control File
  Record Structure, a Copy File
  HTML Document for Record Structure
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Contact or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This suite of sample programs describes how to extract data from the Customer Master File. The numeric fields will be expanded (Packed or Binary) and the trailing spaces within the text fields will be truncated. A new record will be constructed with the fields being concatenated and separated by a comma. The newly constructed record will be written to a sequential file. The file may now be transferred from the mainframe to a Windows system using the File Transfer Protocol (FTP) and easily imported into a Microsoft Excel spreadsheet, an Access Data Base or other SQL Data Bases.

The extract of data by fields within the record and the reformatting of the output records is actually accomplished with two COBOL programs. The first program does the File I/O of reading the Customer Master File and writing reformatted records to a sequential file. The File I/O program calls the second program to do the record formatting that expands the numeric fields and does blank truncation on the text fields and then places a comma between the fields as the field delimiter. The COBOL programs were generated using SimoTime technology.


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-2024
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section Abbreviations

This test case will be extracting data from a VSAM, KSDS. The extracted data will be converted and written to a sequential file. The extraction/conversion process will do a file format and a record content conversion. The following is a list of the abbreviations used when referring to the various file types and record structures.

The following table is a list of terms or abbreviations used within this document.

Abbreviation Description
CSV Comma Separated Values - refers to a record structure that contains a group of concatenated data fields or text strings. The fields are separated or delimited by a comma.
FFL Fixed Field Length - refers to a record structure that contains a group of concatenated data fields. Each field may contain text or binary data. Numeric values may be structured in a varielty of formats that include Binary, Packed-decimal or Zoned decimal. There are no field separator or field delimiter characters between the fields.
KSDS Keyed Sequential Data Set - This is a type of VSAM (Virtual Sequential Access Method) data set. Records are in collating sequence by a key field and alternate indexes are allowed.
Note: If the key field is alpha-numeric the collating sequence will be different between the EBCDIC-encoded and ASCII-encoded environments.
For additional information about VSAM refer to an internet reference at http://www.simotime.com/indexsam.htm or a local reference at indexsam.htm
LSEQ Line Sequential files are ASCII/Text files. Depending on how the file is created it may have fixed or variable length records. The separation of the individual records is maintained by the use of delimiter bytes between the records. For Windows this is usually a two byte value consisting of a Carriage-Return and Line-Feed (or CRLF), the hexadecimal notation is x'0D' and x'0A'. For UNIX systems this is usually a one byte value consisting of a Line-Feed (or LF), the hexadecimal notation is x'0A'.
The record content for Line Sequential files should be display or print text using the ASCII encoding format. Hence the name ASCII/Text files. These files should not contain packed or binary data strings.
RSEQ A Record Sequential file may contain fixed-length records or variable-length records. The record sequential files with fixed-length records are a series of concatenated records or data strings of a predefined length without record separator values between each record. The first byte of the first record starts at the first byte of the file.
A record sequential file with variable-length records is a series of concatenated records or data strings of varying lengths without record separator values between each record. Each record is preceded by a record descriptor word (RDW) that defines the length of the record that follows. A Micro Focus header record is placed at the start of the file when the file is created.
VSAM Virtual Sequential Access Method - A data access method used with IBM Mainframes running MVS, OS/390, z/OS and VSE/ESA operating systems. VSAM has been in use for over 30 years. The original VSAM had a 4-gigabyte limit for the size of data sets. IBM has enhanced VSAM to support record-level sharing and file sizes larger than 4 gigabytes. The current architectural limit varies according to the size of the data control intervals (CI's). For a 512-byte CI size, the maximum size is 2 terabytes; for a KSDS with a CI size of 32 kilobytes, the maximum size is 128 terabytes.
For additional information about VSAM refer to an internet reference at http://www.simotime.com/indexsam.htm or a local reference at indexsam.htm

Table of Contents Previous Section Next Section Possibilities and Considerations

When running this job on a Mainframe System the output file will be an EBCDIC-encoded, record-sequential file. The records will be concatenated fields of text strings separated (or delimited) by a comma. This file may be downloaded from the mainframe to a Windows system using FTP in ASCII mode. Since the output file is all text it will be properly converted from EBCDIC to ASCII during the file transfer (FTP) process. It will also be converted from a Record-Sequential file to a Line-Sequential file (Micro Focus terminology for ASCII/Text File). The file is now ready to import into an Excel spreadsheet, an Access Data Base or other SQL Data Bases.

When running the job on a Windows System with Micro Focus and using EBCDIC encoding the output file will be an EBCDIC-encoded, record-sequential file. The records will be concatenated fields of text strings separated (or delimited) by a comma. Since we no longer use the FTP process to transfer the file we no longer have the benefit of the FTP process doing the file-format and record-content conversion. Therefore, we need an alternative method for doing the file format conversion from record-sequential to line-sequential and the record content conversion from EBCDIC to ASCII. Refer to the File-Format and Record-Content Conversion Program for more information.

When running the job on a Windows System with Micro Focus and using ASCII encoding the output file will be an ASCII-encoded, record-sequential file. The records will be concatenated fields of text strings separated (or delimited) by a comma. Since we no longer use the FTP process to transfer the file and we no longer have the benefit of the FTP process doing the file-format conversion (since we are running in an ASCII-encoded configuration the file-content conversion is not a requirement). Therefore, we need an alternative method for doing the file format conversion from record-sequential to line-sequential. Refer to the File-Format Conversion Program for more information.

Table of Contents Previous Section Next Section Job Scripts

A job script may be defined as a text file containing job setup information followed by job steps that identify programs to be executed along with parameters unique to the job step. A job script may be created using a text editor. The naming of a job script is determined by the Operating System. A simple job script may contain a single job step that performs a single function. A typical job script will contain multiple job steps executed in a predefined sequence. The status of each job step may be tested at the end of each job step.

This document provides a brief overview of the Micro Focus File Formats available on Linux, UNIX or Windows Systems supported by Micro Focus.

Table of Contents Previous Section Next Section JCL Members

JCL Members are batch processing scripts that are intended to run on a Mainframe-Oriented System. The term Mainframe-Oriented refers to an actual IBM Mainframe, a Windows System with Micro Focus Mainframe Express or a Micro Focus Enterprise Server with the Mainframe Transaction Option and the Batch Facility.

Table of Contents Previous Section Next Section Convert KSDS to RCSV

The following (CUEXTJ01.jcl) is a listing of the JCL member needed to run this job in a Mainframe-Oriented environment.

//CUSEXTJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CUSEXTJ1.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Read Customer Master File, write to a sequential file
//* Author - SimoTime Technologies
//* Date   - January 01, 1989
//*
//* This set of programs will run on a mainframe under MVS or on
//* a Personal Computer running Windows and Mainframe Express by
//* Micro Focus.
//*
//*   ************                    ************
//*   *  Entry   *                    *  Entry   *
//*   *   MVS    *                    * Windows  *
//*   ************                    ************
//*        *                               *
//*   ************                    ************
//*   * CUSEXTJ1 *                    * CUSEXTE1 *
//*   ********jcl*                    ********cmd*
//*        *                               *
//*   ************                         *
//*   * IEFBR14  *                         *
//*   ********utl*                         *
//*        *                               *
//*        *********************************
//*                        *
//*                        *
//*   ************    ************    ************
//*   * CUSTMAST *----* CUSEXTC1 *----* CUSEXTSV *
//*   ************    ********cbl*    ********dat*
//*                        *   *
//*                        *   *
//*                        *   *---CALL----*
//*                        *               *
//*                        *               *
//*                        *          ************
//*                        *          * CUSEXTR1 *
//*                        *          ********cbl*
//*                        *
//*                   ************
//*                   *   EOJ    *
//*                   ************
//*
//* *******************************************************************
//* Step 1 of 2, This job step will delete a previously created file.
//*
//DELTSEQ1 EXEC PGM=IEFBR14
//CUSTRCSV DD  DSN=SIMOTIME.DATA.CUSTPHON,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=256,DSORG=PS)
//* *******************************************************************
//* Step 2 of 2, Execute the Sample program.
//*              Read the customer file (KSDS) and write a record of
//*              selected fields to a sequential file. Truncate spaces
//*              from each field and separate the fields by a comma.
//*
//CBLEXTS1 EXEC PGM=CUSEXTC1
//STEPLIB  DD  DSN=MFI01.SIMOPROD.LOADLIB1,DISP=SHR
//CUSTMAST DD  DSN=SIMOTIME.DATA.CUSTMAST,DISP=SHR
//CUSTRCSV DD  DSN=SIMOTIME.DATA.CUSTPHON,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=256,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section Windows CMD Files

Windows CMD Files are batch processing scripts that are intended to run on a Windows System. The job scripts may be executed from a Windows Command line or from Windows Explorer.

Table of Contents Previous Section Next Section Convert KSDS to RCSV

The following (CUSEXTW1.cmd) is a listing of the CMD member needed to run this job. This job will do a file format conversion from a VSAM, KSDS to a Record Sequential file. The programs will do a record content conversion from fixed-field length with packed data to a CSV record format with variable length fields. The numeric fields that use a packed-decimal or binary format will be converted to text fields.

@echo OFF
     set CmdName=CUSEXTW1
rem  * *******************************************************************
rem  *             Batch Job Script - a Windows Command File             *
rem  *                 Provided by SimoTime Technologies                 *
rem  *           (C) Copyright 1987-2019 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read Customer Master, write sequential CSV file.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read a Customer Master File (KSDS), extract data and
rem  * write to a record sequential (RSEQ) file that will contain all
rem  * text data with the fields separated by a comma.
rem  *
rem  * The packed and binary numbers will be expanded into text strings.
rem  *
rem  * The record sequential (RSEQ) file will then be converted to a
rem  * line sequential (LSEQ) or ASCII/text file.
rem  *
rem  *    ************
rem  *    * CUSEXTW1 *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    *  call    *****************************           * Job Step 1
rem  *    *******mifo*                           *
rem  *         *                                 *
rem  *         *                                 *
rem  *         *                                 *
rem  *         *                            ************
rem  *         *                            * ENV1BASE *
rem  *         *                            ********cmd*
rem  *         *
rem  *    ************
rem  *    *   run    *****************************           * Job Step 2
rem  *    *******mifo*                           *
rem  *         *                                 *
rem  *         *                                 *
rem  *         *           ************     ************     ************
rem  *         *           * CUSTMAST ******* CUSEXTC1 ******* CUSTRCSV *
rem  *         *           *******ksds*     ********cbl*     *******rseq*
rem  *         *                                 *
rem  *         *                            ************
rem  *         *                            * CUSEXTR1 *
rem  *         *                            ********cbl*
rem  *         *
rem  *    ************
rem  *    *   run    *****************************           * Job Step 3
rem  *    *******mifo*                           *
rem  *         *                                 *
rem  *         *                                 *
rem  *         *           ************     ************     ************
rem  *         *           * DAT256RS ******* R2L256C1 ******* DAT256LS *
rem  *         *           *******rseq*     ********cbl*     *******lseq*
rem  *         *
rem  *         *
rem  *    ************
rem  *    *   EOJ    *                                       * Job Step 4
rem  *    ************
rem  *
rem  * *******************************************************************
rem  * Step 1 of 4, Preparing the System and Job environment,
rem  *              Delete any previously created file...
rem  *
     call ..\ENV1BASE %CmdName%
     set JobStatus=0
     set SYSOUT=%BaseLib1%\LOGS\SYSOUT_%CmdName%.txt
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
     call SimoNOTE "Job_Step 1 of 4, Preparing the System and Job environment..."
     set CUSTMAST=%BaseLib1%\DATA\APPL\SIMOTIME.DATA.CUSTMAST.DAT
     set CUSTRCSV=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.CUSTRCSV.DAT
     if exist %CUSTRCSV% del %CUSTRCSV%
rem  *
rem  * *******************************************************************
rem  * Step 2 of 4, Extract Customer Info, create a new RSEQ file...
rem  *
     call SimoNOTE "Job_Step 2 of 4, Extract Customer Info, create a new RSEQ file..."
     call SimoNOTE "DataTake KSA CUSTMAST=%CUSTMAST% "
     call SimoNOTE "DataMake RSA CUSEXTSV=%CUSTRCSV% "
     run CUSEXTC1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0020
     if not "%JobStatus%" == "0" goto EOJTAG
     if not exist %CUSTRCSV% set JobStatus=0021
     if not "%JobStatus%" == "0" goto EOJTAG
rem  *
rem  * *******************************************************************
rem  * Step 3 of 4, Convert RSEQ file to LSEQ file...
rem  *
     call SimoNOTE "Job_Step 3 of 4, Convert RSEQ file to LSEQ file..."
     set EXTFH=C:\SimoSAM1\SysLibA1\EXTFHTAB.CFG
     set DAT256RS=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.CUSTRCSV.DAT
     set DAT256LS=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.DAT256LS.CSV
     if exist %DAT256LS% del %DAT256LS%
     run R2L256C1
     if not exist %CUSTRCSV% set JobStatus=0030
     if not "%JobStatus%" == "0" goto EOJTAG
     call SimoNOTE "DataTake RSA DAT256RS=%DAT256RS% "
     call SimoNOTE "DataMake TXT DAT256LS=%DAT256LS% "
rem  *
rem  * *******************************************************************
rem  * Step 4 of 4, End of Job processing...
rem  *
:EOJTAG
     call SimoNOTE "Job_Step 4 of 4, End of Job processing..."
     if not "%JobStatus%" == "0" goto EojNok
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus% "
     goto :EOJEND
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus% "
:EOJEND
     call SimoNOTE "Conclude SYSOUT is %SYSOUT%"
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section Convert KSDS to LCSV

The following (CUSEXTW5.cmd) is a listing of the CMD member needed to run this job. This job will do a file format conversion from a VSAM, KSDS to a Line Sequential or ASCII/Text file and the record content will be converted from fixed-field length with packed data to a CSV format with variable length fields. The numeric fields that use a packed-decimal or binary format will be converted to text fields.

@echo OFF
     set CmdName=CUSEXTW5
rem  * *******************************************************************
rem  *             Batch Job Script - a Windows Command File             *
rem  *                 Provided by SimoTime Technologies                 *
rem  *           (C) Copyright 1987-2019 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Read CUSTMAST and write to ASCII/Text using CSV format.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read a Customer Master File (KSDS), extract data and
rem  * write to a line sequential (RSEQ) or ASCII/Text file that will
rem  * contain all text data with the fields separated by a comma.
rem  * The packed and binary numbers will be expanded into text strings.
rem  *
rem  *    ************
rem  *    * CUSEXTW5 *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    *   run    *****************************
rem  *    *******mifo*                           *
rem  *         *                                 *
rem  *         *                                 *
rem  *         *                                 *
rem  *         *           ************     ************     ************
rem  *         *           * CUSTMAST ******* CUSEXTC5 ******* CUSTLCSV *
rem  *         *           *******ksds*     ********cbl*     *******lseq*
rem  *         *                                 *
rem  *         *                            ************
rem  *         *                            * CUSEXTR5 *
rem  *         *                            ********cbl*
rem  *         *
rem  *    ************
rem  *    *   EOJ    *
rem  *    ************
rem  *
rem  * *******************************************************************
rem  * Step 1 of 2, Set Environment Variables for File Names,
rem  *              Delete any previously created file...
rem  *
     call ..\Env1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting CmdName %CmdName%"
     call SimoNOTE "StepInfo Delete previously created file"
     set CUSTMAST=%BaseLib1%\DATA\APPL\SIMOTIME.DATA.CUSTMAST.DAT
     set CUSTLCSV=%BaseLib1%\DATA\WRK1\SIMOTIME.DATA.CUSTLCSV.CSV
     if exist %CUSTLCSV% del %CUSTLCSV%
rem  *
rem  * *******************************************************************
rem  * Step 2 of 2, Extract Customer Info, create a new LSEQ file...
rem  *
     call SimoNOTE "Identify JobStep ExecuteExtractRoutine"
     call SimoNOTE "DataTake KSA CUSTMAST=%CUSTMAST%"
     call SimoNOTE "DataMake LSA CUSEXTSV=%CUSTLCSV%"
     run CUSEXTC5
     if not ERRORLEVEL = 0 set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     call SimoNOTE "DataTake %CUSTMAST%"
     call SimoNOTE "DataMake %CUSTLCSV%"
rem  *
     if exist %CUSTLCSV% goto :EojAok
     set JobStatus=0020
     goto :EojNok
rem  *
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 COBOL Program Members

The following describes the COBOL Members included with this Test Case. The programs were compiled and tested on the following systems.

1. An IBM Mainframe System.
1.1. Operating System is ZOS.
1.2. COBOL Compiler is IBM Enterprise COBOL.
1.3. JCL Members were used for the Job Scripting.
2. A Microsoft Windows System with Micro Focus COBOL.
2.1. Operating System is Windows/7.
2.2. COBOL Compiler is Micro Focus Enterprise Developer.
2.3. CMD Files were used for the Job Scripting.
3. A Linux System with GnuCOBOL.
3.1. Operating System is Ubuntu with GnuCOBOL.
3.2. COBOL Compiler is GnuCOBOL.
3.3. Bash Members were used for the Job Scripting.

 

Note: The COBOL Source Code was generated on a Windows System using SimoTime Technologies. It was copied to other systems then compiled and executed. The same source code was used on each system.

Table of Contents Previous Section Next Section I/O Program, KSDS to RCSV

The following (CUSEXTC1.cbl) is the COBOL I/O program that was generated with SimoTime technology. The program was tested using Micro Focus Enterprise Server on Windows/XP. The program was successfully executed in both an EBCDIC and ASCII encoded configuration.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUSEXTC1.
       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: 2019-08-27  Generation Time: 13:29:17:13    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   CUSTMAST INDEXED       VARIABLE   00512    00001   *
      *                                              00012    00012   *
      *  SECONDARY CUSTRCSV SEQUENTIAL    FIXED      00256            *
      *                                                               *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT CUSTMAST-FILE  ASSIGN TO       CUSTMAST
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS SEQUENTIAL
                  RECORD KEY    IS CUSTMAST-PKEY-00001-00012
                  FILE STATUS   IS CUSTMAST-STATUS.
           SELECT CUSTRCSV-FILE  ASSIGN TO       CUSTRCSV
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS CUSTRCSV-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       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).

       FD  CUSTRCSV-FILE
           DATA RECORD    IS CUSTRCSV-REC
           .
       01  CUSTRCSV-REC.
           05  CUSTRCSV-DATA-01 PIC X(00256).

      *****************************************************************
      * 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 more information or questions please contact SimoTime     *
      * Technologies. The version control number is 16.01.01          *
      *                                                               *
      *        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 '* CUSEXTC1 '.
           05  T2 pic X(34) value 'Extract Customer Info to CSV RSEQ '.
           05  T3 pic X(10) value ' v19.00.00'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CUSEXTC1 '.
           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  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  CUSTRCSV-STATUS.
           05  CUSTRCSV-STATUS-L     pic X.
           05  CUSTRCSV-STATUS-R     pic X.
       01  CUSTRCSV-EOF              pic X       value 'N'.
       01  CUSTRCSV-OPEN-FLAG        pic X       value 'C'.

       01  CUSTMAST-LRECL            pic 9(5)    value 00512.
       01  CUSTRCSV-LRECL            pic 9(5)    value 00256.
       01  CUSTMAST-LRECL-MAX        pic 9(5)    value 00512.
       01  CUSTRCSV-LRECL-MAX        pic 9(5)    value 00256.

      *****************************************************************
      * 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(011)  value '* CUSEXTC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(068)  value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.
       01  MSG-LSB                 pic 9(5)    value 267.

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

       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   'Extract Customer Info to CSV RSEQ '.
           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  CUSTMAST-TOTAL.
           05  CUSTMAST-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for CUSTMAST'.
       01  CUSTRCSV-TOTAL.
           05  CUSTRCSV-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for CUSTRCSV'.

      *****************************************************************
       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 CUSTMAST-OPEN
           perform CUSTRCSV-OPEN

      *    USRSOJ Processing not specified...

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

      *    USREOJ Processing not specified...

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

           move CUSTRCSV-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 CUSTRCSV-CLOSE
           perform CUSTMAST-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    Extract CALL process...
           call 'CUSEXTR1'                        using CUSTRCSV-REC
                                                        CUSTMAST-REC
           add 00256 to ZERO giving CUSTRCSV-LRECL
           exit.

      *****************************************************************
      * I/O Routines for the INPUT File...                            *
      *****************************************************************
       CUSTMAST-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close CUSTMAST-FILE
           if  CUSTMAST-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 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.
           read CUSTMAST-FILE
           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
               if  APPL-EOF
                   move 'Y' to CUSTMAST-EOF
               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
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input 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.

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

      *****************************************************************
      * The following Z-ROUTINES provide administrative functions     *
      * for this program.                                             *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
       Z-CALCULATE-MESSAGE-LSB.
           add 267 to ZERO giving MSG-LSB
           perform until MSG-LSB < 80
                      or MESSAGE-BUFFER(MSG-LSB:1) not = SPACE
             if MESSAGE-BUFFER(MSG-LSB:1) = SPACE
                subtract 1 from MSG-LSB
             end-if
           end-perform
           exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           perform Z-CALCULATE-MESSAGE-LSB
           display MESSAGE-BUFFER(1:MSG-LSB)
           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: 2019-08-27  Generation Time: 13:29:17:15    *
      *****************************************************************

Table of Contents Previous Section Next Section Data Extract & Convert Routine

The following (CUSEXTR1.cbl) is a COBOL program that extracts the fields of data. The program expands the numeric fields and truncates the trailing spaces from text fields. Each record will contain a group of concatenated text strings separated by a comma. This record structure is commonly referred to as a Comma-Separated-Values or CSV Format.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUSEXTR1.
       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: 2019/08/27  Generation Time: 13:29:17:21    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  NGPU-07-00.
           05  NRPU-07-00  pic  9(07).
       01  NGBS-03-00.
           05  NRBS-03-00  pic S9(03)
                           SIGN LEADING SEPARATE.
       01  NGZS-02-03.
           05  NRZS-02-03  pic S9(02)V9(03)
                           SIGN LEADING SEPARATE.
       01  NGZU-03-00.
           05  NRZU-03-00  pic  9(03).

       01  IX-P1               pic 9(9)      value 0.
       01  IX-P2               pic 9(9)      value 0.
       01  IX-NP               pic 9(5)      value 0.
       01  IX-L1               pic 9(9)      value 0.
       01  RA-P1               pic 9(3)      value 0.
       01  RA-P2               pic 9(3)      value 0.
       01  COLUMN-NUMBER       pic 9(5)      value 0.
       01  WORK-AREA-X.
           05  WORK-AREA-X1    pic X         value '"'.
           05  WORK-AREA       pic X(00288)  value SPACES.
       01  WORK-AREA-X2        pic X(00256)  value SPACES.
       01  FRAME-STOP.
           05  FRAME-BYTE      pic X         value '"'.
           05  DELIMITER-BYTE  pic X         value ','.
       01  FRAME-FLAG          pic X         value 'N'.
       01  O-FLAG              pic X(3)      value 'CSV'.
       01  BYTE-Y              pic X         value 'Y'.
       01  BYTE-N              pic X         value 'N'.
       01  FRAME-COUNT         pic 9(5)      value 0.
       01  DELIM-COUNT         pic 9(5)      value 0.
       01  FFL-SIZE            pic 9(5)      value 0.
       01  CSV-SIZE            pic 9(5)      value 0.
       01  TXT-SIZE            pic 9(5)      value 0.
       01  LAST-NON-SPACE-BYTE pic 9(5)      value 0.
       01  SIGN-BYTE           pic X         value SPACE.
       01  DIG-POS             pic 9(3).
       01  DIG-LEN             pic 9(3).
       01  DIG-CTL             pic 9(3).
       01  DEC-POS             pic 9(3).
       01  DEC-LEN             pic 9(3).
       01  DEC-CTL             pic 9(3).
       01  DEC-POINT           pic 9(3).
       01  WRK-POS             pic 9(3).
      *
      *****************************************************************
       LINKAGE SECTION.
       01  REC1CALL-REC pic X(00256).
       COPY CUSTCB01.
      *
      *****************************************************************
       PROCEDURE DIVISION using REC1CALL-REC
                                CUST-RECORD.
      *
           add 1 to ZERO giving IX-NP
           move all SPACES
             to REC1CALL-REC
      *
      *    String Move, CUST-NUMBER
           add 00012 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-NUMBER to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-STATUS
           add 00001 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-STATUS to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-LAST-NAME
           add 00028 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-LAST-NAME to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-FIRST-NAME
           add 00020 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-FIRST-NAME to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-MID-NAME
           add 00020 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-MID-NAME to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-ADDRESS-1
           add 00048 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-ADDRESS-1 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-ADDRESS-2
           add 00048 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-ADDRESS-2 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-CITY
           add 00028 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-CITY to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-STATE
           add 00028 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-STATE to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-POSTAL-CODE
           add 00012 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-POSTAL-CODE to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-PHONE-HOME
           add 00018 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-PHONE-HOME to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-PHONE-WORK
           add 00018 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-PHONE-WORK to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-PHONE-CELL
           add 00018 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-PHONE-CELL to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Packed-UnSign move, CUST-CREDIT-LIMIT
           add 00007 to ZERO giving FFL-SIZE
           if CUST-CREDIT-LIMIT is NUMERIC
              add CUST-CREDIT-LIMIT to ZERO giving NRPU-07-00
           else
              move ZERO to NRPU-07-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGPU-07-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-Signed move, CUST-DISCOUNT-CODE(1)
           add 00004 to ZERO giving FFL-SIZE
           add CUST-DISCOUNT-CODE(1) to ZERO giving NRBS-03-00
           move SPACES to WORK-AREA-X2
           move NGBS-03-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Number-Signed move, CUST-DISCOUNT-RATE(1)
           add 00007 to ZERO giving FFL-SIZE
           if CUST-DISCOUNT-RATE(1) is NUMERIC
              add CUST-DISCOUNT-RATE(1) to ZERO giving NRZS-02-03
           else
              move ZERO to NRZS-02-03
           end-if
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGZS-02-03(01:01) to WORK-AREA-X2(01:01)
           move NGZS-02-03(02:02) to WORK-AREA-X2(02:02)
           move '.'               to WORK-AREA-X2(04:1)
           move NGZS-02-03(04:03) to WORK-AREA-X2(05:03)
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-DISCOUNT-DATE(1)
           add 00008 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-DISCOUNT-DATE(1) to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-Signed move, CUST-DISCOUNT-CODE(2)
           add 00004 to ZERO giving FFL-SIZE
           add CUST-DISCOUNT-CODE(2) to ZERO giving NRBS-03-00
           move SPACES to WORK-AREA-X2
           move NGBS-03-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Number-Signed move, CUST-DISCOUNT-RATE(2)
           add 00007 to ZERO giving FFL-SIZE
           if CUST-DISCOUNT-RATE(2) is NUMERIC
              add CUST-DISCOUNT-RATE(2) to ZERO giving NRZS-02-03
           else
              move ZERO to NRZS-02-03
           end-if
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGZS-02-03(01:01) to WORK-AREA-X2(01:01)
           move NGZS-02-03(02:02) to WORK-AREA-X2(02:02)
           move '.'               to WORK-AREA-X2(04:1)
           move NGZS-02-03(04:03) to WORK-AREA-X2(05:03)
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-DISCOUNT-DATE(2)
           add 00008 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-DISCOUNT-DATE(2) to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-Signed move, CUST-DISCOUNT-CODE(3)
           add 00004 to ZERO giving FFL-SIZE
           add CUST-DISCOUNT-CODE(3) to ZERO giving NRBS-03-00
           move SPACES to WORK-AREA-X2
           move NGBS-03-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Number-Signed move, CUST-DISCOUNT-RATE(3)
           add 00007 to ZERO giving FFL-SIZE
           if CUST-DISCOUNT-RATE(3) is NUMERIC
              add CUST-DISCOUNT-RATE(3) to ZERO giving NRZS-02-03
           else
              move ZERO to NRZS-02-03
           end-if
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGZS-02-03(01:01) to WORK-AREA-X2(01:01)
           move NGZS-02-03(02:02) to WORK-AREA-X2(02:02)
           move '.'               to WORK-AREA-X2(04:1)
           move NGZS-02-03(04:03) to WORK-AREA-X2(05:03)
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-DISCOUNT-DATE(3)
           add 00008 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-DISCOUNT-DATE(3) to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-LADATE
           add 00008 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-LADATE to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, CUST-LATIME
           add 00008 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move CUST-LATIME to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Number-UnSign move, CUST-TOKEN
           add 00003 to ZERO giving FFL-SIZE
           if CUST-TOKEN is NUMERIC
              add CUST-TOKEN to ZERO giving NRZU-03-00
           else
              move ZERO to NRZU-03-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGZU-03-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
           GOBACK.
      *
      *****************************************************************
       POST-TEXT-TO-CSV.
      *    This routine does a left-to-right scan of the content
      *    of a fixed-field. It accumulates counters for the
      *    embedded Frame or Delimiter bytes.
      *    If embedded Frame or Delimiters bytes exist in the
      *    text string within a field then the text string will
      *    be formated as it is moved to the output buffer.
      *    The data in the output buffer will start and end with
      *    a Frame byte
      *    Embedded Frame bytes will be preceded by a Frame byte
      *    and embedded Delimiter bytes will be treated as data
      *    within the output text string.
      *****************************************************************
           add 1 to ZERO giving IX-P1
           add 1 to ZERO giving IX-P2
           move ZERO to FRAME-COUNT
           move ZERO to DELIM-COUNT
           move ZERO to LAST-NON-SPACE-BYTE
           move SPACES to WORK-AREA
           perform until IX-P1 > FFL-SIZE
               move WORK-AREA-X2(IX-P1:1) to WORK-AREA(IX-P2:1)
               if  WORK-AREA-X2(IX-P1:1) = FRAME-BYTE
                   add 1 to IX-P2
                   add 1 to FRAME-COUNT
                   move FRAME-BYTE to WORK-AREA(IX-P2:1)
               end-if
               if  WORK-AREA-X2(IX-P1:1) = DELIMITER-BYTE
                   add 1 to DELIM-COUNT
               end-if
               if  WORK-AREA-X2(IX-P1:1) not = SPACE
                   add IX-P2 to ZERO giving LAST-NON-SPACE-BYTE
               end-if
               add 1 to IX-P1
               add 1 to IX-P2
           end-perform
           if  DELIM-COUNT > 0
           or  FRAME-COUNT > 0
               add 1 to LAST-NON-SPACE-BYTE
               move FRAME-BYTE to WORK-AREA(LAST-NON-SPACE-BYTE:1)
               add 1 to IX-P2
               add LAST-NON-SPACE-BYTE to 1 giving CSV-SIZE
               move WORK-AREA-X to REC1CALL-REC(IX-NP:CSV-SIZE)
           else
               if  LAST-NON-SPACE-BYTE > 0
                   add LAST-NON-SPACE-BYTE to ZERO giving CSV-SIZE
                   move WORK-AREA to REC1CALL-REC(IX-NP:CSV-SIZE)
               else
                   move ZERO to CSV-SIZE
               end-if
           end-if
           add CSV-SIZE to IX-NP
           move DELIMITER-BYTE to REC1CALL-REC(IX-NP:1)
           add 1 to IX-NP
           exit.
      *****************************************************************
      *           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: 2019/08/27  Generation Time: 13:29:17:21    *
      *****************************************************************

Table of Contents Previous Section Next Section I/O Program, KSDS to LCSV

The following (CUSEXTC5.cbl) is the COBOL I/O program that was generated with SimoTime technology. The program was tested using Micro Focus Enterprise Server on Windows/XP. The program was successfully executed in an ASCII encoded configuration.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUSEXTC5.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2020-06-16  Generation Time: 02:12:28:04    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   CUSTMAST INDEXED       VARIABLE   00512    00001   *
      *                                              00012    00012   *
      *  SECONDARY CUSTLCSV ASCII/CRLF    FIXED      01024            *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT CUSTMAST-FILE  ASSIGN TO       CUSTMAST
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS SEQUENTIAL
                  RECORD KEY    IS CUSTMAST-PKEY-00001-00012
                  FILE STATUS   IS CUSTMAST-STATUS.
           SELECT CUSTLCSV-FILE  ASSIGN TO       CUSTLCSV
                  ORGANIZATION  IS LINE SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS CUSTLCSV-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       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).

       FD  CUSTLCSV-FILE
           DATA RECORD    IS CUSTLCSV-REC
           .
       01  CUSTLCSV-REC.
           05  CUSTLCSV-DATA-01 PIC X(01024).

      *****************************************************************
      * 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 more information or questions please contact SimoTime     *
      * Technologies. The version control number is 20.00.00          *
      *                                                               *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CUSEXTC5 '.
           05  T2 pic X(34) value 'Convert Customer ASC-KSDS to LCSV '.
           05  T3 pic X(10) value ' v20.00.00'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CUSEXTC5 '.
           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  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  CUSTLCSV-STATUS.
           05  CUSTLCSV-STATUS-L     pic X.
           05  CUSTLCSV-STATUS-R     pic X.
       01  CUSTLCSV-EOF              pic X       value 'N'.
       01  CUSTLCSV-OPEN-FLAG        pic X       value 'C'.

       01  CUSTMAST-LRECL            pic 9(5)    value 00512.
       01  CUSTLCSV-LRECL            pic 9(5)    value 01024.
       01  CUSTMAST-LRECL-MAX        pic 9(5)    value 00512.
       01  CUSTLCSV-LRECL-MAX        pic 9(5)    value 01024.

      *****************************************************************
      * 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-TO-SYSOUT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(011)  value '* CUSEXTC5 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(068)  value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.
       01  MSG-LSB                 pic 9(5)    value 267.

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

       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 Customer ASC-KSDS to LCSV '.
           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  CUSTMAST-TOTAL.
           05  CUSTMAST-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for CUSTMAST'.
       01  CUSTLCSV-TOTAL.
           05  CUSTLCSV-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for CUSTLCSV'.

      *****************************************************************
       PROCEDURE DIVISION.
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TO-SYSOUT
           move INFO-STATEMENT to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TO-SYSOUT
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TO-SYSOUT
           perform Z-POST-COPYRIGHT
           perform CUSTMAST-OPEN
           perform CUSTLCSV-OPEN

      *    USRSOJ Processing not specified...

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

      *    USREOJ Processing not specified...

           move CUSTMAST-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TO-USERS

           move CUSTLCSV-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TO-USERS

           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-TO-SYSOUT

           perform CUSTLCSV-CLOSE
           perform CUSTMAST-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    Extract CALL process...
           call 'CUSEXTR5'                        using CUSTLCSV-REC
                                                        CUSTMAST-REC
           add 01024 to ZERO giving CUSTLCSV-LRECL
           exit.

      *****************************************************************
      * I/O Routines for the INPUT File...                            *
      *****************************************************************
       CUSTMAST-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close CUSTMAST-FILE
           if  CUSTMAST-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 CUSTMAST' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TO-USERS
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-READ.
           read CUSTMAST-FILE
           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
               if  APPL-EOF
                   move 'Y' to CUSTMAST-EOF
               else
                   move 'READ Failure with CUSTMAST' to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TO-USERS
                   move CUSTMAST-STATUS to IO-STATUS
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input 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-TO-USERS
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

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

      *****************************************************************
       Z-CALCULATE-MESSAGE-LSB.
           add 267 to ZERO giving MSG-LSB
           perform until MSG-LSB < 80
                      or MESSAGE-BUFFER(MSG-LSB:1) not = SPACE
             if MESSAGE-BUFFER(MSG-LSB:1) = SPACE
                subtract 1 from MSG-LSB
             end-if
           end-perform
           exit.

      *****************************************************************
      * Post message to the SYSOUT device, clear message buffer...    *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TO-SYSOUT.
           perform Z-CALCULATE-MESSAGE-LSB
           display MESSAGE-BUFFER(1:MSG-LSB)
           move all SPACES to MESSAGE-TEXT
           exit.
      *****************************************************************
      * Display message to console, do not clear message buffer...    *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TO-CONSOLE.
           perform Z-CALCULATE-MESSAGE-LSB
           display MESSAGE-BUFFER(1:MSG-LSB) upon console
           exit.
      *****************************************************************
      * Display message to console and post to SYSOUT device...       *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TO-USERS.
           perform Z-DISPLAY-MESSAGE-TO-CONSOLE
           perform Z-DISPLAY-MESSAGE-TO-SYSOUT
           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-TO-USERS
           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-TO-USERS
           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: 2020-06-16  Generation Time: 02:12:28:05    *
      *****************************************************************

Table of Contents Previous Section Next Section The Program Generation Process

The following two sections describe the input files that are required for the program generation process.

Table of Contents Previous Section Next Section The Process Control File

The Process Control File will be used to generate the COBOL programs that will extract data from the customer master file and create a record sequential with the fields separated by a comma. The input file (CUSTMAST.dat) is a Micro Focus Key-Sequenced file. The output file may be easily imported into an Excel spread sheet. The following (CUSEXT01.pcf) shows the content of the Process Control File.

***********************************************************************
*                CUSEXT01.pcf - a Process Control File                *
*               SimoTime Program Generation Technologies              *
*            (C) Copyright 1987-2019 All Rights Reserved              *
*               Web Site URL:   http://www.simotime.com               *
*                     e-mail:   helpdesk@simotime.com                 *
***********************************************************************
* SYSUT1 is the Customer Master File, Indexed, 512-byte records.
* SYSUT2 is a Record Sequential file, 256-byte fixed-length records.
***********************************************************************
* This Process Control File will be used to generate a callable COBOL
* routine that will extract data from the customer master file and
* create a record sequential with the fields separated by a comma.
* The input file (CUSTMAST.DAT) is a Micro Focus Key-Sequenced file.
* The output file may be easily imported into an Excel spread sheet.
* Refer to the utconv01.htm document for additional detail.
*
* The following group of statements will define the high level
* functions and processes to be performed.
*
&SIMOPREP  call ..\..\ENV1BASE
&USERPREP  call USERCONV
&CONFORM   IBM
&COPYFILE  CUSTCB01.cpy
&HTMLFILE  custcb01.htm
*
* The following group of statements will define the behavioral
* characteristics and environment variable for the file I/O Program
* to be generated.
*
*HEAD34    ....:....1....:....2....:....3....
&HEAD34    Extract Customer Info to CSV RSEQ
&PROGID    CUSEXTC1
&SYSUT1    name=CUSTMAST org=Indexed    recfm=VARIABLE rmin=12 rmax=512 kpos=1 klen=12
&SYSUT2    name=CUSTRCSV org=Sequential recfm=FIXED    rmax=256
*
* The following two statements are used when the records in the data
* file (input or output) are a Comma-Separated-Values (or CSV) format.
*
&DELIMITER ,
&FRAME     "
*
* The following group of statements will define the behavioral
* characteristics and environment variables for the record content
* conversion program to be generated.
* This is for CSV Formatted output records.
*
&EXTCALL   CUSEXTR1
&EXTREC    CUST-RECORD
&EXTLREC   256
&EXTFMT    CSV ,
&EXTINIT   SPACES
&EXTHDR    YES
*
* The following group of statements will define the fields to be
* extracted from the input file and written to the output file.
* This is for CSV Formatted output records.
*
&EXTRACT   CUST-NUMBER
&EXTRACT   CUST-STATUS
&EXTRACT   CUST-LAST-NAME
&EXTRACT   CUST-FIRST-NAME
&EXTRACT   CUST-MID-NAME
&EXTRACT   CUST-ADDRESS-1
&EXTRACT   CUST-ADDRESS-2
&EXTRACT   CUST-CITY
&EXTRACT   CUST-STATE
&EXTRACT   CUST-POSTAL-CODE
&EXTRACT   CUST-PHONE-HOME
&EXTRACT   CUST-PHONE-WORK
&EXTRACT   CUST-PHONE-CELL
&EXTRACT   CUST-CREDIT-LIMIT
&EXTRACT   CUST-DISCOUNT-CODE(1)
&EXTRACT   CUST-DISCOUNT-RATE(1)
&EXTRACT   CUST-DISCOUNT-DATE(1)
&EXTRACT   CUST-DISCOUNT-CODE(2)
&EXTRACT   CUST-DISCOUNT-RATE(2)
&EXTRACT   CUST-DISCOUNT-DATE(2)
&EXTRACT   CUST-DISCOUNT-CODE(3)
&EXTRACT   CUST-DISCOUNT-RATE(3)
&EXTRACT   CUST-DISCOUNT-DATE(3)
&EXTRACT   CUST-LADATE
&EXTRACT   CUST-LATIME
&EXTRACT   CUST-TOKEN
*
&END

Table of Contents Previous Section Next Section Record Structure, a Copy File

The following (CUSTCB01.cpy) is the COBOL copy file that is used to define the record structure.

      *****************************************************************
      *               CUSTCB01.cpy - a COBOL Copy Member              *
      *    Customer Master File used for Quality Assurance Testing    *
      *       This is a VSAM Keyed-Sequential-Data-Set or KSDS        *
      *         Copyright (C) 1987-2020 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       *
      *****************************************************************
      *    CUST-RECORD size is 512 bytes.
      *    RMIN is 512    RMAX is 512
      *    KPOS is   1    KLEN is 012
      *
....:.*..1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
       01  CUST-RECORD.
           05  CUST-NUMBER             PIC X(12).                       col A
           05  CUST-DATA.
               10  CUST-STATUS         PIC X.                           col B
               10  CUST-NAME.
                   15  CUST-LAST-NAME  PIC X(28).                       col C
                   15  CUST-FIRST-NAME PIC X(20).                       col D
                   15  CUST-MID-NAME   PIC X(20).                       col E
               10  CUST-ADDRESS-1      PIC X(48).                       col F
               10  CUST-ADDRESS-2      PIC X(48).                       col G
               10  CUST-CITY           PIC X(28).                       col H
               10  CUST-STATE          PIC X(28).                       col I
               10  CUST-POSTAL-CODE    PIC X(12).                       col J
               10  CUST-PHONE-HOME     PIC X(18).                       col K
               10  CUST-PHONE-WORK     PIC X(18).                       col L
               10  CUST-PHONE-CELL     PIC X(18).                       col M
               10  CUST-CREDIT-LIMIT   PIC 9(7)        COMP-3.          col N
               10  CUST-DISCOUNT       OCCURS 3 TIMES.
                   15  CUST-DISCOUNT-CODE  PIC S9(3)   COMP.            col ORU
                   15  CUST-DISCOUNT-RATE  PIC S9(2)V999.               col PSV
                   15  CUST-DISCOUNT-DATE  PIC X(8).                    col QTW
               10  CUST-LADATE         PIC X(8).                        col X
               10  CUST-LATIME         PIC X(8).                        col Y
               10  CUST-TOKEN          PIC 9(3).                        col Z
               10  FILLER              PIC X(145).
      *
      ***  CUSTCB01 - End-of-Copy File - - - - - - - - - - - CUSTCB01 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section HTML Document for Record Structure

The SimoTime Technologies have the ability to scan a COBOL copy file and create an HTML document of a record structure or record layout. The HTML documentation provides information that is not easy to obtain by viewing the COBOL copy file. For example, the physical position of a field within a record as calculated during the copy file scan and placed in the HTML document.

Link to Internet   Link to Server   Explore the Record Structure for the Customer Master File by viewing a generated HTML document based on a User-Defined COBOL copyfile.

Table of Contents Previous Section Next Section Summary

The purpose of this program is to provide an example for accessing a VSAM, KSDS and extracting data that is reformatted into a comma separated data string that is written to a sequential file. This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers.

In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.

SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the  Contact or Feedback  section of this document.

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.

Link to Internet   Link to Server   Explore How to Convert a Comma-Separated-Values Record Structure to a Fixed-Field-Length Record Structure.  This technique may be used to import data into a VSAM, Key-Sequenced-Data-Set (KSDS) with a record structure that uses fixed-length fields. The CSV format may be accessed by Microsoft Excel or loaded into a relational data base.

Link to Internet   Link to Server   Explore How to Generate a Data File Convert Program using simple specification statements in a Process Control File (PCF). This link to the User Guide includes the information necessary to create a Process Control File and generate the COBOL programs that will do the actual data file conversion. The User Guide contains a list of the PCF statements that are used for the data file convert process.

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 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 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 that are used 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 to download for review and evaluation purposes. Other uses will require a SimoTime Software License. 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 (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.

Explore the GnuCOBOL Technologies available from SourceForge. SourceForge is an Open Source community resource dedicated to helping open source projects be as successful as possible. GnuCOBOL (formerly OpenCOBOL) is a COBOL compiler with run time support. The compiler (cobc) translates COBOL source to executable using intermediate C, designated C compiler and linker. This link will require 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 Contact or Feedback

This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.

1. Send an e-mail to our helpdesk.
1.1. helpdesk@simotime.com.
2. Our telephone numbers are as follows.
2.1. 1 415 763-9430 office-helpdesk
2.2. 1 415 827-7045 mobile

 

We appreciate hearing from you.

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
Extract Data from Customer Master File for use by Microsoft Excel or Access
Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com