Data Extract
Packed and Binary Values
  Table of Contents  v-24.01.01 - exn25601.htm 
  Introduction
  Diagram, Data and Process Flow
  File Types & Record Structure
  Possibilities and Considerations
  JCL Member
  CMD Files, Field Level Data Extract
  Data Extract, RSEQ/FFL to RSEQ/CSV
  The COBOL Program Members
  The I/O Program
  The Extract/Convert Routine
  Record Structure, a Copy File
  The Process Control File
  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 test programs describes how to extract data from an ASCII-encoded, record sequential 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 existing Sequential File and writing the reformatted records to a new 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 Diagram, Data and Process Flow

The following show the data flow and sequence of processing logic.

             
Entry Point
ZOS
Entry Point
Windows
   
   
EXN256J1
jcl
EXN256W1
cmd
The JCL or CMD member for running the application.
   
   
IEFBR14
Utility
IF Exist
statement
Delete any previously created file.
   
   
 
 
   
   
 
 
   
   
SYSUT1
Note-1
 
 
EXN256C1
cbl
   
   
SYSUT2
Note-2
Read the input file and create a new file.
   
   
   
   
   
EXN256R1
cbl
Do the record content conversion.
   
EOJ
End-Of-Job
 
Note-1: RFFL - Record Sequential File with a Fixed-Field-Length record structure.
Note-2: RCSV - Record Sequential File with a Comma-Separated-Values record structure.
Convert Packed & Binary Numbers to Text Strings.

This job performs a record content conversion from a record structure of a Fixed Field Length (FFL) format to a record structure of a Comma Separated Values (CSV) format.

Table of Contents Previous Section Next Section File Types & Record Structure

The following provides a list of terms or abbreviations used when referring to the various file types and record structures.

Term Description of File Format
KSDS File Format for a Key Sequencd Data Set or Indexedl File. The record structure contains a data area for the user records and an index area that contains a user defined key that is used to access the file in a sequential or randowm methodology. The record content may include text strings that conform to the ASCII or EBCDIC encoding schema. Numeric values may use a Zoned-Decimal, Packed-Decimal or Binary format..
LSEQ File Format for a Line Sequential File or ASCII/Text File. By default the record content should conform to the ASCII encoding schema.
RSEQ File Format for a Record Sequential File. The record content may include text strings that conform to the ASCII or EBCDIC encoding schema. Numeric values may use a Zoned-Decimal, Packed-Decimal or Binary format.
Term Description of Record Structure and Content
CSV Comma Separated Values is a record structure containing variable length fields of text characters. Each field is separated by a delimiter character that is typically a comma.
FFL Fixed Field Length is a record structure that contains fixed length fields. Each field may contain text or binary data.
Term Description is a hybrid of the File Format and Record Structure
LCSV Line Sequential file with a CSV Record Structure.
RFFL Record Sequential file with a Fixed Field Length record structure.
   

The preceding provides a list of terms or abbreviations used when referring to the various file types and record structures.

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.

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 Member

The term Mainframe-Oriented refers to an actual IBM Mainframe, Micro Focus Mainframe Express or Micro Focus Enterprise Server with the Mainframe Transaction Option and the Batch Facility. The following (EXN256J1.jcl) is a listing of the JCL member needed to run this job in a Mainframe-Oriented environment.

//EXN256J1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       EXN256J1.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   - Convert ASCII/RSEQ/FFL to RSEQ/CSV file.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, JOBSETUP will delete any previously created files.
//* Step 2, RSEQ2CSV will do the record content conversion.
//*
//* This set of programs will run on a mainframe under ZOS or on a
//* Windows System and Micro Focus Enterprise Server or Studio.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 5. Demonstrate how to convert a Fixed-Field-Length record structure
//*    to a Comma-Separated-Values record structure.
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//SYSUT1   DD  DSN=SIMOTIME.HEXRSEQ.EXN256D1,
//             DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=1024,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Convert ASCII-encoded RSEQ/FFL to RSEQ/CSV...
//*
//HEXDUMP1 EXEC PGM=EXN256C1
//SYSUT1   DD  DSN=SIMOTIME.HEXRSEQ.MKA256D1,
//             DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.HEXRSEQ.EXN256D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=1024,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*
//

Table of Contents Previous Section Next Section CMD Files, Field Level Data Extract

The Data Extract programs may be executed from a Windows Command line or from Windows Explorer. The programs in this suite of examples will read a Customer Master File that is a VSAM, Key-Sequenced-Data-Set (KSDS) and write to a sequential file that may be a record sequential file with fixed length records and fixed length fields within the records. An example that formats the records in a Comma-Separated-Values (CSV) format is included.

Table of Contents Previous Section Next Section Data Extract, RSEQ/FFL to RSEQ/CSV

The following (EXN256W1.cmd) is a listing of the CMD member needed to run this job. This job will do a record content conversion of a Record Sequential file from Fixed-Field-Length structure with packed and binary numeric values to a CSV format with variable length fields. The packed and binary numeric fields will be converted to text fields.

@echo OFF
rem  * *******************************************************************
rem  *               EXN256W1.CMD - a Windows Command File               *
rem  *         This program is 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 ASCII RSEQ/FFL, write ASCII RSEQ/CSV.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read an ASCII-encoded Sequential File with a record
rem  * structure using a Fixed-Field-Length format and write to an
rem  * ASCII-encoded Sequential File with a record structure using a
rem  * Comma-Separated-Values format.
rem  * The input file contains 256-byte fixed-length records with text
rem  * strings and numeric fields defined as BINARY, Packed-Decimal and
rem  * Zoned-Decimal.
rem  * The output file contains 1024-byte fixed-length records with
rem  * character-based text strings and numeric values using a
rem  * Comma-Separated-Values (CSV) format.
rem  *
rem  *
rem  *    ************
rem  *    * EXN256W1 *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    * ENV1BASE *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    * SimoNOTE *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    *   RUN    *---------------------------*
rem  *    ********rts*                           *
rem  *         *                            ************
rem  *         *           ************     * EXN256C1 *     ************
rem  *         *           *  SYSUT1  *-----*    --    *-----*  SYSUT2  *
rem  *         *           *******rseq*     * EXN256R1 *     *******rseq*
rem  *         *                            ********cbl*
rem  *    ************
rem  *    *   EOJ    *
rem  *    ************
rem  *
rem  * *******************************************************************
rem  * Step 1, Set Environment Variables
rem  *         Delete any previously created EBCDIC-encoded file...
rem  *
     call ..\Env1BASE
     set CmdName=EXN256W1
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
     call SimoNOTE "Identify JobStep Step-1, Housekeeping tasks"
     set SYSUT1=%BaseLib1%\DATA\ASC1\SIMOASC1.HEXDATA.MKN256D1.DAT
     set SYSUT2=%BaseLib1%\DATA\APPL\SIMOTIME.HEXDATA.EXN01KD1.DAT
     if exist %SYSUT2% del %SYSUT2%
rem  *
rem  * *******************************************************************
rem  * Step 2, Get ASCII-encoded RSEQ with Fixed-Field-Length (FFL)
rem  *         Put ASCII-encoded RSEQ with Comma-Separated-Values (CSV)
rem  *
     call SimoNOTE "Identify JobStep Step-2, Execute ASCII/FFL to ASCII/CSV"
     call SimoNOTE "DataTake SYSUT1=%SYSUT1%"
     call SimoNOTE "DataMake SYSUT2=%SYSUT2%"
     run EXN256C1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto EojNOK
     if exist %SYSUT2% goto EojAOK
     set JobStatus=0020
     goto EojNOK
:EojAOK
     call SimoNOTE "Produced  %SYSUT2%"
     call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNOK
     call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus%"
     echo %DATE% - %TIME% Starting User ABEND Processing...>>%SYSLOG%
     set >>%SYSLOG%
     echo %DATE% - %TIME% Complete User ABEND Processing...>>%SYSLOG%
     goto :End
:End
     call SimoNOTE "Conclude SYSOUT is %SYSOUT%"
     if not "%1" == "nopause" pause
     exit /B %JobStatus%

Table of Contents Previous Section Next Section The COBOL Program Members

The following describes the COBOL Members included with this suite of programs.

Table of Contents Previous Section Next Section The I/O Program

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

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    EXN256C1.
       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: 2016-01-11  Generation Time: 11:20:41:12    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   SYSUT1   SEQUENTIAL    FIXED      00256            *
      *                                                               *
      *  SECONDARY SYSUT2   SEQUENTIAL    FIXED      01024            *
      *                                                               *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SYSUT1-FILE  ASSIGN TO       SYSUT1
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS SYSUT1-STATUS.
           SELECT SYSUT2-FILE  ASSIGN TO       SYSUT2
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS SYSUT2-STATUS.

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

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

      *****************************************************************
      * 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.               *
      *                                                               *
      * 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.    *
      *                                                               *
      * 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 '* EXN256C1 '.
           05  T2 pic X(34) value 'Extract Text and Numeric Values   '.
           05  T3 pic X(10) value ' v16.01.01'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* EXN256C1 '.
           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  SYSUT1-STATUS.
           05  SYSUT1-STATUS-L     pic X.
           05  SYSUT1-STATUS-R     pic X.
       01  SYSUT1-EOF              pic X       value 'N'.
       01  SYSUT1-OPEN-FLAG        pic X       value 'C'.

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

       01  SYSUT1-LRECL            pic 9(5)    value 00256.
       01  SYSUT2-LRECL            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-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* EXN256C1 '.
           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 'EXN256C1'.

       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 Text and Numeric Values   '.
           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  SYSUT1-TOTAL.
           05  SYSUT1-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for SYSUT1  '.
       01  SYSUT2-TOTAL.
           05  SYSUT2-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for SYSUT2  '.

      *****************************************************************
       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 SYSUT1-OPEN
           perform SYSUT2-OPEN

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

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

           move SYSUT2-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 SYSUT2-CLOSE
           perform SYSUT1-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    Extract CALL process...
           call 'EXN256R1'                        using SYSUT2-REC
                                                        SYSUT1-REC
           add 01024 to ZERO giving SYSUT2-LRECL
           exit.

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

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

Table of Contents Previous Section Next Section The Extract/Convert Routine

The following (EXN256R1.cbl) is a COBOL program that extracts the fields of data and expands the numeric fields and truncates the trailing spaces from text fields and builds a comma separated text string of data. The program was tested using Micro Focus Enterprise Server on Windows/7. The program was successfully executed in both an EBCDIC and ASCII encoded configuration.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    EXN256R1.
       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: 2016/01/11  Generation Time: 11:20:41:48    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  NGBS-07-02.
           05  NRBS-07-02  pic S9(07)V9(02)
                           SIGN LEADING SEPARATE.
       01  NGBS-02-03.
           05  NRBS-02-03  pic S9(02)V9(03)
                           SIGN LEADING SEPARATE.
       01  NGBS-05-02.
           05  NRBS-05-02  pic S9(05)V9(02)
                           SIGN LEADING SEPARATE.
       01  NGBS-06-00.
           05  NRBS-06-00  pic S9(06)
                           SIGN LEADING SEPARATE.
       01  NGBS-02-00.
           05  NRBS-02-00  pic S9(02)
                           SIGN LEADING SEPARATE.
       01  NGBU-07-02.
           05  NRBU-07-02  pic  9(07)V9(02).
       01  NGBU-02-03.
           05  NRBU-02-03  pic  9(02)V9(03).
       01  NGBU-05-02.
           05  NRBU-05-02  pic  9(05)V9(02).
       01  NGBU-06-00.
           05  NRBU-06-00  pic  9(06).
       01  NGBU-02-00.
           05  NRBU-02-00  pic  9(02).
       01  NGPS-07-02.
           05  NRPS-07-02  pic S9(07)V9(02)
                           SIGN LEADING SEPARATE.
       01  NGPS-02-03.
           05  NRPS-02-03  pic S9(02)V9(03)
                           SIGN LEADING SEPARATE.
       01  NGPS-05-02.
           05  NRPS-05-02  pic S9(05)V9(02)
                           SIGN LEADING SEPARATE.
       01  NGPS-06-00.
           05  NRPS-06-00  pic S9(06)
                           SIGN LEADING SEPARATE.
       01  NGPS-02-00.
           05  NRPS-02-00  pic S9(02)
                           SIGN LEADING SEPARATE.
       01  NGPU-07-02.
           05  NRPU-07-02  pic  9(07)V9(02).
       01  NGPU-02-03.
           05  NRPU-02-03  pic  9(02)V9(03).
       01  NGPU-05-02.
           05  NRPU-05-02  pic  9(05)V9(02).
       01  NGPU-06-00.
           05  NRPU-06-00  pic  9(06).
       01  NGPU-02-00.
           05  NRPU-02-00  pic  9(02).
       01  NGZS-07-02.
           05  NRZS-07-02  pic S9(07)V9(02)
                           SIGN LEADING SEPARATE.
       01  NGZS-02-03.
           05  NRZS-02-03  pic S9(02)V9(03)
                           SIGN LEADING SEPARATE.
       01  NGZS-05-02.
           05  NRZS-05-02  pic S9(05)V9(02)
                           SIGN LEADING SEPARATE.
       01  NGZS-06-00.
           05  NRZS-06-00  pic S9(06)
                           SIGN LEADING SEPARATE.
       01  NGZS-02-00.
           05  NRZS-02-00  pic S9(02)
                           SIGN LEADING SEPARATE.
       01  NGZU-07-02.
           05  NRZU-07-02  pic  9(07)V9(02).
       01  NGZU-02-03.
           05  NRZU-02-03  pic  9(02)V9(03).
       01  NGZU-05-02.
           05  NRZU-05-02  pic  9(05)V9(02).
       01  NGZU-06-00.
           05  NRZU-06-00  pic  9(06).
       01  NGZU-02-00.
           05  NRZU-02-00  pic  9(02).

       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(01056)  value SPACES.
       01  WORK-AREA-X2        pic X(01024)  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  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(01024).
       COPY MKN256B1.
      *
      *****************************************************************
       PROCEDURE DIVISION using REC1CALL-REC
                                MKN-RECORD.
      *
           add 1 to ZERO giving IX-NP
           move all SPACES
             to REC1CALL-REC
      *
      *    String Move, MKN-ID
           add 00001 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move MKN-ID to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, MKN-TAG
           add 00008 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move MKN-TAG to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, MKN-COMMENT
           add 00023 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move MKN-COMMENT to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-Signed move, MKN-BS-72
           add 00011 to ZERO giving FFL-SIZE
           add MKN-BS-72 to ZERO giving NRBS-07-02
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGBS-07-02(01:01) to WORK-AREA-X2(01:01)
           move NGBS-07-02(02:07) to WORK-AREA-X2(02:07)
           move '.'               to WORK-AREA-X2(09:1)
           move NGBS-07-02(09:02) to WORK-AREA-X2(10:02)
           perform POST-TEXT-TO-CSV
      *
      *    Binary-Signed move, MKN-BS-23
           add 00007 to ZERO giving FFL-SIZE
           add MKN-BS-23 to ZERO giving NRBS-02-03
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGBS-02-03(01:01) to WORK-AREA-X2(01:01)
           move NGBS-02-03(02:02) to WORK-AREA-X2(02:02)
           move '.'               to WORK-AREA-X2(04:1)
           move NGBS-02-03(04:03) to WORK-AREA-X2(05:03)
           perform POST-TEXT-TO-CSV
      *
      *    Binary-Signed move, MKN-BS-52
           add 00009 to ZERO giving FFL-SIZE
           add MKN-BS-52 to ZERO giving NRBS-05-02
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGBS-05-02(01:01) to WORK-AREA-X2(01:01)
           move NGBS-05-02(02:05) to WORK-AREA-X2(02:05)
           move '.'               to WORK-AREA-X2(07:1)
           move NGBS-05-02(07:02) to WORK-AREA-X2(08:02)
           perform POST-TEXT-TO-CSV
      *
      *    Binary-Signed move, MKN-BS-60
           add 00007 to ZERO giving FFL-SIZE
           add MKN-BS-60 to ZERO giving NRBS-06-00
           move SPACES to WORK-AREA-X2
           move NGBS-06-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-Signed move, MKN-BS-20
           add 00003 to ZERO giving FFL-SIZE
           add MKN-BS-20 to ZERO giving NRBS-02-00
           move SPACES to WORK-AREA-X2
           move NGBS-02-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-UnSign move, MKN-BU-72
           add 00010 to ZERO giving FFL-SIZE
           add MKN-BU-72 to ZERO giving NRBU-07-02
           move SPACES to WORK-AREA-X2
           move NGBU-07-02(01:07) to WORK-AREA-X2(01:07)
           move '.'               to WORK-AREA-X2(08:1)
           move NGBU-07-02(08:02) to WORK-AREA-X2(09:02)
           perform POST-TEXT-TO-CSV
      *
      *    Binary-UnSign move, MKN-BU-23
           add 00006 to ZERO giving FFL-SIZE
           add MKN-BU-23 to ZERO giving NRBU-02-03
           move SPACES to WORK-AREA-X2
           move NGBU-02-03(01:02) to WORK-AREA-X2(01:02)
           move '.'               to WORK-AREA-X2(03:1)
           move NGBU-02-03(03:03) to WORK-AREA-X2(04:03)
           perform POST-TEXT-TO-CSV
      *
      *    Binary-UnSign move, MKN-BU-52
           add 00008 to ZERO giving FFL-SIZE
           add MKN-BU-52 to ZERO giving NRBU-05-02
           move SPACES to WORK-AREA-X2
           move NGBU-05-02(01:05) to WORK-AREA-X2(01:05)
           move '.'               to WORK-AREA-X2(06:1)
           move NGBU-05-02(06:02) to WORK-AREA-X2(07:02)
           perform POST-TEXT-TO-CSV
      *
      *    Binary-UnSign move, MKN-BU-60
           add 00006 to ZERO giving FFL-SIZE
           add MKN-BU-60 to ZERO giving NRBU-06-00
           move SPACES to WORK-AREA-X2
           move NGBU-06-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-UnSign move, MKN-BU-20
           add 00002 to ZERO giving FFL-SIZE
           add MKN-BU-20 to ZERO giving NRBU-02-00
           move SPACES to WORK-AREA-X2
           move NGBU-02-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Packed-Signed move, MKN-PS-72
           add 00011 to ZERO giving FFL-SIZE
           if MKN-PS-72 is NUMERIC
              add MKN-PS-72 to ZERO giving NRPS-07-02
           else
              move ZERO to NRPS-07-02
           end-if
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGPS-07-02(01:01) to WORK-AREA-X2(01:01)
           move NGPS-07-02(02:07) to WORK-AREA-X2(02:07)
           move '.'               to WORK-AREA-X2(09:1)
           move NGPS-07-02(09:02) to WORK-AREA-X2(10:02)
           perform POST-TEXT-TO-CSV
      *
      *    Packed-Signed move, MKN-PS-23
           add 00007 to ZERO giving FFL-SIZE
           if MKN-PS-23 is NUMERIC
              add MKN-PS-23 to ZERO giving NRPS-02-03
           else
              move ZERO to NRPS-02-03
           end-if
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGPS-02-03(01:01) to WORK-AREA-X2(01:01)
           move NGPS-02-03(02:02) to WORK-AREA-X2(02:02)
           move '.'               to WORK-AREA-X2(04:1)
           move NGPS-02-03(04:03) to WORK-AREA-X2(05:03)
           perform POST-TEXT-TO-CSV
      *
      *    Packed-Signed move, MKN-PS-52
           add 00009 to ZERO giving FFL-SIZE
           if MKN-PS-52 is NUMERIC
              add MKN-PS-52 to ZERO giving NRPS-05-02
           else
              move ZERO to NRPS-05-02
           end-if
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGPS-05-02(01:01) to WORK-AREA-X2(01:01)
           move NGPS-05-02(02:05) to WORK-AREA-X2(02:05)
           move '.'               to WORK-AREA-X2(07:1)
           move NGPS-05-02(07:02) to WORK-AREA-X2(08:02)
           perform POST-TEXT-TO-CSV
      *
      *    Packed-Signed move, MKN-PS-60
           add 00007 to ZERO giving FFL-SIZE
           if MKN-PS-60 is NUMERIC
              add MKN-PS-60 to ZERO giving NRPS-06-00
           else
              move ZERO to NRPS-06-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGPS-06-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Packed-Signed move, MKN-PS-20
           add 00003 to ZERO giving FFL-SIZE
           if MKN-PS-20 is NUMERIC
              add MKN-PS-20 to ZERO giving NRPS-02-00
           else
              move ZERO to NRPS-02-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGPS-02-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Packed-UnSign move, MKN-PU-72
           add 00010 to ZERO giving FFL-SIZE
           if MKN-PU-72 is NUMERIC
              add MKN-PU-72 to ZERO giving NRPU-07-02
           else
              move ZERO to NRPU-07-02
           end-if
           move SPACES to WORK-AREA-X2
           move NGPU-07-02(01:07) to WORK-AREA-X2(01:07)
           move '.'               to WORK-AREA-X2(08:1)
           move NGPU-07-02(08:02) to WORK-AREA-X2(09:02)
           perform POST-TEXT-TO-CSV
      *
      *    Packed-UnSign move, MKN-PU-23
           add 00006 to ZERO giving FFL-SIZE
           if MKN-PU-23 is NUMERIC
              add MKN-PU-23 to ZERO giving NRPU-02-03
           else
              move ZERO to NRPU-02-03
           end-if
           move SPACES to WORK-AREA-X2
           move NGPU-02-03(01:02) to WORK-AREA-X2(01:02)
           move '.'               to WORK-AREA-X2(03:1)
           move NGPU-02-03(03:03) to WORK-AREA-X2(04:03)
           perform POST-TEXT-TO-CSV
      *
      *    Packed-UnSign move, MKN-PU-52
           add 00008 to ZERO giving FFL-SIZE
           if MKN-PU-52 is NUMERIC
              add MKN-PU-52 to ZERO giving NRPU-05-02
           else
              move ZERO to NRPU-05-02
           end-if
           move SPACES to WORK-AREA-X2
           move NGPU-05-02(01:05) to WORK-AREA-X2(01:05)
           move '.'               to WORK-AREA-X2(06:1)
           move NGPU-05-02(06:02) to WORK-AREA-X2(07:02)
           perform POST-TEXT-TO-CSV
      *
      *    Packed-UnSign move, MKN-PU-60
           add 00006 to ZERO giving FFL-SIZE
           if MKN-PU-60 is NUMERIC
              add MKN-PU-60 to ZERO giving NRPU-06-00
           else
              move ZERO to NRPU-06-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGPU-06-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Packed-UnSign move, MKN-PU-20
           add 00002 to ZERO giving FFL-SIZE
           if MKN-PU-20 is NUMERIC
              add MKN-PU-20 to ZERO giving NRPU-02-00
           else
              move ZERO to NRPU-02-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGPU-02-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Number-Signed move, MKN-ZS-72
           add 00011 to ZERO giving FFL-SIZE
           if MKN-ZS-72 is NUMERIC
              add MKN-ZS-72 to ZERO giving NRZS-07-02
           else
              move ZERO to NRZS-07-02
           end-if
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGZS-07-02(01:01) to WORK-AREA-X2(01:01)
           move NGZS-07-02(02:07) to WORK-AREA-X2(02:07)
           move '.'               to WORK-AREA-X2(09:1)
           move NGZS-07-02(09:02) to WORK-AREA-X2(10:02)
           perform POST-TEXT-TO-CSV
      *
      *    Number-Signed move, MKN-ZS-23
           add 00007 to ZERO giving FFL-SIZE
           if MKN-ZS-23 is NUMERIC
              add MKN-ZS-23 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
      *
      *    Number-Signed move, MKN-ZS-52
           add 00009 to ZERO giving FFL-SIZE
           if MKN-ZS-52 is NUMERIC
              add MKN-ZS-52 to ZERO giving NRZS-05-02
           else
              move ZERO to NRZS-05-02
           end-if
           move SPACES to WORK-AREA-X2
      *    Format a SIGN LEADING SEPARATE Numeric Field
           move NGZS-05-02(01:01) to WORK-AREA-X2(01:01)
           move NGZS-05-02(02:05) to WORK-AREA-X2(02:05)
           move '.'               to WORK-AREA-X2(07:1)
           move NGZS-05-02(07:02) to WORK-AREA-X2(08:02)
           perform POST-TEXT-TO-CSV
      *
      *    Number-Signed move, MKN-ZS-60
           add 00007 to ZERO giving FFL-SIZE
           if MKN-ZS-60 is NUMERIC
              add MKN-ZS-60 to ZERO giving NRZS-06-00
           else
              move ZERO to NRZS-06-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGZS-06-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Number-Signed move, MKN-ZS-20
           add 00003 to ZERO giving FFL-SIZE
           if MKN-ZS-20 is NUMERIC
              add MKN-ZS-20 to ZERO giving NRZS-02-00
           else
              move ZERO to NRZS-02-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGZS-02-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Number-UnSign move, MKN-ZU-72
           add 00010 to ZERO giving FFL-SIZE
           if MKN-ZU-72 is NUMERIC
              add MKN-ZU-72 to ZERO giving NRZU-07-02
           else
              move ZERO to NRZU-07-02
           end-if
           move SPACES to WORK-AREA-X2
           move NGZU-07-02(01:07) to WORK-AREA-X2(01:07)
           move '.'               to WORK-AREA-X2(08:1)
           move NGZU-07-02(08:02) to WORK-AREA-X2(09:02)
           perform POST-TEXT-TO-CSV
      *
      *    Number-UnSign move, MKN-ZU-23
           add 00006 to ZERO giving FFL-SIZE
           if MKN-ZU-23 is NUMERIC
              add MKN-ZU-23 to ZERO giving NRZU-02-03
           else
              move ZERO to NRZU-02-03
           end-if
           move SPACES to WORK-AREA-X2
           move NGZU-02-03(01:02) to WORK-AREA-X2(01:02)
           move '.'               to WORK-AREA-X2(03:1)
           move NGZU-02-03(03:03) to WORK-AREA-X2(04:03)
           perform POST-TEXT-TO-CSV
      *
      *    Number-UnSign move, MKN-ZU-52
           add 00008 to ZERO giving FFL-SIZE
           if MKN-ZU-52 is NUMERIC
              add MKN-ZU-52 to ZERO giving NRZU-05-02
           else
              move ZERO to NRZU-05-02
           end-if
           move SPACES to WORK-AREA-X2
           move NGZU-05-02(01:05) to WORK-AREA-X2(01:05)
           move '.'               to WORK-AREA-X2(06:1)
           move NGZU-05-02(06:02) to WORK-AREA-X2(07:02)
           perform POST-TEXT-TO-CSV
      *
      *    Number-UnSign move, MKN-ZU-60
           add 00006 to ZERO giving FFL-SIZE
           if MKN-ZU-60 is NUMERIC
              add MKN-ZU-60 to ZERO giving NRZU-06-00
           else
              move ZERO to NRZU-06-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGZU-06-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Number-UnSign move, MKN-ZU-20
           add 00002 to ZERO giving FFL-SIZE
           if MKN-ZU-20 is NUMERIC
              add MKN-ZU-20 to ZERO giving NRZU-02-00
           else
              move ZERO to NRZU-02-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGZU-02-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: 2016/01/11  Generation Time: 11:20:41:48    *
      *****************************************************************

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

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

      *****************************************************************
      *               MKN256B1.cpy - a COBOL Copy File                *
      *   Copy File for testing of Text Strings and Numeric Formats.  *
      *****************************************************************
      *         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       *
      *****************************************************************
       01  MKN-RECORD.
           05  MKN-TEXT.
               10  MKN-ID                PIC X.
               10  MKN-TAG               PIC X(08).
               10  MKN-COMMENT           PIC X(23).
      *
      * ------------------------------------------------------------- *
      *    A group of SIGNED and UNSIGNED Numbers using a
      *    COMPUTATIONAL format.
      *    The physical structure is Binary.
      *    An abbreviated form of the USAGE IS COMPUTATIONAL clause
      *    is simply coded in COMP.
      *    An following statement is an example of the full sysntax.
      *    01  FIELD-NAME    PIC S9(5)V99  USAGE IS COMPUTATIONAL.
      *
           05  MKN-BS-NBRS.
               10  MKN-BS-72             PIC S9(7)V99   COMP.
               10  MKN-BS-23             PIC S9(2)V999  COMP.
               10  MKN-BS-52             PIC S9(5)V99   COMP.
               10  MKN-BS-60             PIC S9(6)      COMP.
               10  MKN-BS-20             PIC S99        COMP.
           05  MKN-BU-NBRS.
               10  MKN-BU-72             PIC 9(7)V99    COMP.
               10  MKN-BU-23             PIC 9(2)V999   COMP.
               10  MKN-BU-52             PIC 9(5)V99    COMP.
               10  MKN-BU-60             PIC 9(6)       COMP.
               10  MKN-BU-20             PIC 99         COMP.
      *
      * ------------------------------------------------------------- *
      *    A group of SIGNED and UNSIGNED Numbers using a
      *    COMPUTATIONAL-3 format.
      *    The physical structure is Packed Decimal.
      *    An abbreviated form of the USAGE IS COMPUTATIONAL-3 clause
      *    is simply coded in COMP-3.
      *    An following statement is an example of the full sysntax.
      *    01  FIELD-NAME    PIC S9(5)V99  USAGE IS COMPUTATIONAL-3.
      *
           05  MKN-PS-NBRS.
               10  MKN-PS-72             PIC S9(7)V99   COMP-3.
               10  MKN-PS-23             PIC S9(2)V999  COMP-3.
               10  MKN-PS-52             PIC S9(5)V99   COMP-3.
               10  MKN-PS-60             PIC S9(6)      COMP-3.
               10  MKN-PS-20             PIC S99        COMP-3.
           05  MKN-PU-NBRS.
               10  MKN-PU-72             PIC 9(7)V99    COMP-3.
               10  MKN-PU-23             PIC 9(2)V999   COMP-3.
               10  MKN-PU-52             PIC 9(5)V99    COMP-3.
               10  MKN-PU-60             PIC 9(6)       COMP-3.
               10  MKN-PU-20             PIC 99         COMP-3.
      *
      * ------------------------------------------------------------- *
      *    A group of SIGNED and UNSIGNED Numbers using a
      *    DISPLAY format.
      *    The physical structure is Zoned Decimal.
      *    The USAGE IS DISPLAY clause is the default value and
      *    is typically not hard coded.
      *    An following statement is an example of the full sysntax.
      *    01  FIELD-NAME    PIC S9(5)V99  USAGE IS DISPLAY.
      *
           05  MKN-ZS-NBRS.
               10  MKN-ZS-72             PIC S9(7)V99.
               10  MKN-ZS-23             PIC S9(2)V999.
               10  MKN-ZS-52             PIC S9(5)V99.
               10  MKN-ZS-60             PIC S9(6).
               10  MKN-ZS-20             PIC S99.
           05  MKN-ZU-NBRS.
               10  MKN-ZU-72             PIC 9(7)V99.
               10  MKN-ZU-23             PIC 9(2)V999.
               10  MKN-ZU-52             PIC 9(5)V99.
               10  MKN-ZU-60             PIC 9(6).
               10  MKN-ZU-20             PIC 99.
      *
           05  FILLER                   PIC X(86).
      *
      * ------------------------------------------------------------- *
      *    A Text string to tag the end of a record.
      *
           05  MKN-TEXT-END.
               10  MKN-END               PIC X(8).
      *
      ***  MKN256B1 - End-of-Copy File - - - - - - - - - - - MKN256B1 *
      *****************************************************************
      *

The following is the link to the HTML document created from the field definitions defined in the COBOL copy file.

Link to Internet   Link to Server   Explore numeric values that use the BINARY, PACKED and ZONED format. This HTML document was generated by SimoTime Technologies and uses the field definitions included in a user-defined COBOL copy file to calculate additional information such as the field positions within the record.

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 record sequential file with a Fixed-Field-Length structure and create a record sequential with the fields separated by a comma. The output file may be easily imported into an Excel spread sheet. The following (EXN25601.pcf) shows the content of the Process Control File.

***********************************************************************
*                EXN25601.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 a Record Sequential file, 256-byte fixed-length records.
* SYSUT2 is a Record Sequential file, 1024-byte fixed-length records.
***********************************************************************
* This Process Control File will be used to generate a callable COBOL
* routine that will extract data from an existing sequential file and
* create a new record sequential file with a CSV record structure of
* concatenated fields separated by a comma.
* The input file (SYSUT1) is expected to be an ASCII-encoded, record
* sequential file.
* The output file that contains a CSV record structure may be easily
* imported into an Excel spread sheet.
* Refer to the utconv01.htm document for additional detail.
*
* Note: CSV - abbreviation for Comma Separated Values.
*
* 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  MKN256B1.cpy
&HTMLFILE  mkn256B1.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 Text and Numeric Values
&PROGID    EXN256C1
&SYSUT1    org=Sequential recfm=FIXED    rlen=256
&SYSUT2    org=Sequential recfm=FIXED    rlen=1024
*
* 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   EXN256R1
&EXTREC    MKN-RECORD
&EXTLREC   1024
&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   MKN-ID
&EXTRACT   MKN-TAG
&EXTRACT   MKN-COMMENT
*
&EXTRACT   MKN-BS-72
&EXTRACT   MKN-BS-23
&EXTRACT   MKN-BS-52
&EXTRACT   MKN-BS-60
&EXTRACT   MKN-BS-20
*
&EXTRACT   MKN-BU-72
&EXTRACT   MKN-BU-23
&EXTRACT   MKN-BU-52
&EXTRACT   MKN-BU-60
&EXTRACT   MKN-BU-20
*
&EXTRACT   MKN-PS-72
&EXTRACT   MKN-PS-23
&EXTRACT   MKN-PS-52
&EXTRACT   MKN-PS-60
&EXTRACT   MKN-PS-20
*
&EXTRACT   MKN-PU-72
&EXTRACT   MKN-PU-23
&EXTRACT   MKN-PU-52
&EXTRACT   MKN-PU-60
&EXTRACT   MKN-PU-20
*
&EXTRACT   MKN-ZS-72
&EXTRACT   MKN-ZS-23
&EXTRACT   MKN-ZS-52
&EXTRACT   MKN-ZS-60
&EXTRACT   MKN-ZS-20
*
&EXTRACT   MKN-ZU-72
&EXTRACT   MKN-ZU-23
&EXTRACT   MKN-ZU-52
&EXTRACT   MKN-ZU-60
&EXTRACT   MKN-ZU-20
*
&END

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 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.

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 a Sequential File with Packed and Binary Values
Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com