Data Extract
Item Master File
  Table of Contents  v-16.01.01 - itmext01.htm 
  Introduction
  Possibilities and Considerations
  JCL Member
  The COBOL Programs
  COBOL, the I/O Program
  COBOL, the Conversion Routine
  The Program Generation Process
  The Process Control File
  COBOL Copy File, Record Structure
  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 suite of sample programs describes how to extract data from the Item Master File. The numeric fields will be expanded (Packed or Binary) and the trailing spaces within the text fields will be truncated. A new record will be constructed with the fields being concatenated and separated by a comma. The newly constructed record will be written to a sequential file. The file may now be transferred from the mainframe to a Windows system using the File Transfer Protocol (FTP) and easily imported into a Microsoft Excel spreadsheet.

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 Item Master File and writing reformatted records to a sequential file. The File I/O program calls the second program to do the record formatting that expands the numeric fields and does blank truncation on the text fields and then places a comma between the fields as the field delimiter.

Note:  The COBOL conversion 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-2019
SimoTime Technologies and Services
All Rights Reserved

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

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 file content conversion from EBCDIC to ASCII.

Link to Internet   Link to Server   Explore How to do File Format and Record Content Conversion of a Record Sequential File with EBCDIC encoded records to a Line Sequential File (or ASCII/Text File) with ASCII encoded records.

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.

Link to Internet   Link to Server   Explore How to do File Format Conversion of a Record Sequential File to a Line Sequential File (or ASCII/Text File).

Micro Focus supports a number of file formats on the Linux, Unix and Windows Systems. The various non-relational data structures are described in a separate document.

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 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 (ITEXTJ01.jcl) is a listing of the JCL member needed to run this job.

//ITEXTJ01 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*        This program is provided by SimoTime Technologies          *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Read Item Master File, write to a sequential file
//* Author - SimoTime Technologies
//* Date   - January 01, 1989
//*
//* This set of programs will run on a mainframe under MVS or on
//* a Personal Computer running Windows and Mainframe Express by
//* Micro Focus.
//*
//*   ************                    ************
//*   *  Entry   *                    *  Entry   *
//*   *   MVS    *                    * Windows  *
//*   ************                    ************
//*        *                               *
//*   ************                    ************
//*   * ITEXTJ01 *                    * ITEXTJ01 *
//*   ********jcl*                    ********cmd*
//*        *                               *
//*   ************                         *
//*   * IEFBR14  *                         *
//*   ********utl*                         *
//*        *                               *
//*        *********************************
//*                        *
//*                        *
//*   ************    ************    ************
//*   * ITEMMAST *----* ITMEXTC1 *----* ITEMRCSV *
//*   ************    ********cbl*    ********dat*
//*                        *   *
//*                        *   *
//*                        *   *---CALL----*
//*                        *               *
//*                        *               *
//*                        *          ************
//*                        *          * ITMEXTR1 *
//*                        *          ********cbl*
//*                        *
//*                   ************
//*                   *   EOJ    *
//*                   ************
//*
//* *******************************************************************
//* Step   1 of 2  This job step will delete a previously created file.
//*
//DELTSEQ1 EXEC PGM=IEFBR14
//ITEMRCSV DD  DSN=SIMOTIME.DATA.ITEMRCSV,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=256,DSORG=PS)
//* *******************************************************************
//* Step   2 of 2  Execute the Sample programs....
//*
//CBLEXTS1 EXEC PGM=ITMEXTC1
//STEPLIB  DD  DSN=MFI01.SIMOPROD.LOADLIB,DISP=SHR
//ITEMMAST DD  DSN=SIMOTIME.DATA.ITEMMAST,DISP=SHR
//ITEMRCSV DD  DSN=SIMOTIME.DATA.ITEMRCSV,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=256,DSORG=PS)
//SYSOUT   DD   *
//*

Table of Contents Previous Section Next Section The COBOL Programs

The File Format and Record Content conversion process uses two COBOL programs. The first program is the File I/O program that does the file format conversion. The record content conversion is accomplished by the I/O program calling a second program that does the record content conversion.

Table of Contents Previous Section Next Section COBOL, the I/O Program

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

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    ITMEXTC1.
       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: 2018-10-10  Generation Time: 20:28:23:68    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   ITEMMAST INDEXED       VARIABLE   00512    00001   *
      *                                              00012    00012   *
      *  SECONDARY ITEMRCSV SEQUENTIAL    VARIABLE   00256            *
      *                                                               *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT ITEMMAST-FILE  ASSIGN TO       ITEMMAST
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS SEQUENTIAL
                  RECORD KEY    IS ITEMMAST-PKEY-00001-00012
                  FILE STATUS   IS ITEMMAST-STATUS.
           SELECT ITEMRCSV-FILE  ASSIGN TO       ITEMRCSV
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS ITEMRCSV-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  ITEMMAST-FILE
           DATA RECORD    IS ITEMMAST-REC
           .
       01  ITEMMAST-REC.
           05  ITEMMAST-PKEY-00001-00012        PIC X(00012).
           05  ITEMMAST-DATA-00013-00500        PIC X(00500).

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

      *****************************************************************
      * This program was created with the SYSMASK1.TXT file as input. *
      * The SYSMASK1 provides for the sequential reading of the input *
      * file and the sequential writing of the output file.           *
      *                                                               *
      * If the output file is indexed then the input file must be in  *
      * sequence by the field that will be used to provide the key    *
      * for the output file. This is a sequential load process.       *
      *                                                               *
      * If the key field is not in sequence then refer to SYSMASK2    *
      * to provide for a random add or update of the indexed file.    *
      *                                                               *
      * This program mask will have the ASCII/EBCDIC table inserted   *
      * for use by the /TRANSLATE function of SimoZAPS.               *
      *                                                               *
      * For more information or questions please contact SimoTime     *
      * Technologies. The version control number is 16.01.01          *
      *                                                               *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* ITMEXTC1 '.
           05  T2 pic X(34) value 'Extract From Item Master to RCSV  '.
           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 '* ITMEXTC1 '.
           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  ITEMMAST-STATUS.
           05  ITEMMAST-STATUS-L     pic X.
           05  ITEMMAST-STATUS-R     pic X.
       01  ITEMMAST-EOF              pic X       value 'N'.
       01  ITEMMAST-OPEN-FLAG        pic X       value 'C'.

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

       01  ITEMMAST-LRECL            pic 9(5)    value 00512.
       01  ITEMRCSV-LRECL            pic 9(5)    value 00256.
       01  ITEMMAST-LRECL-MAX        pic 9(5)    value 00512.
       01  ITEMRCSV-LRECL-MAX        pic 9(5)    value 00256.

      *****************************************************************
      * The following buffers are used to create a four-byte status   *
      * code that may be displayed.                                   *
      *****************************************************************
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  IO-STATUS-04.
           05  IO-STATUS-0401      pic 9     value 0.
           05  IO-STATUS-0403      pic 999   value 0.
       01  TWO-BYTES-BINARY        pic 9(4)  BINARY.
       01  TWO-BYTES-ALPHA         redefines TWO-BYTES-BINARY.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(011)  value '* ITMEXTC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(068)  value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.
       01  MSG-LSB                 pic 9(5)    value 267.

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

       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 From Item Master to RCSV  '.
           05  filler      pic X(24)
               value ' http://www.SimoTime.com'.

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

       01  WRITE-FLAG      pic X       value 'Y'.

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

      *****************************************************************
       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 ITEMMAST-OPEN
           perform ITEMRCSV-OPEN

      *    USRSOJ Processing not specified...

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

      *    USREOJ Processing not specified...

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

           move ITEMRCSV-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 ITEMRCSV-CLOSE
           perform ITEMMAST-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    Extract CALL process...
           call 'ITMEXTR1'                        using ITEMRCSV-REC
                                                        ITEMMAST-REC
           add 00256 to ZERO giving ITEMRCSV-LRECL
           exit.

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

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

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

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

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           perform Z-CALCULATE-MESSAGE-LSB
           display MESSAGE-BUFFER(1:MSG-LSB)
           move all SPACES to MESSAGE-TEXT
           exit.

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

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

Table of Contents Previous Section Next Section COBOL, the Conversion Routine

The following (ITMEXTR1.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/XP. The program was successfully executed in both an EBCDIC and ASCII encoded configuration.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    ITMEXTR1.
       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: 2018/10/10  Generation Time: 20:28:23:74    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  NGZU-12-00.
           05  NRZU-12-00  pic  9(12).
       01  NGBU-07-00.
           05  NRBU-07-00  pic  9(07).
       01  NGPS-07-02.
           05  NRPS-07-02  pic S9(07)V9(02)
                           SIGN LEADING SEPARATE.

       01  IX-P1               pic 9(9)      value 0.
       01  IX-P2               pic 9(9)      value 0.
       01  IX-NP               pic 9(5)      value 0.
       01  IX-L1               pic 9(9)      value 0.
       01  RA-P1               pic 9(3)      value 0.
       01  RA-P2               pic 9(3)      value 0.
       01  COLUMN-NUMBER       pic 9(5)      value 0.
       01  WORK-AREA-X.
           05  WORK-AREA-X1    pic X         value '"'.
           05  WORK-AREA       pic X(00288)  value SPACES.
       01  WORK-AREA-X2        pic X(00256)  value SPACES.
       01  FRAME-STOP.
           05  FRAME-BYTE      pic X         value '"'.
           05  DELIMITER-BYTE  pic X         value ','.
       01  FRAME-FLAG          pic X         value 'N'.
       01  O-FLAG              pic X(3)      value 'CSV'.
       01  BYTE-Y              pic X         value 'Y'.
       01  BYTE-N              pic X         value 'N'.
       01  FRAME-COUNT         pic 9(5)      value 0.
       01  DELIM-COUNT         pic 9(5)      value 0.
       01  FFL-SIZE            pic 9(5)      value 0.
       01  CSV-SIZE            pic 9(5)      value 0.
       01  TXT-SIZE            pic 9(5)      value 0.
       01  LAST-NON-SPACE-BYTE pic 9(5)      value 0.
       01  SIGN-BYTE           pic X         value SPACE.
       01  DIG-POS             pic 9(3).
       01  DIG-LEN             pic 9(3).
       01  DIG-CTL             pic 9(3).
       01  DEC-POS             pic 9(3).
       01  DEC-LEN             pic 9(3).
       01  DEC-CTL             pic 9(3).
       01  DEC-POINT           pic 9(3).
       01  WRK-POS             pic 9(3).
      *
      *****************************************************************
       LINKAGE SECTION.
       01  REC1CALL-REC pic X(00256).
       COPY ITEMCB01.
      *
      *****************************************************************
       PROCEDURE DIVISION using REC1CALL-REC
                                ITEM-RECORD.
      *
           add 1 to ZERO giving IX-NP
           move all SPACES
             to REC1CALL-REC
      *
      *    Number-UnSign move, ITEM-NUMBER
           add 00012 to ZERO giving FFL-SIZE
           if ITEM-NUMBER is NUMERIC
              add ITEM-NUMBER to ZERO giving NRZU-12-00
           else
              move ZERO to NRZU-12-00
           end-if
           move SPACES to WORK-AREA-X2
           move NGZU-12-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, ITEM-DESCRIPTION
           add 00048 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move ITEM-DESCRIPTION to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-UnSign move, ITEM-QTY-ONHAND
           add 00007 to ZERO giving FFL-SIZE
           add ITEM-QTY-ONHAND to ZERO giving NRBU-07-00
           move SPACES to WORK-AREA-X2
           move NGBU-07-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Binary-UnSign move, ITEM-QTY-ALLOCATED
           add 00007 to ZERO giving FFL-SIZE
           add ITEM-QTY-ALLOCATED to ZERO giving NRBU-07-00
           move SPACES to WORK-AREA-X2
           move NGBU-07-00 to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, ITEM-UNIT-OF-MEASURE
           add 00016 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move ITEM-UNIT-OF-MEASURE to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    Packed-Signed move, ITEM-COST
           add 00011 to ZERO giving FFL-SIZE
           if ITEM-COST is NUMERIC
              add ITEM-COST 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, ITEM-PRICE
           add 00011 to ZERO giving FFL-SIZE
           if ITEM-PRICE is NUMERIC
              add ITEM-PRICE 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
      *
      *    String Move, ITEM-LADATE
           add 00008 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move ITEM-LADATE to WORK-AREA-X2
           perform POST-TEXT-TO-CSV
      *
      *    String Move, ITEM-LATIME
           add 00008 to ZERO giving FFL-SIZE
           move SPACES to WORK-AREA-X2
           move ITEM-LATIME 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: 2018/10/10  Generation Time: 20:28:23:74    *
      *****************************************************************

Table of Contents Previous Section Next Section The Program Generation Process

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

Table of Contents Previous Section Next Section The Process Control File

The following (ITMEXT01.pcf) is the Process Control File used to generate the conversion programs.

***********************************************************************
*                ITMEXT01.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 should be an ASCII-encoded Item Master File.
* SYSUT2 should be an ASCII/Text, 256-byte, variable, text file.
***********************************************************************
* This set of specification will generate a callable COBOL routine that
* will extract data from the item master file and create a Record
* Sequential file with the fields separated by a comma. The new file
* may be easily imported into an Excel spread sheet.
*
&SIMOPREP  call ..\..\ENV1BASE
&USERPREP  call USERCONV
&CONFORM   IBM
&COPYFILE  ITEMCB01.CPY
&HTMLFILE  itemcb01.htm
&DIALECT   C2
*HEAD34    ....:....1....:....2....:....3....
&HEAD34    Extract From Item Master to RCSV
&PROGID    ITMEXTC1
&SYSUT1    name=ITEMMAST org=Indexed    recfm=VARIABLE rmin=12 rmax=512 kpos=1 klen=12
&SYSUT2    name=ITEMRCSV org=SEQUENTIAL recfm=VARIABLE rmax=256
*
&EXTCALL   ITMEXTR1
&EXTREC    ITEM-RECORD
&EXTLREC   256
&EXTFMT    CSV ,
&EXTINIT   SPACES
&EXTHDR    YES
&EXTRACT   ITEM-NUMBER
&EXTRACT   ITEM-DESCRIPTION
&EXTRACT   ITEM-QTY-ONHAND
&EXTRACT   ITEM-QTY-ALLOCATED
&EXTRACT   ITEM-UNIT-OF-MEASURE
&EXTRACT   ITEM-COST
&EXTRACT   ITEM-PRICE
&EXTRACT   ITEM-LADATE
&EXTRACT   ITEM-LATIME
*
&END

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

The following (ITEMCB01.cpy) is the COBOL Copy File used to generate the conversion programs. The copy file provides the field definitions.

      *****************************************************************
      *               ITEMCB01.CPY - a COBOL Copy File                *
      *        An Item 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       *
      *****************************************************************
      *
       01  ITEM-RECORD.
           05  ITEM-NUMBER              PIC 9(12).                      COL-A
           05  ITEM-DATA.
               10  ITEM-DESCRIPTION     PIC X(48).                      COL-B
               10  ITEM-QTY-ONHAND      PIC 9(7)            COMP.       COL-C
               10  ITEM-QTY-ALLOCATED   PIC 9(7)            COMP.       COL-D
               10  ITEM-UNIT-OF-MEASURE PIC X(16).                      COL-E
               10  ITEM-COST            PIC S9(7)V9(2)      COMP-3.     COL-F
               10  ITEM-PRICE           PIC S9(7)V9(2)      COMP-3.     COL-G
               10  ITEM-LADATE          PIC X(8).                       COL-H
               10  ITEM-LATIME          PIC X(8).                       COL-I
               10  ITEM-TOKEN           PIC X(3).
               10  ITEM-DISCOUNT        OCCURS 3 TIMES.
                   15  ITEM-D-CODE      PIC X.
                   15  ITEM-D-PERCENT   PIC S9(3)V9(4).
               10  FILLER               PIC X(375).
      *
      ***  ITEMCB01 - End-of-Copy File - - - - - - - - - - - ITEMCB01 *
      *****************************************************************
      *

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 document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

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

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

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

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

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

Table of Contents Previous Section Next Section Downloads and Links

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

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

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

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

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

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

Link to Internet   Link to Server   Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.

Link to Internet   Link to Server   Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.

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