|
File Format and Content Convert, KSDS to Text & Expand Numbers |
![]() |
| The SimoTime Home Page |
This is an example of how a COBOL program can read an ASCII-Indexed file and write an ASCII/Text file. The COBOL source code was generated using SimoZAPS, a product of SimoTime Technologies.
Also, the SimoZAPS utility program has the capability of reading, writing or converting between other file formats
In the world of programming there are many ways to solve a problem. This program is provided as a COBOL example of one of the possible solutions to the problem of changing the contents and structure of data files.
We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
This program will read an ASCII-Text file and write to an ASCII-Indexed (VSAM, KSDS or Keyed Sequential Data Set) file. The keys must be in sequence for the writes to the output file. This example includes a procedure for converting EBCDIC Packed (or COMP-3) and Binary (or COMP) data to ASCII Decimal data.
The following is the content of the (KSATXAX1.cmd) file that was used to create the COBOL source code. This process uses the SimoZAPS utility program to do the actual program generation.
@echo OFF
rem * *******************************************************************
rem * KSATXAX1.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 * *******************************************************************
echo *
echo * This process will read the KSASQE01.pcf file and create the
echo * KSATXAC1.CBL file using the SYSMASK1.TXT as a mask.
echo * The KSASQE01.pcf file is expected to contains the specifications
echo * for reading an INDEXED, 512-byte maximum record length, variable,
echo * ASCII file with the key position at 1 for a key length of 12 and
echo * creating a TEXT, 512-byte, variable, ASCII/Text file.
echo *
echo * KSASQEX1 Starting the GENERATE function of SimoZAPS
set CmdName=KSATXAX1
rem * Set the Environment for the System Level
call ../ENV1BASE
cd %BASELIB1%\CONVERTS
rem * Set the Environment that is unique to the File Convert Process
call USERCONV
set MEMBERNAME=KSATXA01
call SimoNOTE "***********************************************************************%CmdName%"
call SimoNOTE "Starting %CmdName% Environment, RC=%ConvertStatus%, PGM=%MEMBERNAME%"
set ConvertStatus=0000
set UTCONVD1=%UTGENGET%\%MEMBERNAME%.pcf
set UTCONVD2=%UTGENGET%\%MEMBERNAME%genr.CMD
set UTCONVD3=%UTGENGET%\%MEMBERNAME%spec.TXT
if exist %UTCONVD2% erase %UTCONVD2%
if exist %UTCONVD3% erase %UTCONVD3%
call SimoNOTE "*---------------------------------------------------------------------*"
call SimoNOTE "Starting %CmdName% Pre-Edit, RC=%ConvertStatus%, PGM=%MEMBERNAME%"
run UTCONVRT
if not "%ERRORLEVEL%" == "0" set ConvertStatus=0010
if not "%ConvertStatus%" == "0000" goto :ConvertEojNOK
rem *
rem * ************************************************************************
:ConvertEojAOK
call SimoNOTE "*---------------------------------------------------------------------*"
call SimoNOTE "Starting %CmdName% Generation, RC=%ConvertStatus%, PGM=%MEMBERNAME%"
call %MEMBERNAME%genr
if not "%ERRORLEVEL%" == "0" set ConvertStatus=0020
if not "%ConvertStatus%" == "0000" goto :ConvertEojNOK
call SimoNOTE "Complete %CmdName%, RC=%ConvertStatus%, PGM=%MEMBERNAME%"
goto :End
rem *
rem * ************************************************************************
:ConvertEojNOK
set JobStatus=%ConvertStatus%
call SimoNOTE "ABENDING %CmdName%, RC=%ConvertStatus%, PGM=%MEMBERNAME%, !!!ABENDING!!!"
echo %MEMBERNAME% - Error during Compile, refer to %BaseLib1%\LIST\%1.LST>%BaseLib1%\LOGS\%MEMBERNAME%.ERR
goto :End
rem *
rem * ************************************************************************
pause
:End
The following member (KSATXA01.pcf) is the process control file contains the specifications used by the preceding command file.
*********************************************************************** * SYSUT1 should be an INDEXED, 512-byte, variable, ASCII content * * with key position at 1 for a key length of 12. * * SYSUT2 should be a ASCII/Text, 512-byte, variable, ASCII content. * * * * The DIALECT statement specifies the use of COBOL/2 compliant code * * for the generated conversion program. * * * * The TransINIT statement will initialize the SYSUT2 record to X'20' * * or an ASCII SPACE character. This is especially useful when the * * output record length for SYSUT2 is greater than the input record * * length of SYSUT1. The hex value is used since the generated program * * could run on the PC or the mainframe. * *********************************************************************** &SIMOPREP call ..\..\ENV1BASE &USERPREP call USERCONV &Dialect C2 &VSAMload Sequential &progid KSATXAC1 &sysut1 name=KSADB512 org=indexed recfm=variable rlen=512 kpos=1 klen=12 &sysut2 name=TXADB512 org=ascii/crlf recfm=variable rlen=512 * &transmode A2A &transinit X'20' &transcopy from pos 001 len 012 to pos 001 len 012 &transcopy from pos 013 len 001 to pos 013 len 001 &transcopy from pos 014 len 012 to pos 014 len 012 &transcopy from pos 026 len 001 to pos 026 len 001 &unpackit from pos 027 len 007 to pos 027 len 012 &transcopy from pos 034 len 001 to pos 039 len 001 &transcopy from pos 035 len 012 to pos 040 len 012 &transcopy from pos 047 len 001 to pos 052 len 001 &unbinary from pos 048 len 004 to pos 053 len 012 &transcopy from pos 052 len 001 to pos 065 len 001 &transcopy from pos 053 len 012 to pos 066 len 012 &transcopy from pos 065 len 001 to pos 078 len 001 &transcopy from pos 066 len 026 to pos 079 len 026 * &END
The following (KSATXAC1.cbl) is the source code for the file conversion. This program was compiled and tested on a Windows System using Mainframe Express (with the non-mainframe dialect) and Net Express (refer to http://www.microfocus.com ). Since the organization of the input file (SYSUT1) is specified as LINE SEQUENTIAL (the Micro Focus terminology for ASCII Text files) this program will not compile or execute on the mainframe.
IDENTIFICATION DIVISION.
PROGRAM-ID. KSATXAC1.
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: 2014-05-05 Generation Time: 15:21:54:32 *
* *
* Record Record Key *
* Function Name Organization Format Max-Min Pos-Len *
* INPUT KSADB512 INDEXED VARIABLE 00512 00001 *
* 00012 *
* OUTPUT TXADB512 ASCII/CRLF VARIABLE 00512 *
* *
* *
* Translation Mode is ASCII to ASCII *
* *
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT KSADB512-FILE ASSIGN TO KSADB512
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
RECORD KEY IS KSADB512-PKEY-00001-00012
FILE STATUS IS KSADB512-STATUS.
SELECT TXADB512-FILE ASSIGN TO TXADB512
ORGANIZATION IS LINE SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS TXADB512-STATUS.
*****************************************************************
DATA DIVISION.
FILE SECTION.
FD KSADB512-FILE
DATA RECORD IS KSADB512-REC
.
01 KSADB512-REC.
05 KSADB512-PKEY-00001-00012 PIC X(00012).
05 KSADB512-DATA-00013-00500 PIC X(00500).
FD TXADB512-FILE
DATA RECORD IS TXADB512-REC
.
01 TXADB512-REC.
05 TXADB512-DATA-01 PIC X(00512).
*****************************************************************
* 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 additional information contact SimoTime Technologies. *
* 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 '* KSATXAC1 '.
05 T2 pic X(34) value 'Data File Migration and Conversion'.
05 T3 pic X(10) value ' v12.04.05'.
05 T4 pic X(24) value ' helpdesk@simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* KSATXAC1 '.
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 KSADB512-STATUS.
05 KSADB512-STATUS-L pic X.
05 KSADB512-STATUS-R pic X.
01 KSADB512-EOF pic X value 'N'.
01 KSADB512-OPEN-FLAG pic X value 'C'.
01 TXADB512-STATUS.
05 TXADB512-STATUS-L pic X.
05 TXADB512-STATUS-R pic X.
01 TXADB512-EOF pic X value 'N'.
01 TXADB512-OPEN-FLAG pic X value 'C'.
01 KSADB512-LRECL pic 9(5) value 00512.
01 TXADB512-LRECL pic 9(5) value 00512.
01 KSADB512-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(11) value '* KSATXAC1 '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
*****************************************************************
01 PROGRAM-NAME pic X(8) value 'KSATXAC1'.
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 'Data File Migration and Conversion'.
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 KSADB512-TOTAL.
05 KSADB512-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(23) value 'Line count for KSADB512'.
01 TXADB512-TOTAL.
05 TXADB512-ADD pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(23) value 'Line count for TXADB512'.
*****************************************************************
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 KSADB512-OPEN
perform TXADB512-OPEN
perform until KSADB512-STATUS not = '00'
perform KSADB512-READ
if KSADB512-STATUS = '00'
add 1 to KSADB512-RDR
perform BUILD-OUTPUT-RECORD
perform TXADB512-WRITE
if TXADB512-STATUS = '00'
add 1 to TXADB512-ADD
end-if
end-if
end-perform
move KSADB512-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move TXADB512-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 TXADB512-CLOSE
perform KSADB512-CLOSE
GOBACK.
*****************************************************************
BUILD-OUTPUT-RECORD.
* TransMODE is A2A...
* TransINIT process...
move ALL X'20' to TXADB512-REC
* TransCOPY...
move KSADB512-REC(00001:00012) to TXADB512-REC(00001:00012)
* TransCOPY...
move KSADB512-REC(00013:00001) to TXADB512-REC(00013:00001)
* TransCOPY...
move KSADB512-REC(00014:00012) to TXADB512-REC(00014:00012)
* TransCOPY...
move KSADB512-REC(00026:00001) to TXADB512-REC(00026:00001)
* /UNPACKIT Convert from PACKED to PIC9...
move ALL LOW-VALUES to PACK-10
move KSADB512-REC(00027:00007) to PACK-10(04:07)
perform BUILD-OUTPUT-RECORD-UNPACKIT
move UNPK-18(07:12) to TXADB512-REC(00027:00012)
* TransCOPY...
move KSADB512-REC(00034:00001) to TXADB512-REC(00039:00001)
* TransCOPY...
move KSADB512-REC(00035:00012) to TXADB512-REC(00040:00012)
* TransCOPY...
move KSADB512-REC(00047:00001) to TXADB512-REC(00052:00001)
* /UNBINARY Convert from BINARY to PIC9...
move ALL LOW-VALUES to COMP-08
move KSADB512-REC(00048:00004) to COMP-08(05:04)
perform BUILD-OUTPUT-RECORD-UNBINARY
move UNCP-18(07:12) to TXADB512-REC(00053:00012)
* TransCOPY...
move KSADB512-REC(00052:00001) to TXADB512-REC(00065:00001)
* TransCOPY...
move KSADB512-REC(00053:00012) to TXADB512-REC(00066:00012)
* TransCOPY...
move KSADB512-REC(00065:00001) to TXADB512-REC(00078:00001)
* TransCOPY...
move KSADB512-REC(00066:00026) to TXADB512-REC(00079:00026)
exit.
*
*****************************************************************
* This is a general purpose routine that will convert an
* existing PACKED input field to a new TEXT output field.
*
BUILD-OUTPUT-RECORD-UNPACKIT.
move PACK-10 to WORK-S-PACK-ALPHA
if WORK-S-PACK-VALUE NUMERIC
add WORK-S-PACK-VALUE to ZERO giving WORK-S-UNPK-VALUE
move WORK-S-UNPK-ALPHA to UNPK-18
else
subtract ZERO from ZERO giving WORK-S-PACK-VALUE
add WORK-S-PACK-VALUE to ZERO giving WORK-S-UNPK-VALUE
move WORK-S-UNPK-ALPHA to UNPK-18
if NUMERIC-CHECK-FLAG = YES-BYTE
add KSADB512-RDR to ZERO giving NN-ERROR-COUNT
move NON-NUMERIC-ERROR to MESSAGE-TEXT
perform Z-MESSAGE-TO-ALL
end-if
end-if
exit.
*
*****************************************************************
* This is a general purpose routine that will convert an
* existing BINARY input field to a new TEXT output field.
*
BUILD-OUTPUT-RECORD-UNBINARY.
move COMP-08 to WORK-S-COMP-ALPHA
if WORK-S-COMP-VALUE NOT > 999999999999999999
add WORK-S-COMP-VALUE to ZERO giving WORK-S-UNCP-VALUE
move WORK-S-UNCP-ALPHA to UNCP-18
else
subtract ZERO from ZERO giving WORK-S-PACK-VALUE
add WORK-S-COMP-VALUE to ZERO giving WORK-S-UNCP-VALUE
move WORK-S-UNCP-ALPHA to UNCP-18
if NUMERIC-CHECK-FLAG = YES-BYTE
add KSADB512-RDR to ZERO giving NN-ERROR-COUNT
move NON-NUMERIC-ERROR to MESSAGE-TEXT
perform Z-MESSAGE-TO-ALL
end-if
end-if
exit.
*****************************************************************
* I/O Routines for the INPUT File... *
*****************************************************************
KSADB512-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close KSADB512-FILE
if KSADB512-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 KSADB512' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move KSADB512-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
KSADB512-READ.
read KSADB512-FILE
if KSADB512-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if KSADB512-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 KSADB512-EOF
else
move 'READ Failure with KSADB512' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move KSADB512-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
KSADB512-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input KSADB512-FILE
if KSADB512-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to KSADB512-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with KSADB512' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move KSADB512-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* I/O Routines for the OUTPUT File... *
*****************************************************************
TXADB512-WRITE.
if TXADB512-OPEN-FLAG = 'C'
perform TXADB512-OPEN
end-if
write TXADB512-REC
if TXADB512-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if TXADB512-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 TXADB512' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move TXADB512-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
TXADB512-OPEN.
add 8 to ZERO giving APPL-RESULT.
open OUTPUT TXADB512-FILE
if TXADB512-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to TXADB512-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with TXADB512' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move TXADB512-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
TXADB512-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close TXADB512-FILE
if TXADB512-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'C' to TXADB512-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with TXADB512' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move TXADB512-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* The following Z-ROUTINES provide administrative functions *
* for this program. *
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
Z-ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform Z-DISPLAY-MESSAGE-TEXT
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
add 12 to ZERO giving RETURN-CODE
STOP RUN.
* exit.
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
Z-DISPLAY-MESSAGE-TEXT.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79)
else
display MESSAGE-BUFFER
end-if
move all SPACES to MESSAGE-TEXT
exit.
*****************************************************************
* Display the file status bytes. This routine will display as *
* four digits. If the full two byte file status is numeric it *
* will display as 00nn. If the 1st byte is a numeric nine (9) *
* the second byte will be treated as a binary number and will *
* display as 9nnn. *
*****************************************************************
Z-DISPLAY-IO-STATUS.
if IO-STATUS not NUMERIC
or IO-STAT1 = '9'
move IO-STAT1 to IO-STATUS-04(1:1)
subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
move IO-STAT2 to TWO-BYTES-RIGHT
add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-MESSAGE-TEXT
else
move '0000' to IO-STATUS-04
move IO-STATUS to IO-STATUS-04(3:2)
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-MESSAGE-TEXT
end-if
exit.
*****************************************************************
Z-POST-COPYRIGHT.
display SIM-TITLE
display SIM-COPYRIGHT
exit.
*****************************************************************
* This program was generated by SimoZAPS *
* A product of SimoTime Technologies *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2014-05-05 Generation Time: 15:21:54:33 *
*****************************************************************
The following member (ASCEBCB1.cpy) is a COBOL copy file contains the ASCII and EBCDIC tables. The tables may also be used to do case conversion.
*****************************************************************
* AE9437B1.cpy - a COBOL Copy File *
* Copyright (C) 1987-2018 SimoTime Technologies *
* All Rights Reserved *
* Provided by SimoTime Technologies *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
*****************************************************************
* The following tables are used by the INSPECT statement to do *
* the conversion between EBCDIC and ASCII. *
* *
* inspect FIELD-NAME converting EBCDIC-INFO to ASCII-INFO *
* inspect FIELD-NAME converting ASCII-INFO to EBCDIC-INFO *
* *
* The tables include the alphabet for upper and lower case, the *
* digits 0-9, the special characters (US) and the alternate *
* codes for A, E, I, O, and U with the appropriate acute, *
* grave, umlaut, circumflex and tilde. *
* To display the alternate codes the Courier New (Fixed) or *
* Times New Roman (Proportional) font should be used. *
* *
* SimoZAPS contains four tables that may be used for various *
* Upper/Lower Case or EBCDIC/ASCII conversion requirements. *
* ASCEBCB1.CPY - includes a full character set for the alphabet *
* (upper/lower case), digit, special characters *
* and alternate codes for characters with the *
* acute, grave, umlaut, tilde and circumflex. *
* Caution: this table does not convert the Y *
* characters with an umlat. *
* ASCEBCB2.CPY - includes the character set for the translation *
* between EBCDIC/ASCII of signed/unsigned, *
* zoned-decimal, numeric fields. *
* ASCEBCB3.CPY - includes the character set for the alternate *
* codes with the acute, grave, umlaut, tilde and *
* circumflex. This is primarily used for case *
* conversion. *
* Note: this table converts the Y characters *
* with an umlat, this will convert high-values *
* X'FF' to X'DF' *
* ASCEBCB4.CPY - includes the character set for the alphabet *
* (upper/lower case), digit, special characters. *
* This is primarily used in the US where the *
* alternate codes may not be required. *
* ASCEBCB5.CPY - includes a full character set for the alphabet *
* (upper/lower case), digit, special characters *
* and alternate codes for characters with the *
* acute, grave, umlaut, tilde and circumflex. *
* Caution: this table will convert the Y *
* characters with an umlat. *
*****************************************************************
*
* ------------------------------------------------------------
01 EBCDIC-DATA.
05 FILLER pic X(16)
value X'000102030405060708090A0B0C0D0E0F'. 000-015
05 FILLER pic X(16)
value X'101112131415161718191A1B1C1D1E1F'. 016-031
05 FILLER pic X(16)
value X'202122232425262728292A2B2C2D2E2F'. 032-047
05 FILLER pic X(16)
value X'303132333435363738393A3B3C3D3E3F'. 048-063
05 FILLER pic X(16)
value X'404142434445464748494A4B4C4D4E4F'. 064-079
05 FILLER pic X(16)
value X'505152535455565758595A5B5C5D5E5F'. 080=095
05 FILLER pic X(16)
value X'606162636465666768696A6B6C6D6E6F'. 096-111
05 FILLER pic X(16)
value X'707172737475767778797A7B7C7D7E7F'. 112-127
05 FILLER pic X(16)
value X'808182838485868788898A8B8C8D8E8F'. 128-143
05 FILLER pic X(16)
value X'909192939495969798999A9B9C9D9E9F'. 144-159
05 FILLER pic X(16)
value X'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'. 160-175
05 FILLER pic X(16)
value X'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'. 176-191
05 FILLER pic X(16)
value X'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'. 192-207
05 FILLER pic X(16)
value X'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'. 208-223
05 FILLER pic X(16)
value X'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'. 224-239
05 FILLER pic X(16)
value X'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'. 240-255
01 E-INFO redefines EBCDIC-DATA pic X(256).
01 EBCDIC-TABLE redefines EBCDIC-DATA.
05 EBCDIC-BYTE pic X occurs 256 times.
*
* ------------------------------------------------------------
01 ASCII-DATA.
05 FILLER pic X(16)
value X'000102039C09867F978D8E0B0C0D0E0F'. 000-015
05 FILLER pic X(16)
value X'101112139D8508871819928F1C1D1E1F'. 016-031
05 FILLER pic X(16)
value X'80818283840A171B88898A8B8C050607'. 032-047
05 FILLER pic X(16)
value X'909116939495960498999A9B14159E1A'. 048-063
05 FILLER pic X(16)
value X'20A0E2E4E0E1E3E5E7F1A22E3C282B7C'. 064-079
05 FILLER pic X(16)
value X'26E9EAEBE8EDEEEFECDF21242A293BAC'. 080=095
05 FILLER pic X(16)
value X'2D2FC2C4C0C1C3C5C7D1A62C255F3E3F'. 096-111
05 FILLER pic X(16)
value X'F8C9CACBC8CDCECFCC603A2340273D22'. 112-127
05 FILLER pic X(16)
value X'D8616263646566676869ABBBF0FDFEB1'. 128-143
05 FILLER pic X(16)
value X'B06A6B6C6D6E6F707172AABAE6B8C6A4'. 144-159
05 FILLER pic X(16)
value X'B57E737475767778797AA1BFD0DDDEAE'. 160-175
05 FILLER pic X(16)
value X'5EA3A5B7A9A7B6BCBDBE5B5DAFA8B4D7'. 176-191
05 FILLER pic X(16)
value X'7B414243444546474849ADF4F6F2F3F5'. 192-207
05 FILLER pic X(16)
value X'7D4A4B4C4D4E4F505152B9FBFCF9FAFF'. 208-223
05 FILLER pic X(16)
value X'5CF7535455565758595AB2D4D6D2D3D5'. 224-239
05 FILLER pic X(16)
value X'30313233343536373839B3DBDCD9DAFF'. 240-255
01 A-INFO redefines ASCII-DATA pic X(256).
01 ASCII-TABLE redefines ASCII-DATA.
05 ASCII-BYTE pic X occurs 256 times.
*
*** AE0437B1 - End-of-Copy File - - - - - - - - - - - AE0437B1 *
*****************************************************************
*
This is an example of how a COBOL program can read an ASCII-Indexed file and write an ASCII/Text file. This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers.
In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the Contact or Feedback section of this document.
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 the capabilities of the SimoZAPS Utility Program. This includes generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII while maintaining mainframe (or COBOL) numeric formats and integrity. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.
Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.
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 connection.
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 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 |
| File Format and Content, Convert, KSDS to Text & Expand Numbers |
| Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |