EBCDIC to ASCII Convert
Customer File with Packed & Binary Data
  Table of Contents  v-24.01.01 - cuse2a01.htm 
  Introduction
  JCL Member
  CMD File
  The COBOL I/O Program
  The COBOL Conversion Routine
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Contact or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This suite of sample programs describes how to convert an EBCDIC encoded VSAM Key-Sequenced-Data-Set (KSDS) to an ASCII encoded VSAM Key-Sequenced-Data-Set (KSDS). The SimoTime Utility program is used to accomplish this task. The utility program does not actually do the conversion. It generates two (2) COBOL programs that are capable of doing both file format and file content conversion.

The first program does the File I/O (i.e. file format conversion) of reading the EBCDIC encoded Customer Master File and writing the new ASCII encoded Customer Master File. The File I/O program calls the second program (i.e. file content conversion) to do the EBCDIC to ASCII conversion of the records within the file. The COBOL programs were generated by SimoTime technology using a COBOL copy file that defines the record layout. The generation of the programs is done on a Windows system running Micro Focus COBOL. However, since the generated COBOL source code is COBOL/390 compliant it may be compiled and executed on an IBM Mainframe, a Windows system with Micro Focus or a UNIX system with Micro Focus.

Note: For the Micro Focus environment the programs are normally compiled using a Mainframe dialect using he CHARSET(EBCDIC) or CHARSET(ASCII) compiler directives. If the programs are compiled using a non-Mainframe dialect the IBMCOMP directive must be used since the customer master file used in this example contains binary (or COMP) fields.


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

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

//CUSE2AJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CUSE2AJ1.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   -   Execute a COBOL program to read VSAM and write VSAM.
//* Author -   SimoTime Technologies
//* Date   -   January 01, 1997
//*
//* This COBOL program will read a VSAM, KSDS, EBCDIC, 512-byte,
//* record-length file and write a KSDS, VSAM ASCII-encoded data set.
//*
//*                     ************
//*                     * CUSE2AJ1 *
//*                     ********jcl*
//*                          *
//*                          *
//*    ************     ************     ************
//*    * CUS512KE *-----* CUSE2AIO *-----* CUS512KA *
//*    *******ksds*     ********cbl*     *******ksds*
//*                          *
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step 1 of 2, Delete/Define a VSAM Data Set.
//*
//CUCRTS01 EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
 DELETE    SIMOTIME.DATA.CUS512KA   -
           FILE (CUS512KA)          -
           PURGE                    -
           ERASE                    -
           CLUSTER
 SET       MAXCC = 0
 DEFINE    CLUSTER  (NAME(SIMOTIME.DATA.CUS512KA)             -
                    TRACKS(45,15)                             -
                    INDEXED)                                  -
           DATA     (NAME(SIMOTIME.DATA.CUS512KA.DAT)         -
                    KEYS(12,0)                                -
                    RECORDSIZE(512,512)                       -
                    FREESPACE(10,15)                          -
                    CISZ(8192))                               -
           INDEX    (NAME(SIMOTIME.DATA.CUS512KA.IDX))
//*
//* *******************************************************************
//* Step 2 of 2, Convert from EBCDIC-encoding to ASCII-encoding.
//*
//CUSE2AS1 EXEC PGM=CUSE2AIO
//STEPLIB  DD  DISP=SHR,DSN=SIMOTIME.DEMO.LOADLIB1
//CUS512KE DD  DISP=SHR,DSN=SIMOTIME.DATA.CUS512KE
//CUS512KA DD  DISP=SHR,DSN=SIMOTIME.DATA.CUS512KA
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section CMD File

The following is the Windows Command file (CUSE2AE1.cmd) that is needed to run this job as a batch task in a Micro Focus and Windows environment without Mainframe JCL emulation.

@echo OFF
rem  * *******************************************************************
rem  *               CUSE2AE1.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 EBCDIC Customer Master, write ASCII Customer Master.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job will read an EBCDIC-encoded Customer Master File and write
rem  * write to a new ASCII-encoded Customer Master File.
rem  *
rem  *    ************
rem  *    * CUSE2AE1 *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    * Env1PROD *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    * SimoNOTE *
rem  *    ********cmd*
rem  *         *
rem  *         *
rem  *    ************
rem  *    *   RUN    *****************************
rem  *    ********rts*                           *
rem  *         *           ************     ************     ************
rem  *         *           * CUS512KE ******* CusE2AIO ******* CUS512KA *
rem  *         *           *******ksds*     ********cbl*     *******ksds*
rem  *         *                                 *
rem  *         *                            ************
rem  *         *                            * CusE2AR1 *
rem  *         *                            ********cbl*
rem  *    ************
rem  *    *   EOJ    *
rem  *    ************
rem  *
rem  * *******************************************************************
rem  * Step 1, Set Environment Variables
rem  *         Delete any previously created ASCII-encoded file...
rem  *
     call ..\Env1BASE
     set CmdName=CUSE2AE1
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
     call SimoNOTE "Identify JobStep Step-1, Housekeeping tasks"
     set CUS512KE=%BaseLib1%\DATA\Ebc1\CUS512KE.DAT
     set CUS512KA=%BaseLib1%\DATA\Wrk1\CUS512KA.DAT
     if exist %CUS512KA% del %CUS512KA%
rem  *
rem  * *******************************************************************
rem  * Step 2, Read EBCDIC-encoded KSDS, create a new ASCII-encoded KSDS
rem  *
     call SimoNOTE "Identify JobStep Step-2, Execute EBCDIC to ASCII Conversion"
     run CUSE2AIO
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto :EojNOK
:EojAOK
     call SimoNOTE "DataTAKE - %CUS512KE%"
     call SimoNOTE "DataMAKE - %CUS512KA%"
     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 I/O Program

The following (CUSE2AIO.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 were successfully executed in both an EBCDIC and ASCII encoded configuration.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUSE2AIO.
       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:15:85    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   CUSGETKE INDEXED       VARIABLE   00512    00001   *
      *                                              00512    00012   *
      *  SECONDARY CUSPUTKA INDEXED       VARIABLE   00512    00001   *
      *                                              00512    00012   *
      *                                                               *
      *            Translation Mode is EBCDIC to ASCII                *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT CUSGETKE-FILE  ASSIGN TO       CUSGETKE
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS SEQUENTIAL
                  RECORD KEY    IS CUSGETKE-PKEY-00001-00012
                  FILE STATUS   IS CUSGETKE-STATUS.
           SELECT CUSPUTKA-FILE  ASSIGN TO       CUSPUTKA
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS SEQUENTIAL
                  RECORD KEY    IS CUSPUTKA-PKEY-00001-00012
                  FILE STATUS   IS CUSPUTKA-STATUS.

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

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

      *****************************************************************
      * 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 '* CUSE2AIO '.
           05  T2 pic X(34) value 'Read EBCDIC/KSDS, Load ASCII/KSDS '.
           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 '* CUSE2AIO '.
           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  CUSGETKE-STATUS.
           05  CUSGETKE-STATUS-L     pic X.
           05  CUSGETKE-STATUS-R     pic X.
       01  CUSGETKE-EOF              pic X       value 'N'.
       01  CUSGETKE-OPEN-FLAG        pic X       value 'C'.

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

       01  CUSGETKE-LRECL            pic 9(5)    value 00512.
       01  CUSPUTKA-LRECL            pic 9(5)    value 00512.
       01  CUSGETKE-LRECL-MAX        pic 9(5)    value 00512.
       01  CUSPUTKA-LRECL-MAX        pic 9(5)    value 00512.

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

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(011)  value '* CUSE2AIO '.
           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 'CUSE2AIO'.

       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   'Read EBCDIC/KSDS, Load ASCII/KSDS '.
           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  CUSGETKE-TOTAL.
           05  CUSGETKE-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for CUSGETKE'.
       01  CUSPUTKA-TOTAL.
           05  CUSPUTKA-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for CUSPUTKA'.

      *****************************************************************
      * The following copy file contains the translation tables for   *
      * the ASCII and EBCDIC conversion. Also, sections of the tables *
      * may be used for case conversion.                              *
      *****************************************************************
       COPY ASCEBCB1.
      *****************************************************************
       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 CUSGETKE-OPEN
           perform CUSPUTKA-OPEN

      *    USRSOJ Processing not specified...

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

      *    USREOJ Processing not specified...

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

           move CUSPUTKA-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 CUSPUTKA-CLOSE
           perform CUSGETKE-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    TransMODE is E2A...
      *    TransCALL process, Record Content Conversion...
           move CUSGETKE-REC to CUSPUTKA-REC
           call 'CUSE2AR1'                        using CUSPUTKA-REC
           add 00512 to ZERO giving CUSPUTKA-LRECL
           exit.

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

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

Table of Contents Previous Section Next Section The COBOL Conversion Routine

The following (CUSE2AR1.cbl) is a COBOL program that converts a record based on the record layout defined in a COBOL copy file. The program was tested using Micro Focus Enterprise Server on Windows/XP. The program were successfully executed in both an EBCDIC and ASCII encoded configuration.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUSE2AR1.
       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:16:40    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  IX-1  PIC 9(5) VALUE 0.
       01  RM-1  PIC 9(5) VALUE 0.
       01  RO-1  PIC 9(5) VALUE 0.
       01  IX-2  PIC 9(5) VALUE 0.
       01  RM-2  PIC 9(5) VALUE 0.
       01  RO-2  PIC 9(5) VALUE 0.

       COPY AE0437B1.
       COPY ASCEBCB2.

      *****************************************************************
       LINKAGE SECTION.
       COPY CUSTCB01.

      *****************************************************************
       PROCEDURE DIVISION using CUST-RECORD.
           inspect CUST-NUMBER              converting E-INFO to A-INFO
           inspect CUST-STATUS              converting E-INFO to A-INFO
           inspect CUST-LAST-NAME           converting E-INFO to A-INFO
           inspect CUST-FIRST-NAME          converting E-INFO to A-INFO
           inspect CUST-MID-NAME            converting E-INFO to A-INFO
           inspect CUST-ADDRESS-1           converting E-INFO to A-INFO
           inspect CUST-ADDRESS-2           converting E-INFO to A-INFO
           inspect CUST-CITY                converting E-INFO to A-INFO
           inspect CUST-STATE               converting E-INFO to A-INFO
           inspect CUST-POSTAL-CODE         converting E-INFO to A-INFO
           inspect CUST-PHONE-HOME          converting E-INFO to A-INFO
           inspect CUST-PHONE-WORK          converting E-INFO to A-INFO
           inspect CUST-PHONE-CELL          converting E-INFO to A-INFO
      *    Packed............... CUST-CREDIT-LIMIT
      *    Group10 CUST-DISCOUNT                     occurs 00003 times
      *    Table Element........ CUST-DISCOUNT-CODE              000001
      *    Binary............... CUST-DISCOUNT-CODE
      *    Table Element........ CUST-DISCOUNT-RATE              000001
           inspect CUST-RECORD(0000306:0000005)
                                            converting E-NUMB to A-NUMB
      *    Table Element........ CUST-DISCOUNT-DATE              000001
           inspect CUST-DISCOUNT-DATE(1)    converting E-INFO to A-INFO
      *    Table Element........ CUST-DISCOUNT-CODE              000002
      *    Binary............... CUST-DISCOUNT-CODE
      *    Table Element........ CUST-DISCOUNT-RATE              000002
           inspect CUST-RECORD(0000321:0000005)
                                            converting E-NUMB to A-NUMB
      *    Table Element........ CUST-DISCOUNT-DATE              000002
           inspect CUST-DISCOUNT-DATE(2)    converting E-INFO to A-INFO
      *    Table Element........ CUST-DISCOUNT-CODE              000003
      *    Binary............... CUST-DISCOUNT-CODE
      *    Table Element........ CUST-DISCOUNT-RATE              000003
           inspect CUST-RECORD(0000336:0000005)
                                            converting E-NUMB to A-NUMB
      *    Table Element........ CUST-DISCOUNT-DATE              000003
           inspect CUST-DISCOUNT-DATE(3)    converting E-INFO to A-INFO
           inspect CUST-LADATE              converting E-INFO to A-INFO
           inspect CUST-LATIME              converting E-INFO to A-INFO
      *    Zoned-Decimal-Nosign. CUST-TOKEN
           inspect CUST-RECORD(365:3)       converting E-NUMB to A-NUMB
      *    Filler............... A Non-Unique Reference to a Data Item
           inspect CUST-RECORD(368:145)     converting E-INFO to A-INFO
           GOBACK.
      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *  Generation Date: 2018/10/10  Generation Time: 20:28:16:40    *
      *****************************************************************

Table of Contents Previous Section Next Section Summary

The purpose of this program is to provide an example of how to convert an EBCDIC-encoded Indexed file to an ASCII-encoded Indexed file and maintain mainframe numeric integrity. 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.

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 the JCL Connection for more examples of JCL functionality with programming techniques and sample code.

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 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 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
EBCDIC to ASCII Conversion, Customer Master File with Packed and Binary Data
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com