Expand Numeric Formats
Convert Indexed to ASCII/Text & CSV
  Table of Contents  v-16.01.01 - cumktx01.htm 
  Introduction
  ASCII-Indexed to ASCII/Text
  CMD, Generate COBOL Source Code
  PCF, Generate COBOL Source Code
  Record Structure, a COBOL Copy File
  CUSTMAST with Packed & Binary
  CUSTMAST without Packed & Binary
  The Generated COBOL Source Code
  File Format Convert, KSDS to ASCII/Text
  Record Content Convert, Numeric Expansion
  Convert Tables, a COBOL Copy File
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This is an example of how a set of two COBOL programs can read an ASCII-encoded Indexed file with a fixed-length-field record structure with COMP and COMP-3 numeric formats and write to a Sequential ASCII/Text file with a record structure that contains fixed-length-fields of all text.

This suite of programs will describe and demonstrate an approach to changing the record content (or record structure) so that all the various packed and binary fields (COMP or COMP-3 fields) will be expanded into a full-text format. Another formatting issue that is addressed is the numeric formats that have the sign embedded as part of the numeric structure. The new format will have a separate byte following the numeric value that will be an explicit sign.

Note:  Converting the COMP and COMP-3 fields will result in larger field sizes and larger record sizes. Using a separate byte for an explicit sign will also increase the size of the record. Also, inserting the record separator characters between the records will increase the overall size of the file.

In the world of programming there are many ways to solve a problem. This set of programs is provided as a COBOL example of one of the possible solutions to the problem of changing the contents and structure of data files.


We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.

Copyright © 1987-2019
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section ASCII-Indexed to ASCII/Text

The file management capabilities provided by Micro Focus in the Linux, UNIX and Windows environments support various file formats and the numeric formats supported by the COBOL ANSI standards. Both an EBCDIC and/or ASCII encoded format is supported.

Link to Internet   Link to Server   Explore the Micro Focus Files and various Numeric Formats being used in a multi-system complex consisting of Mainframe (z/OS), Linux, UNIX or Windows systems.

Table of Contents Previous Section Next Section CMD, Generate COBOL Source Code

The following CMD file DXCONVW1.cmd is used to generate (or create) the COBOL source code. This process uses the UTCONVRT utility program to do the actual program generation.

@echo OFF
     set CmdName=DXCONVW1
rem  * *******************************************************************
rem  *               DXCONVW1.CMD - a Windows Command File               *
rem  *       This Job Script is provided by SimoTime Enterprises         *
rem  *           (C) Copyright 1987-2019 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  * This procedure calls the following Windows Command Files.
rem  * 1. Env1Base.CMD - this provides a single point for setting
rem  *                   commonly used environment variables.
rem  * 2. USERCONV.CMD - this provides a single point for setting
rem  *                   conversion-oriented environment variables.
rem  * 3. SimoNOTE.CMD - this provides a consistent process for
rem  *                   displaying messages to the screen and writing
rem  *                   to a journal or log file.
rem  * 4. SIMOCONV.CMD - this will do the actual genertion of the
rem  *                   specified programs based on the content of
rem  *                   the Process Control File.
rem  * *******************************************************************
     call ..\ENV1BASE
     call USERCONV
rem  *
     call SimoNOTE "********************************************************************%CmdName%.CMD"
     call SimoNOTE "Starting JobName %CmdName%.CMD"
rem  *
rem  * Set the environment variable to use the default directives file.
     set AOK_Count=0
     set NOK_Count=0
     set SIMOGENS=BATCH
     set SIMODROP=Y
rem  * Generate the COBOL source code for Mainframe Conversions Programs
     CALL SIMOCONV KSXSQX01
     CALL SIMOCONV SQXKSX01
     CALL SIMOCONV SQXKSX02
rem  * Generate the COBOL source code for Server Conversions Programs
     CALL SIMOCONV SQEKSA01
     CALL SIMOCONV KSASQE01
rem  * Generate the COBOL source code for User Conversions Programs
     CALL SIMOCONV CUMKTX05
     CALL SIMOCONV CUTKTX05
     CALL SIMOCONV CUSEXT05
     CALL SIMOCONV CUSIMPL5
     CALL SIMOCONV CUSIMPU5
rem  *
     call SimoNOTE "AOKcount Compile Count for AOK is %AOK_Count% "
     call SimoNOTE "NOKcount Compile Count for NOK is %NOK_Count% "
     call SimoNOTE "Finished JobName %CmdName%.CMD "
     pause

WIP

Table of Contents Previous Section Next Section PCF, Generate COBOL Source Code

The following member (CUMKTX05.pcf) is the process control file containing the specifications that are used by the preceding command file to generate the source code for the programs that will do the actual data file conversion.

***********************************************************************
*                CUMKTX05.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, 524-byte fixed-length records.
***********************************************************************
* This set of specification will generate two COBOL programs. The
* primary program will do the file I/O and call a secondary COBOL
* program that will do the record content conversion. The numeric
* fields will be converted based on the field definitions in the COBOL
* copy files identified by &FMTCPY1 and &FMTCPY2.
*
* The input file (SYSUT1) is a Micro Focus Key-Sequenced file. SYSUT1
* requires Micro Focus technology for processing in the Linux, UNIX or
* Windows environments.
*
* The output file (SYSUT2) may be easily viewed with a standard text
* editor such as NotePAD.
*
&SIMOPREP  call ..\..\ENV1BASE
&USERPREP  call USERCONV
&CONFORM   IBM
&COPYFILE  CUSTCB02.CPY
&DIALECT   C2
*HEAD34    ....:....1....:....2....:....3....
&HEAD34    Convert Numeric Fields to DISPLAY
&IOMODNAME CUMKTXC5
&SYSUT1    name=CUSTMAST org=Indexed    recfm=VARIABLE rmin=12 rmax=512 kpos=1 klen=12
&SYSUT2    name=CUSTLTXT org=ASCII/Text recfm=FIXED    rlen=524
*
&TransMode FMT
*
*          ....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
*
&FMTCPY1   CUSTCB01
&FMTCPY2   CUSTCB02
*
&FMTCALL   CUMKTXR1
&FMTUT1    CUST-RECORD
&FMTUT2    CUST-RECORD-02
*
&FMTFIELD  CUST-NUMBER
&FMTFIELD  CUST-CUST-STATUS
&FMTFIELD  CUST-LAST-NAME
&FMTFIELD  CUST-FIRST-NAME
&FMTFIELD  CUST-MID-NAME
&FMTFIELD  CUST-ADDRESS-1
&FMTFIELD  CUST-ADDRESS-2
&FMTFIELD  CUST-CITY
&FMTFIELD  CUST-STATE
&FMTFIELD  CUST-POSTAL-CODE
&FMTFIELD  CUST-PHONE-HOME
&FMTFIELD  CUST-PHONE-WORK
&FMTFIELD  CUST-PHONE-CELL
&FMTFIELD  CUST-CREDIT-LIMIT
&FMTFIELD  CUST-DISCOUNT-CODE
&FMTFIELD  CUST-DISCOUNT-RATE
&FMTFIELD  CUST-DISCOUNT-DATE
&FMTFIELD  CUST-LADATE
&FMTFIELD  CUST-LATIME
&FMTFIELD  CUST-TOKEN
&END

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

Two (2) COBOL copy files are required to generate programs that do field-format conversion. This process will convert a numeric packed or binary (COMP-3 or COMP) field to a new display-oriented field. If the numeric field is defined as "signed" then a "SIGN TRAILING SEPARATE" will be added to the new field definition statement.

Table of Contents Previous Section Next Section CUSTMAST with Packed & Binary

The following member (CUSTCB01.cpy) is the COBOL copy file that is used to define the record structure for the Customer Master file that contains Packed and Binary fields.

      *****************************************************************
      *               CUSTCB01.CPY - a COBOL Copy File                *
      *       A Customer Master File used by the Demo programs.       *
      * This is a VSAM Keyed-Sequential-Data-Set or Key-Indexed File. *
      *         Copyright (C) 1987-2019 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *    CUST-RECORD size is 512 bytes.
      *
       01  CUST-RECORD.
           05  CUST-NUMBER             PIC X(12).
           05  CUST-DATA.
               10  CUST-STATUS         PIC X.
               10  CUST-NAME.
                   15  CUST-LAST-NAME  PIC X(28).
                   15  CUST-FIRST-NAME PIC X(20).
                   15  CUST-MID-NAME   PIC X(20).
               10  CUST-ADDRESS-1      PIC X(48).
               10  CUST-ADDRESS-2      PIC X(48).
               10  CUST-CITY           PIC X(28).
               10  CUST-STATE          PIC X(28).
               10  CUST-POSTAL-CODE    PIC X(12).
               10  CUST-PHONE-HOME     PIC X(18).
               10  CUST-PHONE-WORK     PIC X(18).
               10  CUST-PHONE-CELL     PIC X(18).
               10  CUST-CREDIT-LIMIT   PIC 9(7)        COMP-3.
               10  CUST-DISCOUNT       OCCURS 3 TIMES.
                   15  CUST-DISCOUNT-CODE  PIC S9(3)   COMP.
                   15  CUST-DISCOUNT-RATE  PIC S9(2)V999.
                   15  CUST-DISCOUNT-DATE  PIC X(8).
               10  CUST-LADATE         PIC X(8).
               10  CUST-LATIME         PIC X(8).
               10  CUST-TOKEN          PIC 9(3).
               10  FILLER              PIC X(145).
      *
      ***  CUSTCB01 - End-of-Copy File - - - - - - - - - - - CUSTCB01 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section CUSTMAST without Packed & Binary

The following member (CUSTCB02.cpy) is the COBOL copy file that is used to define the record structure for the Customer Master file that has the Packed and Binary fields defined as display with sign trailing separate.

      *****************************************************************
      *               CUSTCB02.CPY - a COBOL Copy File                *
      *       A Customer Master File used by the Demo programs.       *
      * This is a VSAM Keyed-Sequential-Data-Set or Key-Indexed File. *
      *         Copyright (C) 1987-2019 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *    This record structure definition has changed the numeric
      *    field definitions for COMP and COMP-3 fields to default to
      *    a "USAGE IS DISPLAY" format. If the numeric field is a
      *    signed value then the "SIGN TRAILING SEPARATE" is added to
      *    the new numeric field definition.
      *
      *    Note: Columns 73-80 are used to tag the statements that
      *          were modified or added.
      *
      *    The length of this data structure is 527 bytes.
      *
....:.*..1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
       01  CUST-RECORD-02.
           05  CUST-NUMBER             PIC X(12).
           05  CUST-DATA.
               10  CUST-STATUS         PIC X.
               10  CUST-NAME.
                   15  CUST-LAST-NAME  PIC X(28).
                   15  CUST-FIRST-NAME PIC X(20).
                   15  CUST-MID-NAME   PIC X(20).
               10  CUST-ADDRESS-1      PIC X(48).
               10  CUST-ADDRESS-2      PIC X(48).
               10  CUST-CITY           PIC X(28).
               10  CUST-STATE          PIC X(28).
               10  CUST-POSTAL-CODE    PIC X(12).
               10  CUST-PHONE-HOME     PIC X(18).
               10  CUST-PHONE-WORK     PIC X(18).
               10  CUST-PHONE-CELL     PIC X(18).
               10  CUST-CREDIT-LIMIT   PIC 9(7).
               10  CUST-DISCOUNT       OCCURS 3 TIMES.
                   15  CUST-DISCOUNT-CODE  PIC S9(3)
                                           SIGN TRAILING SEPARATE.      STS
                   15  CUST-DISCOUNT-RATE  PIC S9(2)V999
                                           SIGN TRAILING SEPARATE.      STS
                   15  CUST-DISCOUNT-DATE  PIC X(8).
               10  CUST-LADATE         PIC X(8).
               10  CUST-LATIME         PIC X(8).
               10  CUST-TOKEN          PIC 9(3).
               10  FILLER              PIC X(145).
....:.*..1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
      *
      ***  CUSTCB02 - End-of-Copy File - - - - - - - - - - - CUSTCB02 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section The Generated COBOL Source Code

The generation process will create two (2) COBOL programs. The primary program will read the Customer Master File (a VSAM, KSDS), call the second program to do the conversion of the numeric fields and then write to a Line Sequential (or ASCII/Text) file using the converted record structure.

Table of Contents Previous Section Next Section File Format Convert, KSDS to ASCII/Text

The following member (CUMKTXC5.cbl) is the generated source code for the program that does the file I/O and file format conversion.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUMKTXC5.
       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: 2012-07-20  Generation Time: 09:01:00:30    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  INPUT     CUSTMAST INDEXED       VARIABLE   00512    00001   *
      *                                              00012    00012   *
      *  OUTPUT    CUSTLTXT ASCII/CRLF    FIXED      00524            *
      *                                                               *
      *                                                               *
      *            Translation Mode is Field Formatting               *
      *                                                               *
      *****************************************************************
       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 CUSTLTXT-FILE  ASSIGN TO       CUSTLTXT
                  ORGANIZATION  IS LINE SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS CUSTLTXT-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  CUSTLTXT-FILE
           DATA RECORD    IS CUSTLTXT-REC
           .
       01  CUSTLTXT-REC.
           05  CUSTLTXT-DATA-01 PIC X(00524).

      *****************************************************************
      * This program was created with 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 Technologies.       *
      *        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.           *
      *                                                               *
      * This program mask is used with a callable subroutine that     *
      * will do ASCII/EBCDIC Conversion based on a COBOL Copy 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 '* CUMKTXC5 '.
           05  T2 pic X(34) value 'Expand the Customer Numeric Fields'.
           05  T3 pic X(10) value ' v12.04.05'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CUMKTXC5 '.
           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  CUSTLTXT-STATUS.
           05  CUSTLTXT-STATUS-L     pic X.
           05  CUSTLTXT-STATUS-R     pic X.
       01  CUSTLTXT-EOF              pic X       value 'N'.
       01  CUSTLTXT-OPEN-FLAG        pic X       value 'C'.

       01  CUSTMAST-LRECL            pic 9(5)    value 00512.
       01  CUSTLTXT-LRECL            pic 9(5)    value 00524.

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

       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   'Expand the Customer Numeric Fields'.
           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  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  CUSTLTXT-TOTAL.
           05  CUSTLTXT-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for CUSTLTXT'.

      *****************************************************************
       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 CUSTLTXT-OPEN

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

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

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

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    TransMODE is FMT...
      *    Format Record Content based on Copy Files.
           call 'CUMKTXR1' using CUSTMAST-REC
                                 CUSTLTXT-REC
           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...                           *
      *****************************************************************
       CUSTLTXT-WRITE.
           if  CUSTLTXT-OPEN-FLAG = 'C'
               perform CUSTLTXT-OPEN
           end-if
           write CUSTLTXT-REC
           if  CUSTLTXT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  CUSTLTXT-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 CUSTLTXT' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTLTXT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTLTXT-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT CUSTLTXT-FILE
           if  CUSTLTXT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to CUSTLTXT-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with CUSTLTXT' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTLTXT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTLTXT-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close CUSTLTXT-FILE
           if  CUSTLTXT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to CUSTLTXT-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with CUSTLTXT' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTLTXT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

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

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * four digits. If the full two byte file status is numeric it   *
      * will display as 00nn. If the 1st byte is a numeric nine (9)   *
      * the second byte will be treated as a binary number and will   *
      * display as 9nnn.                                              *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1 = '9'
               move IO-STAT1 to IO-STATUS-04(1:1)
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           else
               move '0000' to IO-STATUS-04
               move IO-STATUS to IO-STATUS-04(3:2)
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           exit.

      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE
           display SIM-COPYRIGHT
           exit.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2012-07-20  Generation Time: 09:01:00:31    *
      *****************************************************************

Table of Contents Previous Section Next Section Record Content Convert, Numeric Expansion

The following member (CUMKTXR1.cbl) is the generated source code for the program the called program that does the record content conversion between EBCDIC and ASCII based on the record structure that is defined by a COBOL copy file..

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUMKTXR1.
       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: 2012/07/20  Generation Time: 09:01:00:44    *
      *****************************************************************
       DATA DIVISION.
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  IX-1    pic 9(5)  value 0.
      *
      *****************************************************************
       LINKAGE SECTION.
       COPY CUSTCB01.
       COPY CUSTCB02.
      *
      *****************************************************************
       PROCEDURE DIVISION using CUST-RECORD
                                CUST-RECORD-02.
           move CUST-NUMBER
             of CUST-RECORD
             to CUST-NUMBER
             of CUST-RECORD-02
           move CUST-LAST-NAME
             of CUST-RECORD
             to CUST-LAST-NAME
             of CUST-RECORD-02
           move CUST-FIRST-NAME
             of CUST-RECORD
             to CUST-FIRST-NAME
             of CUST-RECORD-02
           move CUST-MID-NAME
             of CUST-RECORD
             to CUST-MID-NAME
             of CUST-RECORD-02
           move CUST-ADDRESS-1
             of CUST-RECORD
             to CUST-ADDRESS-1
             of CUST-RECORD-02
           move CUST-ADDRESS-2
             of CUST-RECORD
             to CUST-ADDRESS-2
             of CUST-RECORD-02
           move CUST-CITY
             of CUST-RECORD
             to CUST-CITY
             of CUST-RECORD-02
           move CUST-STATE
             of CUST-RECORD
             to CUST-STATE
             of CUST-RECORD-02
           move CUST-POSTAL-CODE
             of CUST-RECORD
             to CUST-POSTAL-CODE
             of CUST-RECORD-02
           move CUST-PHONE-HOME
             of CUST-RECORD
             to CUST-PHONE-HOME
             of CUST-RECORD-02
           move CUST-PHONE-WORK
             of CUST-RECORD
             to CUST-PHONE-WORK
             of CUST-RECORD-02
           move CUST-PHONE-CELL
             of CUST-RECORD
             to CUST-PHONE-CELL
             of CUST-RECORD-02
           add CUST-CREDIT-LIMIT
            of CUST-RECORD
            to ZERO giving CUST-CREDIT-LIMIT
            of CUST-RECORD-02
           add 1 to ZERO giving IX-1
           perform 0000003 times
             add CUST-DISCOUNT-CODE
              of CUST-RECORD(IX-1)
              to ZERO giving CUST-DISCOUNT-CODE
              of CUST-RECORD-02(IX-1)
             add 1 to IX-1
           end-perform
           add 1 to ZERO giving IX-1
           perform 0000003 times
             add CUST-DISCOUNT-RATE
              of CUST-RECORD(IX-1)
              to ZERO giving CUST-DISCOUNT-RATE
              of CUST-RECORD-02(IX-1)
             add 1 to IX-1
           end-perform
           add 1 to ZERO giving IX-1
           perform 0000003 times
             move CUST-DISCOUNT-DATE
               of CUST-RECORD(IX-1)
               to CUST-DISCOUNT-DATE
               of CUST-RECORD-02(IX-1)
             add 1 to IX-1
           end-perform
           move CUST-LADATE
             of CUST-RECORD
             to CUST-LADATE
             of CUST-RECORD-02
           move CUST-LATIME
             of CUST-RECORD
             to CUST-LATIME
             of CUST-RECORD-02
           add CUST-TOKEN
            of CUST-RECORD
            to ZERO giving CUST-TOKEN
            of CUST-RECORD-02
           GOBACK.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *  Generation Date: 2012/07/20  Generation Time: 09:01:00:44    *
      *****************************************************************

Table of Contents Previous Section Next Section Convert Tables, a COBOL Copy File

The following member (ASC2EBC1.cpy) show the content of the COBOL copy file that contains the tables that are used to do the EBCDIC to ASCII conversion.

      *****************************************************************
      *               AE9437B1.cpy - a COBOL Copy File                *
      *         Copyright (C) 1987-2018 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       *
      *****************************************************************
      * The following tables are used by the INSPECT statement to do  *
      * the conversion between EBCDIC and ASCII.                      *
      *                                                               *
      *   inspect FIELD-NAME converting EBCDIC-INFO to ASCII-INFO     *
      *   inspect FIELD-NAME converting ASCII-INFO  to EBCDIC-INFO    *
      *                                                               *
      * The tables include the alphabet for upper and lower case, the *
      * digits 0-9, the special characters (US) and the alternate     *
      * codes for A, E, I, O, and U with the appropriate acute,       *
      * grave, umlaut, circumflex and tilde.                          *
      * To display the alternate codes the Courier New (Fixed) or     *
      * Times New Roman (Proportional) font should be used.           *
      *                                                               *
      * SimoZAPS contains four tables that may be used for various    *
      * Upper/Lower Case or EBCDIC/ASCII conversion requirements.     *
      * ASCEBCB1.CPY - includes a full character set for the alphabet *
      *                (upper/lower case), digit, special characters  *
      *                and alternate codes for characters with the    *
      *                acute, grave, umlaut, tilde and circumflex.    *
      *                Caution: this table does not convert the Y     *
      *                characters with an umlat.                      *
      * ASCEBCB2.CPY - includes the character set for the translation *
      *                between EBCDIC/ASCII of signed/unsigned,       *
      *                zoned-decimal, numeric fields.                 *
      * ASCEBCB3.CPY - includes the character set for the alternate   *
      *                codes with the acute, grave, umlaut, tilde and *
      *                circumflex. This is primarily used for case    *
      *                conversion.                                    *
      *                Note: this table converts the Y characters     *
      *                with an umlat, this will convert high-values   *
      *                X'FF' to X'DF'                                 *
      * ASCEBCB4.CPY - includes the character set for the alphabet    *
      *                (upper/lower case), digit, special characters. *
      *                This is primarily used in the US where the     *
      *                alternate codes may not be required.           *
      * ASCEBCB5.CPY - includes a full character set for the alphabet *
      *                (upper/lower case), digit, special characters  *
      *                and alternate codes for characters with the    *
      *                acute, grave, umlaut, tilde and circumflex.    *
      *                Caution: this table will convert the Y         *
      *                characters with an umlat.                      *
      *****************************************************************
      *
      *    ------------------------------------------------------------
       01  EBCDIC-DATA.
           05  FILLER pic X(16)
                          value X'000102030405060708090A0B0C0D0E0F'.    000-015
           05  FILLER pic X(16)
                          value X'101112131415161718191A1B1C1D1E1F'.    016-031
           05  FILLER pic X(16)
                          value X'202122232425262728292A2B2C2D2E2F'.    032-047
           05  FILLER pic X(16)
                          value X'303132333435363738393A3B3C3D3E3F'.    048-063
           05  FILLER pic X(16)
                          value X'404142434445464748494A4B4C4D4E4F'.    064-079
           05  FILLER pic X(16)
                          value X'505152535455565758595A5B5C5D5E5F'.    080=095
           05  FILLER pic X(16)
                          value X'606162636465666768696A6B6C6D6E6F'.    096-111
           05  FILLER pic X(16)
                          value X'707172737475767778797A7B7C7D7E7F'.    112-127
           05  FILLER pic X(16)
                          value X'808182838485868788898A8B8C8D8E8F'.    128-143
           05  FILLER pic X(16)
                          value X'909192939495969798999A9B9C9D9E9F'.    144-159
           05  FILLER pic X(16)
                          value X'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'.    160-175
           05  FILLER pic X(16)
                          value X'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'.    176-191
           05  FILLER pic X(16)
                          value X'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'.    192-207
           05  FILLER pic X(16)
                          value X'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'.    208-223
           05  FILLER pic X(16)
                          value X'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'.    224-239
           05  FILLER pic X(16)
                          value X'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'.    240-255

       01  E-INFO           redefines EBCDIC-DATA pic X(256).
       01  EBCDIC-TABLE     redefines EBCDIC-DATA.
           05  EBCDIC-BYTE  pic X     occurs 256 times.
      *
      *    ------------------------------------------------------------
       01  ASCII-DATA.
           05  FILLER pic X(16)
                          value X'000102039C09867F978D8E0B0C0D0E0F'.    000-015
           05  FILLER pic X(16)
                          value X'101112139D8508871819928F1C1D1E1F'.    016-031
           05  FILLER pic X(16)
                          value X'80818283840A171B88898A8B8C050607'.    032-047
           05  FILLER pic X(16)
                          value X'909116939495960498999A9B14159E1A'.    048-063
           05  FILLER pic X(16)
                          value X'20A0E2E4E0E1E3E5E7F1A22E3C282B7C'.    064-079
           05  FILLER pic X(16)
                          value X'26E9EAEBE8EDEEEFECDF21242A293BAC'.    080=095
           05  FILLER pic X(16)
                          value X'2D2FC2C4C0C1C3C5C7D1A62C255F3E3F'.    096-111
           05  FILLER pic X(16)
                          value X'F8C9CACBC8CDCECFCC603A2340273D22'.    112-127
           05  FILLER pic X(16)
                          value X'D8616263646566676869ABBBF0FDFEB1'.    128-143
           05  FILLER pic X(16)
                          value X'B06A6B6C6D6E6F707172AABAE6B8C6A4'.    144-159
           05  FILLER pic X(16)
                          value X'B57E737475767778797AA1BFD0DDDEAE'.    160-175
           05  FILLER pic X(16)
                          value X'5EA3A5B7A9A7B6BCBDBE5B5DAFA8B4D7'.    176-191
           05  FILLER pic X(16)
                          value X'7B414243444546474849ADF4F6F2F3F5'.    192-207
           05  FILLER pic X(16)
                          value X'7D4A4B4C4D4E4F505152B9FBFCF9FAFF'.    208-223
           05  FILLER pic X(16)
                          value X'5CF7535455565758595AB2D4D6D2D3D5'.    224-239
           05  FILLER pic X(16)
                          value X'30313233343536373839B3DBDCD9DAFF'.    240-255
       01  A-INFO           redefines ASCII-DATA pic X(256).
       01  ASCII-TABLE      redefines ASCII-DATA.
           05  ASCII-BYTE   pic X     occurs 256 times.
      *
      ***  AE0437B1 - End-of-Copy File - - - - - - - - - - - AE0437B1 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Summary

This is an example of how a set of two COBOL programs can read an ASCII-encoded Indexed file with a fixed-length-field record structure with COMP and COMP-3 numeric formats and write to a Sequential ASCII/Text file with a record structure that contains fixed-length-fields of all text. This document may serve as a tutorial for new programmers or as a quick reference for experienced programmers.

In the world of programming there are many ways to solve a problem. This document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

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

SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please send an e-mail to: helpdesk@simotime.com or call 415 883-6565. We appreciate hearing from you.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.

SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.

Table of Contents Previous Section Next Section Downloads and Links

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

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

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

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

Link to Internet   Link to Server   Explore the Principles of Data File Conversion. This link includes guidelines for defining requirements and determining the scope of effort for a data conversion effort.

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 ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.

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

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

This suite of programs and documentation is available for download. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

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

Table of Contents Previous Section Next Section Comments or Feedback

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

If you have any questions, suggestions, comments or feedback please call at 1 415 827-7045 or send an e-mail to: helpdesk@simotime.com.

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
COBOL Source Code for File Format & Record Content Conversion
Copyright © 1987-2019
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com