EBCDIC to ASCII Convert Customer File, Sequential to VSAM, KSDS |
The SimoTime Home Page |
This suite of programs describes how to convert an EBCDIC encoded Record Sequential File 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 record content conversion.
The first program does the File I/O (i.e. file format conversion) of reading the EBCDIC encoded Sequential File and writing the new ASCII encoded Customer Master File. The File I/O program calls the second program (i.e. record 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 following outline describes some of the systems that are used by SIMOTIME during the development and testing processes.
1. | The program compilation and execution is done on an IBM Mainframe System with Enterprise COBOL. |
1.1. | The Mainframe System uses EBCDIC-encoding. |
1.2. | The Mainframe Operating System is ZOS. |
2. | The program generation, compilation and execution is done on a Linux (Ubuntu) System with GnuCOBOL. |
2.1. | The Linux System uses ASCII-encoding. |
2.2. | The Linux Operating System is Ubuntu 16.04 LTS. |
2.3. | GnuCOBOL (cobc) is configured to use a Mainframe Dialect and ASCII-encoding. |
3. | The program generation, compilation and execution is done on a Windows System with Micro Focus Enterprise Developer. |
3.1. | The Windows System uses ASCII-encoding. |
3.2. | The Windows Operating System is Windows/7. |
3.3. | For the Micro Focus COBOL environment the programs may be compiled using a Mainframe dialect with the CHARSET(EBCDIC) or CHARSET(ASCII) compiler directives. |
3.4. | If the programs are compiled using a non-Mainframe dialect the IBMCOMP directive must be used since the customer master file contains binary (or COMP) fields. |
The preceding outline is a partial list of Systems and COBOL technologies that may be used to generate, compile and execute the programs. The generation process is only supported for the Windows and Linux environments. The generated COBOL source code may be Copied, Compiled and Executed on other systems.
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
A job script may be defined as a text file containing job setup information followed by job steps that identify programs to be executed along with parameters unique to the job step. A job script may be created using a text editor. The naming of a job script is determined by the Operating System. A simple job script may contain a single job step that performs a single function. A typical job script will contain multiple job steps executed in a predefined sequence. The status of each job step may be tested at the end of each job step.
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 (CUREKAJ1.jcl) is a listing of the JCL member needed to run this job.
//CUREKAJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=&SYSUID //* ******************************************************************* //* CUREKAJ1.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 RSEQ and write KSDS. //* Author - SimoTime Technologies //* Date - January 01, 1997 //* //* This COBOL program will read an EBCDIC-encoded, Record Sequential //* file with fixed length records of 512-bytes and write to an //* ASCII-encoded, VSAM Key-Sequenced-Data-Set. //* //* ************ //* * CUSE2AJ1 * //* ********jcl* //* * //* * //* ************ ************ //* * IEFBR14 *-----* MOD,DELT * //* ************ ************ //* * //* * //* ************ ************ ************ //* * CUSTEBC1 *-----* CUREKAC1 *-----* CUSTASC1 * //* *******rseq* ********cbl* *******ksds* //* * //* * //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 of 2, Delete and Define a VSAM Cluster. //* //CUCRTS01 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE SIMOTIME.DATA.CUSKA512 - FILE (CUSKA512) - PURGE - ERASE - CLUSTER SET MAXCC = 0 DEFINE CLUSTER (NAME(SIMOTIME.DATA.CUSKA512) - TRACKS(45,15) - INDEXED) - DATA (NAME(SIMOTIME.DATA.CUSKA512.DAT) - KEYS(12,0) - RECORDSIZE(512,512) - FREESPACE(10,15) - CISZ(8192)) - INDEX (NAME(SIMOTIME.DATA.CUSKA512.IDX)) //* ******************************************************************* //* Step 2 of 2, Read Record Sequential file and write a VSAM, KSDS. //* //CUSE2AS1 EXEC PGM=CUREKAC1 //STEPLIB DD DISP=SHR,DSN=SIMOTIME.DEMO.LOADLIB1 //CUSRE512 DD DISP=SHR,DSN=SIMOTIME.DATA.CUSRE512 //CUSKS512 DD DISP=SHR,DSN=SIMOTIME.DATA.CUSKA512 //SYSOUT DD SYSOUT=* //*
The following is the Windows Command file (CUREKAW1.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 * CUREKAW1.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 * to a new ASCII-encoded Customer Master File (or VSAM, KSDS). rem * rem * ************ rem * * CUREKAW1 * 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 * * * CUSRE512 *-----* CUREKAC1 *-----* CUSKA512 * rem * * * Note-1 * ********cbl* * Note-2 * rem * * *******rseq* *******ksds* rem * ************ rem * * EOJ * rem * ************ rem * rem * Note-1: CUSRE512 is an EBCDIC-encoded, record sequential (RSEQ) rem * file. This file was downloaded from an IBM Mainframe rem * System using FTP and BINARY MODE. rem * rem * Note-2: CUSKA512 is an ASCII-encoded,indexed file that may be rem * referred to as a Key-Sequenced Data Set (KSDS). This rem * file is created by this job. rem * rem * ******************************************************************* rem * Step 1, Set Environment Variables rem * Delete any previously created ASCII-encoded file... rem * call ..\Env1BASE set CmdName=CUSE2AW1 rem * call SimoNOTE "*******************************************************%CmdName%" call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%" call SimoNOTE "Identify JobStep Step-1, Housekeeping tasks" set CUSRE512=%BaseLib1%\DATA\EBC1\SIMOTIME.DATA.CUSRE512.DAT set CUSKS512=%BaseLib1%\DATA\Wrk1\SIMOTIME.DATA.CUSKA512.DAT if exist %CUSKS512% del %CUSKS512% 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" call SimoNOTE "DataTake RSE CUSRE512=%CUSRE512%" call SimoNOTE "DataMake KSA CUSKS512=%CUSKS512%" run CUREKAC1 if not "%ERRORLEVEL%" == "0" set JobStatus=0010 if not "%JobStatus%" == "0000" goto EojNOK if exist %CUSKS512% goto EojAOK set JobStatus=0020 goto EojNOK :EojAOK call SimoNOTE "Produced %CUSKS512%" 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%
The following is the Bash Script file (curekas1.sh) that is needed to run this job as a batch task in a GnuCOBOL and Linux (Ubuntu) environment.
#!/bin/bash JOBNAME=curekas1 # * ******************************************************************* # * Bash Script File - provided by SimoTime Technologies * # * (C) Copyright 1987-2018 All Rights Reserved * # * Web Site URL: http://www.simotime.com * # * e-mail: helpdesk@simotime.com * # * ******************************************************************* # * # * Text - Convert EBCDIC Record Sequential to ASCII VSAM KSDS # * Author - SimoTime Technologies # * Date - November 11, 2003 # * Version - 06.07.16 # * # * Prepare the environment by mapping the file names. # * Read an EBCDIC-encoded Record sequential file and write to an # * ASCII-encoded VSAM, KSDS or Indexed file. # * # * ******************************************************************** # * Step 1 of 4, Prepare the System Environment. # * JOBSTATUS=0 for textstring in $(cat ENV4SYS1.txt); do # # * The following statement will replace all occurences # # * of DL_BASESYS1 with the value of the BASESYS1 # # * environment variable. textstring=${textstring//DL_BASESYS1/$BASESYS1} # # * The following statement will replace all occurences # # * of BASHUSER_JOBNAME with the value of the JOBNAME # # * environment variable. textstring=${textstring/DL_JOBNAME/$JOBNAME} export $textstring rc=$? if [ $rc != 0 ] then simonote.sh "# $textstring - Return Code is $rc" JOBSTATUS=$rc fi done # * simonote.sh "************************************************************$JOBNAME" simonote.sh "# Starting Job Name $JOBNAME, User is $USER, Time is $(date +'%Y/%m/%d') - $(date +'%r')" simonote.sh "# BASESYS1........... $BASESYS1" simonote.sh "# SIMONOTE........... $SIMONOTE" simonote.sh "# COB_LIBS........... $COB_LIBS" simonote.sh "# COB_LIBRARY_PATH... $COB_LIBRARY_PATH" # * # * ******************************************************************** # * Step 2 of 4, Prepare the Job Environment, map the file names... # * export CUSRE512=$BASESYS1/SIMOSAM1/DEVL/DATA/EBC1/SIMOTIME.DATA.CUSRE512.dat export CUSKS512=$BASESYS1/SIMOSAM1/DEVL/DATA/WRK1/SIMOTIME.DATA.CUSKA512.dat simonote.sh "# DATATAKE is $CUSRE512" simonote.sh "# DATAMAKE is $CUSKS512" # * # * ******************************************************************** # * Step 3 of 4, Run the Conversion program. # * if [ -f "$CUSKS512" ] then rm $CUSKS512 fi cobcrun CUREKAC1 | tee $BASESYS1/SIMOSAM1/DEVL/LOGS/SYSOUT_USERPROG_CUREKAC1.txt rc=$? if [ $rc != 0 ] then simonote.sh "# ABENDING $name - Return Code is $rc" JOBSTATUS=$rc else ((AOK_Count++)) fi # * # * ******************************************************************** # * Step 4 of 4, End of Job Processing. # * if [ "$JOBSTATUS" = "0" ] then simonote.sh "# Finished Job Name $JOBNAME, Time is $(date +'%Y/%m/%d') - $(date +'%r')" else simonote.sh "# ABENDING Job Name $JOBNAME, Time is $(date +'%Y/%m/%d') - $(date +'%r')" fi
The following is the source code that was generated for the conversion process. The programs were generated and tested using Micro Focus Enterprise Server on Windows System. The programs were successfully executed in both an EBCDIC and ASCII encoded configuration.
The following (CUREKAC1.cbl) is the COBOL I/O program that was generated with SimoTime technology.
IDENTIFICATION DIVISION. PROGRAM-ID. CUREKAC1. 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:14:56 * * * * Record Record Key * * Function Name Organization Format Max-Min Pos-Len * * PRIMARY CUSRE512 SEQUENTIAL FIXED 00512 * * * * SECONDARY CUSKS512 INDEXED VARIABLE 00512 00001 * * 00512 00012 * * * * Translation Mode is EBCDIC to ASCII * * * ***************************************************************** ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CUSRE512-FILE ASSIGN TO CUSRE512 ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS CUSRE512-STATUS. SELECT CUSKS512-FILE ASSIGN TO CUSKS512 ORGANIZATION IS INDEXED ACCESS MODE IS SEQUENTIAL RECORD KEY IS CUSKS512-PKEY-00001-00012 FILE STATUS IS CUSKS512-STATUS. ***************************************************************** DATA DIVISION. FILE SECTION. FD CUSRE512-FILE DATA RECORD IS CUSRE512-REC . 01 CUSRE512-REC. 05 CUSRE512-DATA-01 PIC X(00512). FD CUSKS512-FILE DATA RECORD IS CUSKS512-REC . 01 CUSKS512-REC. 05 CUSKS512-PKEY-00001-00012 PIC X(00012). 05 CUSKS512-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 '* CUREKAC1 '. 05 T2 pic X(34) value 'Read EBCDIC/RSEQ, 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 '* CUREKAC1 '. 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 CUSRE512-STATUS. 05 CUSRE512-STATUS-L pic X. 05 CUSRE512-STATUS-R pic X. 01 CUSRE512-EOF pic X value 'N'. 01 CUSRE512-OPEN-FLAG pic X value 'C'. 01 CUSKS512-STATUS. 05 CUSKS512-STATUS-L pic X. 05 CUSKS512-STATUS-R pic X. 01 CUSKS512-EOF pic X value 'N'. 01 CUSKS512-OPEN-FLAG pic X value 'C'. 01 CUSRE512-LRECL pic 9(5) value 00512. 01 CUSKS512-LRECL pic 9(5) value 00512. 01 CUSRE512-LRECL-MAX pic 9(5) value 00512. 01 CUSKS512-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 '* CUREKAC1 '. 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 'CUREKAC1'. 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/RSEQ, 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 CUSRE512-TOTAL. 05 CUSRE512-RDR pic 9(9) value 0. 05 filler pic X(3) value ' - '. 05 filler pic X(23) value 'Line count for CUSRE512'. 01 CUSKS512-TOTAL. 05 CUSKS512-ADD pic 9(9) value 0. 05 filler pic X(3) value ' - '. 05 filler pic X(23) value 'Line count for CUSKS512'. ***************************************************************** * 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 CUSRE512-OPEN perform CUSKS512-OPEN * USRSOJ Processing not specified... perform until CUSRE512-STATUS not = '00' perform CUSRE512-READ if CUSRE512-STATUS = '00' add 1 to CUSRE512-RDR perform BUILD-OUTPUT-RECORD if WRITE-FLAG = 'Y' perform CUSKS512-WRITE if CUSKS512-STATUS = '00' add 1 to CUSKS512-ADD end-if end-if end-if end-perform * USREOJ Processing not specified... move CUSRE512-TOTAL to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move CUSKS512-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 CUSKS512-CLOSE perform CUSRE512-CLOSE GOBACK. ***************************************************************** BUILD-OUTPUT-RECORD. * TransMODE is E2A... * TransCALL process, Record Content Conversion... move CUSRE512-REC to CUSKS512-REC call 'CUREKAR1' using CUSKS512-REC add 00512 to ZERO giving CUSKS512-LRECL exit. ***************************************************************** * I/O Routines for the INPUT File... * ***************************************************************** CUSRE512-CLOSE. add 8 to ZERO giving APPL-RESULT. close CUSRE512-FILE if CUSRE512-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 CUSRE512' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move CUSRE512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* CUSRE512-READ. read CUSRE512-FILE if CUSRE512-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if CUSRE512-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 CUSRE512-EOF else move 'READ Failure with CUSRE512' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move CUSRE512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if exit. *---------------------------------------------------------------* CUSRE512-OPEN. add 8 to ZERO giving APPL-RESULT. open input CUSRE512-FILE if CUSRE512-STATUS = '00' subtract APPL-RESULT from APPL-RESULT move 'O' to CUSRE512-OPEN-FLAG else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'OPEN Failure with CUSRE512' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move CUSRE512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. ***************************************************************** * I/O Routines for the OUTPUT File... * ***************************************************************** CUSKS512-WRITE. if CUSKS512-OPEN-FLAG = 'C' perform CUSKS512-OPEN end-if write CUSKS512-REC if CUSKS512-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if CUSKS512-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 CUSKS512' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move CUSKS512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* CUSKS512-OPEN. add 8 to ZERO giving APPL-RESULT. open OUTPUT CUSKS512-FILE if CUSKS512-STATUS = '00' subtract APPL-RESULT from APPL-RESULT move 'O' to CUSKS512-OPEN-FLAG else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'OPEN Failure with CUSKS512' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move CUSKS512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* CUSKS512-CLOSE. add 8 to ZERO giving APPL-RESULT. close CUSKS512-FILE if CUSKS512-STATUS = '00' subtract APPL-RESULT from APPL-RESULT move 'C' to CUSKS512-OPEN-FLAG else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'CLOSE Failure with CUSKS512' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move CUSKS512-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:14:58 * *****************************************************************
The following (CUREKAR1.cbl) is a COBOL program that converts a record based on the record layout defined in a COBOL copy file.
IDENTIFICATION DIVISION. PROGRAM-ID. CUREKAR1. 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:14:89 * ***************************************************************** 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:14:89 * *****************************************************************
The following two (2) files are used as input for the Program Generation Process.
The following (CUREKA01.PCF) is the Process Control File that is used to define the file types and conversion behavior.
*********************************************************************** * CUREKA01.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, 512-byte, fixed, EBCDIC file for * the Customer Master file. This file was downloaded from the * mainframe using BINARY mode. * SYSUT2 is a KSDS, 512-byte, variable, ASCII file for the Customer * Master file used in a non-mainframe environment. * * This procdedure will generate the IO Program, the callable convert * routine and the HTML Documentation for the Customer Master file. * The primary purpose for this program is to do the initial load of * the Customer Master file. The records in the input file (SYSUT1) * must be in ascending sequence by the field that is used as the key * in the Customer Master File. *********************************************************************** * For more information about a Process Control File (PCF) that will * generate data conversion programs refer to the following. * * * Refer to http://www.simotime.com/utconv01.htm for additional detail * about the PCF statements for Data Convert. * * This set of specification will generate an mainline I/O program and a * callable COBOL routine that will convert an EBCDIC-encoded file to an * ASCII-encoded file. *********************************************************************** * &SIMOPREP call ..\..\ENV1BASE &USERPREP call USERCONV &CONFORM IBM * * The following COPYFILE statement defines the COBOL copy file that * will be used to convert the record structure at the field level. * Also, the copy file will be used to create the documentation for * the record structure. * ©FILE CUSTCB01.cpy * * The following HTMLFILE statement causes the HTML document for the * record structure to be generated. The parameter defines the name * of the document. * &HTMLFILE custcb01.htm * * Defines an eight character name of a COBOL Copy File that will * override the default copy file that is used to do the conversion * for text strings (PIC X) within a record. * &USRXFILE AE0437B1 * * The following group of statements are for the file I/O program and * will define the file properties and behavioral characteristics for * the Program to be generated. * &VSAMload SEQUENTIAL *HEAD34 ....:....1....:....2....:....3.... &HEAD34 Read EBCDIC/RSEQ, Load ASCII/KSDS &IOMODNAME CUREKAC1 &SYSUT1 name=CUSRE512 org=Sequential recfm=FIXED rlen=512 &SYSUT2 name=CUSKS512 org=Indexed recfm=VARIABLE rmin=512 rmax=512 kpos=1 klen=12 * * The following group of statements are for the callable conversion * program and will define the behavioral characteristics for the * program to be generated. * &PACKEDFLD SPACECONVERT &TransCALL CUREKAR1 &TransMODE E2A * &END
The following (CUSTCB01) is a COBOL copy file that is used to define the record structure.
***************************************************************** * CUSTCB01.cpy - a COBOL Copy Member * * Customer Master File used for Quality Assurance Testing * * This is a VSAM Keyed-Sequential-Data-Set or KSDS * * Copyright (C) 1987-2020 SimoTime Technologies * * All Rights Reserved * * Provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * ***************************************************************** * CUST-RECORD size is 512 bytes. * RMIN is 512 RMAX is 512 * KPOS is 1 KLEN is 012 * ....:.*..1....:....2....:....3....:....4....:....5....:....6....:....7....:....8 01 CUST-RECORD. 05 CUST-NUMBER PIC X(12). col A 05 CUST-DATA. 10 CUST-STATUS PIC X. col B 10 CUST-NAME. 15 CUST-LAST-NAME PIC X(28). col C 15 CUST-FIRST-NAME PIC X(20). col D 15 CUST-MID-NAME PIC X(20). col E 10 CUST-ADDRESS-1 PIC X(48). col F 10 CUST-ADDRESS-2 PIC X(48). col G 10 CUST-CITY PIC X(28). col H 10 CUST-STATE PIC X(28). col I 10 CUST-POSTAL-CODE PIC X(12). col J 10 CUST-PHONE-HOME PIC X(18). col K 10 CUST-PHONE-WORK PIC X(18). col L 10 CUST-PHONE-CELL PIC X(18). col M 10 CUST-CREDIT-LIMIT PIC 9(7) COMP-3. col N 10 CUST-DISCOUNT OCCURS 3 TIMES. 15 CUST-DISCOUNT-CODE PIC S9(3) COMP. col ORU 15 CUST-DISCOUNT-RATE PIC S9(2)V999. col PSV 15 CUST-DISCOUNT-DATE PIC X(8). col QTW 10 CUST-LADATE PIC X(8). col X 10 CUST-LATIME PIC X(8). col Y 10 CUST-TOKEN PIC 9(3). col Z 10 FILLER PIC X(145). * *** CUSTCB01 - End-of-Copy File - - - - - - - - - - - CUSTCB01 * ***************************************************************** *
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.
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.
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.
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 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 icon.
Explore How to Create Hexadecimal Dump information for the records in a Customer Master file. The Customer Master file is a VSAM, KSDS. This document describes a process for generating a single COBOL program that will read a VSAM/KSDS and write hexadecimal dump information to a sequential file. The user may define the records to be dumped by providing a list of primary keys in a control file. The Hex-Dump information is written to a user-defined sequential file. The Hex-Dump formatting and file I-O are done within the generated COBOL program. The Hex-Dump formatting provides a record structure containing all text characters. Therefore, the contents may be easily viewed using a text editor of choice.
Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample code.
Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
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.
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.
Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.
The following links will require an Internet connect.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection
Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.
Explore the GnuCOBOL Technologies available from SourceForge. SourceForge is an Open Source community resource dedicated to helping open source projects be as successful as possible. GnuCOBOL (formerly OpenCOBOL) is a COBOL compiler with run time support. The compiler (cobc) translates COBOL source to executable using intermediate C, designated C compiler and linker. This link will require an Internet Connection.
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
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.
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 |
Sequential to VSAM, KSDS, EBCDIC to ASCII |
Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |