Hexadecimal Dump Sequential or ASCII/Text File |
The SimoTime Home Page |
This suite of sample programs performs Sequential File I/O and HEX-Dump formatting of an ASCII/Text File using Micro Focus COBOL. The programs describe how to dump the input records to an output file in Hexadecimal format. This suite of programs will run on a Mainframe System with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Developer/Server. The use of the EXTFHTAB.CFG file (EXTernal-File-Handler) is used to override the Micro Focus default that replaces TAB characters with SPACE characters.
The COBOL program is compiled with the ASSIGN(EXTERNAL) and the SEQUENTIAL(LINE) directives. The former provides for external file mapping of file names. The latter provides for the mapping of the SEQUENTIAL files specified in the COBOL program to LINE SEQUENTIAL (or ASCII/TEXT) files. This technique provides for the use of a single COBOL source program that will run on a Mainframe System with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Developer/Server.
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 example illustrates the following functions.
| ||||||||||||||||
Objectives and Functions of the Text to Hexadecimal Dump Suite of Programs |
The following is a flowchart of the job for executing the HEX-Dump programs.
The main program (TXTHEXC1) will read a Sequential file (TEXT0512) and produce a 128-byte, fixed record length Sequential file (SYSHEXT1). The contents of this file will be the HEX-Dump information for the first 128 byte of each record in the TEXT0512 input file. The source code for the CMD file, the JCL member and the COBOL programs is provided and may be modified to fit your environment. Color Associations: The Programming RequirementsThis suite of samples programs will run on the following platforms.
Data Input and OutputThe following sections describe the data flow and format. Data InputThe input is in stream data from the JCL Member or Command File. The following five records will be added to the file. I am record 001 of TEXT0512 I am record 002 of TEXT0512 - 0123456789 I am record 003 of TEXT0512 - ABCDEFGHIJKLMNOPQRSTUVWXYZ I am record 004 of TEXT0512 - abcdefghijklmnopqrstuvwxyz I am record 005 of TEXT0512 - * Tab01 Tab02 tab03 Data Output from EBCDIC-encoded FileThe following is an example of the EBCDIC environment. * TXTHEXC1 HEX-Dump of TEXT Data Set v03.12.05 http://www.simotime.com * TXTHEXC1 Copyright 1987-2010 SimoTime Enterprises, LLC All Rights Reserved ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 .@..@......@...@..@........K...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ C48949889984FFF4984EEECCEEF4EEE444444444444444444444444444444444444444444444444 901409536940001066037385731B373000000000000000000000000000000000000000000000000 I am record 001 of TXTHEXT1.TXT ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 .@..@......@...@..@........K...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ C48949889984FFF4984EEECCEEF4EEE444444444444444444444444444444444444444444444444 901409536940002066037385731B373000000000000000000000000000000000000000000000000 I am record 002 of TXTHEXT1.TXT ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 .@..@......@...@..@........K...@`@..........................@@@@@@@@@@@@@@@@@@@ C48949889984FFF4984EEECCEEF4EEE464CCCCCCCCCDDDDDDDDDEEEEEEEE4444444444444444444 901409536940003066037385731B373000123456789123456789234567890000000000000000000 I am record 003 of TXTHEXT1.TXT - ABCDEFGHIJKLMNOPQRSTUVWXYZ ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 .@..@......@...@..@........K...@`@..........................@@@@@@@@@@@@@@@@@@@ C48949889984FFF4984EEECCEEF4EEE464888888888999999999AAAAAAAA4444444444444444444 901409536940003066037385731B373000123456789123456789234567890000000000000000000 I am record 003 of TXTHEXT1.TXT - abcdefghijklmnopqrstuvwxyz ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 .@..@......@...@..@........K...@`@\@@@@@.....@@@.....@@@.....@@@@@@@@@@@@@@@@@@ C48949889984FFF4984EEECCEEF4EEE464544444E88FF444E88FF444A88FF444444444444444444 901409536940005066037385731B373000C00000312010003120200031203000000000000000000 I am record 005 of TXTHEXT1.TXT - * Tab01 Tab02 tab03 * TXTHEXC1 NORMAL-END-OF-JOB * TXTHEXC1 Thank you for using this sample by SimoTime Enterprises, LLC * TXTHEXC1 Please send comments or suggestions to helpdesk@simotime.com Data Output from ASCII-encoded FileThe following is an example of the HEX-Dump information produced on a PC with Micro Focus Net Express. This is an ASCII environment ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 I am record 001 of TXTHEXT1.TXT 4266276667623332662555445532555222222222222222222222222222222222222222222222222 901D0253F2400010F6048485841E484000000000000000000000000000000000000000000000000 ../_....?.......?.............................................................. ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 I am record 002 of TXTHEXT1.TXT 4266276667623332662555445532555222222222222222222222222222222222222222222222222 901D0253F2400020F6048485841E484000000000000000000000000000000000000000000000000 ../_....?.......?.............................................................. ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 I am record 003 of TXTHEXT1.TXT - ABCDEFGHIJKLMNOPQRSTUVWXYZ 4266276667623332662555445532555222444444444444444555555555552222222222222222222 901D0253F2400030F6048485841E4840D0123456789ABCDEF0123456789A0000000000000000000 ../_....?.......?............................<(+|&.........!................... ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 I am record 003 of TXTHEXT1.TXT - abcdefghijklmnopqrstuvwxyz 4266276667623332662555445532555222666666666666666777777777772222222222222222222 901D0253F2400030F6048485841E4840D0123456789ABCDEF0123456789A0000000000000000000 ../_....?.......?................./........|.%_>?.........`:................... ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 I am record 005 of TXTHEXT1.TXT - *.Tab01.Tab02.tab03 4266276667623332662555445532555222205663305663307663322222222222222222222222222 901D0253F2400050F6048485841E4840D0A94120194120294120300000000000000000000000000 ../_....?.......?..................../...../...../............................. CMD, Hex-Dump of ASCII/Text FileThe following (TXTHEXE1.cmd) is a sample of the Windows CMD needed to run this job. @echo OFF rem * ************************************************************************ rem * TXTHEXE1.cmd - a Windows Command File * rem * This program is provided by SimoTime Enterprises * rem * (C) Copyright 1987-2014 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * ************************************************************************ rem * rem * Text - COBOL for Sequential Files and Hex-Dump formatting rem * Author - SimoTime Enterprises rem * Date - January 01, 1997 rem * rem * This set of programs illustrates the use of COBOL programs rem * to do Sequential File I/O. The purpose is to show the processing rem * of a Sequential Files. The programs describe how to dump the rem * the input records to an output file in Hexadecimal format. rem * rem * The use of the EXTFH.CFG file is to override the Micro Focus rem * default that replaces TAB characters with SPACE characters. rem * rem * The COBOL programs are compiled with the ASSIGN(EXTERNAL) and rem * the SEQUENTIAL(LINE) directives. This provides for external rem * file mapping and the SEQUENTIAL files specified in the COBOL rem * program will map to LINE SEQUENTIAL (or ASCII/TEXT) files. rem * This technique provides for the use of a single COBOL source rem * program that will run on OS/390, Windows or Unix. rem * rem * This procedure uses the SimoNOTE.CMD to display information to the rem * screen and write to a log file. rem * the parameters to be passed as if they were from JCL. rem * The SimoNOTE programs is available from the Simotime web site rem * and is part of the SimoMODS package. rem * rem * The call to ezSetEnv will set the environment variables. This rem * technique is used to define a single place where commonly use rem * environemnt variable may be set and then used by multiple users. rem * rem * This set of programs will run on a Personal Computer with Windows rem * and Micro Focus Net Express. rem * rem * ************ rem * * TXTHEXE1 * rem * ********jcl* rem * * rem * ************ rem * * RUN * rem * ********cbl* rem * * rem * * rem * ************ ************ ************ rem * * TEXT0512 ******* TXTHEXC1 ******* SYSHEXT1 * rem * ********txt* ********cbl* * ********txt* rem * * * rem * * * rem * * * ************ rem * * **** CONSOLE * rem * * * ********crt* rem * * * rem * * * rem * * * ************ rem * * **** DUMPHEX4 * rem * * ********cbl* rem * ************ rem * * EOJ * rem * ************ rem * rem * ******************************************************************* rem * set CmdName=TxtHexE1 call ..\Env1BASE %CmdName% if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG rem * call SimoNOTE "*******************************************************%CmdName%" call SimoNOTE "Starting CmdName %CmdName%" rem * ******************************************************************* rem * Step 1 of 1 This is a single step job. rem * set TEXT0512=%BaseLib1%\datalibA\asc1\txthext1.txt set SYSHEXT1=%BaseLib1%\datalibA\wrk1\syshext1.txt set extfh=%BaseLib1%\SysLibA1\extfhtab.cfg call SimoNOTE "*******************************************************%CmdName%" call SimoNOTE "DataTake, ASCII/Text Input File %TEXT0512%" call SimoNOTE "DataMake, A HexDump Output File %SYSHEXT1%" run SIMOEXEC EXEC TxtHexC1 PARM=FORMAT(B) if not "%ERRORLEVEL%" == "0" set JobStatus=0010 if not "%JobStatus%" == "0000" goto :EojNOK :EojAOK call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus%" goto :End :EojNOK call SimoNOTE "ABENDING CmdName %CmdName%, Job Status is %JobStatus%" goto :End :End call SimoNOTE "Conclude SysOut is %SYSOUT%" if not "%1" == "nopause" pause exit /B %JobStatus% JCL, Hex-Dump of Sequential FileThe following (TXTHEXJ1.jcl) is a sample of the mainframe, OS/390 JCL needed to run this job. This JCL will also run on a Windows platform using Micro Focus Mainframe Express (MFE). This job may be executed on the mainframe as an MVS or OS/390 batch job. It may also be executed on the PC running Micro Focus Mainframe Express product. The JOB and DD statements will require modification prior to execution on a mainframe. //TXTHEXJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1, // COND=(0,LT) //* ******************************************************************* //* This program is provided by SimoTime Technologies * //* (C) Copyright 1987-2019 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Text - COBOL for Sequential file I/O and HEX-Dump formatting. //* Author - SimoTime Technologies //* Date - January 01, 1997 //* //* This set of programs illustrates the use of COBOL programs //* to do Sequential File I/O. The purpose is to show the processing //* of a Sequential Files. The programs describe how to dump the //* the input records to an output file in Hexadecimal format. //* //* This set of programs will run on a mainframe under MVS or on a //* Personal Computer with Windows and Micro Focus Mainframe Express. //* //* This set of programs will run on a Personal Computer with Windows //* and Micro Focus Mainframe Express using the following. //* //* The use of the extfh.cfg file is to override the Micro Focus //* default that replaces TAB characters with SPACE characters. //* //* The COBOL programs are compiled with the ASSIGN(EXTERNAL) and //* the SEQUENTIAL(LINE) directives. This provides for external //* file mapping and the SEQUENTIAL files specified in the COBOL //* program will map to LINE SEQUENTIAL (or ASCII/TEXT) files. //* This technique provides for the use of a single COBOL source //* program that will run on OS/390, Windows or Unix. //* //* //* ************ //* * TXTHEXJ1 * //* ********jcl* //* * //* ************ //* * IEFBR14 * //* ************ //* * //* ************ ************ ************ //* * TEXT0512 ******* TXTHEXC1 ******* SYSHEXT1 * //* ********txt* ********cbl* * ********txt* //* * * //* * * //* * * ************ //* * **** CONSOLE * //* * * ********crt* //* * * //* * * //* * * ************ //* * **** SIMOHEX4 * //* * ********cbl* //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 of 4, This job step will delete a previously created //* hex-dump file. //* //DELTHEX1 EXEC PGM=IEFBR14 //SYSHEXT1 DD DSN=SIMOTIME.DATA.SYSHEXT1,DISP=(MOD,DELETE,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS) //SYSHEXT2 DD DSN=SIMOTIME.DATA.SYSHEXT2,DISP=(MOD,DELETE,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS) //SYSUT2 DD DSN=SIMOTIME.DATA.TEXT0512, // DISP=(MOD,DELETE,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=512,DSORG=PS) //* //* ******************************************************************* //* Step 2 of 4, Create and populate a new QSAM file... //* //MAKEFILE EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //* :....1....:....2....:....3....:....4....:....5....:....6....:....7. //SYSUT1 DD * I am record 001 of TEXT0512 I am record 002 of TEXT0512 - 0123456789 I am record 003 of TEXT0512 - ABCDEFGHIJKLMNOPQRSTUVWXYZ I am record 004 of TEXT0512 - abcdefghijklmnopqrstuvwxyz I am record 005 of TEXT0512 - * Tab01 Tab02 tab03 /* //SYSUT2 DD DSN=SIMOTIME.DATA.TEXT0512, // DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=512,DSORG=PS) //* //* ******************************************************************* //* Step 3 of 4, This job step will read the Sequential File and //* write the HEX-Dump information to a new Sequential File. //* //* This step will display both the ASCII and EBCDIC characters. //* The ASCII is displayed above the HEX-Dump lines and the //* EBCDIC is displayed below the HEX-Dump lines. //* The PARM=FORMAT(B) produces both to ASCII and EBCDIC //* //TXTHEXX1 EXEC PGM=TXTHEXC1,PARM=FORMAT(B) //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //TEXT0512 DD DSN=SIMOTIME.DATA.TEXT0512,DISP=SHR //SYSHEXT1 DD DSN=SIMOTIME.DATA.SYSHEXT1,DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=128,BLKSIZE=1280,DSORG=PS) //SYSOUT DD SYSOUT=* //* //* ******************************************************************* //* Step 4 of 4, This job step will read the Sequential File and //* write the HEX-Dump information to a new Sequential File. //* //* This step will only display the EBCDIC characters below the //* HEX-Dump lines. //* The PARM=FORMAT(E) produces only the EBCDIC display line. //* //TXTHEXX2 EXEC PGM=TXTHEXC1,PARM=FORMAT(E) //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //TEXT0512 DD DSN=SIMOTIME.DATA.TEXT0512,DISP=SHR //SYSHEXT1 DD DSN=SIMOTIME.DATA.SYSHEXT2,DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=128,BLKSIZE=1280,DSORG=PS) //SYSOUT DD SYSOUT=* //* COBOL Demonstration ProgramThe following (TXTHEXC1.cbl) is a sample of the mainframe COBOL demonstration program that does the file I/O and calls the Hex-Formatting program to build the dump information. IDENTIFICATION DIVISION. PROGRAM-ID. TXTHEXC1. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * Copyright (C) 1987-2019 SimoTime Technologies. * * * * All rights reserved. Unpublished, all rights reserved under * * copyright law and international treaty. Use of a copyright * * notice is precautionary only and does not imply publication * * or disclosure. * * * * Permission to use, copy, modify and distribute this software * * for any non-commercial purpose and without fee is hereby * * granted, 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. * * * * Permission to use, copy, modify and distribute this software * * for any commercial purpose requires a fee to be paid to * * SimoTime Technologies. Once the fee is received by SimoTime * * the latest version of the software 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 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 * * * * SimoTime Technologies * * 15 Carnoustie Drive * * Novato, CA 94949-5849 * * 415.883.6565 * * * * RESTRICTED RIGHTS LEGEND * * Use, duplication, or disclosure by the Government is subject * * to restrictions as set forth in subparagraph (c)(1)(ii) of * * the Rights in Technical Data and Computer Software clause at * * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of * * Commercial Computer Software - Restricted Rights at 48 * * CFR 52.227-19, as applicable. Contact SimoTime Technologies, * * 15 Carnoustie Drive, Novato, CA 94949-5849. * * * ***************************************************************** * This program is provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * ***************************************************************** * ***************************************************************** * Source Member: TXTHEXC1.CBL * Copy Files: PASSHEX4.CPY * Calls to: SIMOHEX4.CBL ***************************************************************** * * TXTHEXC1 - Execute TXTHEXC1 to read a Sequential file. * * * DESCRIPTION * ----------- * This program will will read a Sequential file and display * HEX-Dump information to the console. * It will also write the HEX-Dump information to a * sequential file. * * ************ * * TXTHEXJ1 * * ********jcl* * * * * * ************ ************ * * IEFBR14 *-----* SYSHEXT1 * * ********utl* ***delete*** * * * * * ************ ************ ************ * * TEXT0512 *-----* TXTHEXC1 *--*--* SYSHEXT1 * * *******ksds* ********cbl* * *******qsam* * * * * * * * * * ************ * * **** SIMOHEX4 * * * ********cbl* * * * * * ************ * * EOJ * * ************ * ***************************************************************** * * MAINTENANCE * ----------- * 1996/03/15 Simmons, Created program. * 1996/03/15 Simmons, No changes to date. * ***************************************************************** * ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. * ***************************************************************** *** FOR VS COBOL II USE THE FOLLOWING... <----------*** * SELECT TEXT0512-FILE ASSIGN to TEXT0512 ORGANIZATION is SEQUENTIAL ACCESS MODE is SEQUENTIAL FILE STATUS is TEXT0512-STATUS. SELECT SYSHEXT1-FILE ASSIGN to SYSHEXT1 ORGANIZATION is SEQUENTIAL ACCESS MODE is SEQUENTIAL FILE STATUS is SYSHEXT1-STATUS. DATA DIVISION. FILE SECTION. * ***************************************************************** *** FOR VS COBOL II USE THE FOLLOWING... <----------*** FD TEXT0512-FILE. 01 TEXT0512-RECORD. 05 TEXT0512-DATA pic X(512). * ***************************************************************** *** FOR VS COBOL II USE THE FOLLOWING... <----------*** FD SYSHEXT1-FILE. 01 SYSHEXT1-RECORD. 05 SYSHEXT1-DATA pic X(128). WORKING-STORAGE SECTION. ***************************************************************** * Data-structure for Title and Copyright... * ------------------------------------------------------------ 01 SIM-TITLE. 05 T1 pic X(11) value '* TXTHEXC1 '. 05 T2 pic X(34) value 'HEX-Dump, Sequential or ASCII/Text'. 05 T3 pic X(10) value ' v08.06.02'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* TXTHEXC1 '. 05 C2 pic X(20) value 'Copyright 1987-2019 '. 05 C3 pic X(28) value ' SimoTime Technologies '. 05 C4 pic X(20) value ' All Rights Reserved'. 01 SIM-THANKS-01. 05 C1 pic X(11) value '* TXTHEXC1 '. 05 C2 pic X(32) value 'Thank you for using this program'. 05 C3 pic X(32) value ' provided from SimoTime Technolo'. 05 C4 pic X(04) value 'gies'. 01 SIM-THANKS-02. 05 C1 pic X(11) value '* TXTHEXC1 '. 05 C2 pic X(32) value 'Please send all inquires or sugg'. 05 C3 pic X(32) value 'estions to the helpdesk@simotime'. 05 C4 pic X(04) value '.com'. 01 TEXT0512-STATUS. 05 TEXT0512-STAT1 pic X. 05 TEXT0512-STAT2 pic X. 01 SYSHEXT1-STATUS. 05 SYSHEXT1-STAT1 pic X. 05 SYSHEXT1-STAT2 pic X. ***************************************************************** * 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. ***************************************************************** * Buffer used for posting messages to the console. ***************************************************************** 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(11) value '* TXTHEXC1 '. 05 MESSAGE-TEXT. 10 MESSAGE-TEXT-1 pic X(68) value SPACES. 10 MESSAGE-TEXT-2 pic X(188) value SPACES. 01 END-OF-FILE pic X(3) value 'NO '. 01 APPL-RESULT pic S9(9) comp. 88 APPL-AOK value 0. 88 APPL-EOF value 16. 01 FORMAT-TYPE pic X value 'B'. 01 LOWER-CASE pic X(26) value 'abcdefghijklmnopqrstivwxyz'. 01 UPPER-CASE pic X(26) value 'ABCDEFGHIJKLMNOPQRSTIVWXYZ'. 01 HEX-HEADER. 05 filler pic X(20) value '....+....1....+....2'. 05 filler pic X(20) value '....+....3....+....4'. 05 filler pic X(20) value '....+....5....+....6'. 05 filler pic X(20) value '....+....7....+....8'. COPY PASSHEX4. ***************************************************************** LINKAGE SECTION. 01 PARM-BUFFER. 05 PARM-LENGTH pic S9(4) comp. 05 PARM-DATA pic X(256). ***************************************************************** PROCEDURE DIVISION using PARM-BUFFER. perform FIRST-TIME-PROCESSING perform TEXT0512-OPEN. perform SYSHEXT1-OPEN. move 'DUMP' to PASSHEX4-REQUEST perform until END-OF-FILE = 'YES' if END-OF-FILE = 'NO ' perform TEXT0512-GET-NEXT if END-OF-FILE = 'NO ' move TEXT0512-RECORD(1:128) to PASSHEX4-SOURCE perform BUILD-HEX-DUMP-INFO perform ACTION-IS-DISPLAY perform ACTION-IS-WRITE-TO-FILE end-if end-if end-perform. perform TEXT0512-CLOSE. perform SYSHEXT1-CLOSE. display '* TXTHEXC1 NORMAL-END-OF-JOB' upon console perform Z-THANK-YOU. GOBACK. ***************************************************************** * The following routines are in alphabetical sequence. * ***************************************************************** ACTION-IS-DISPLAY. display HEX-HEADER if FORMAT-TYPE = 'A' or FORMAT-TYPE = 'B' display PASSHEX4-ASCII(1:79) end-if display PASSHEX4-UPPER(1:79) display PASSHEX4-LOWER(1:79) if FORMAT-TYPE = 'E' or FORMAT-TYPE = 'B' display PASSHEX4-EBCDIC(1:79) end-if exit. ***************************************************************** ACTION-IS-WRITE-TO-FILE. move HEX-HEADER to SYSHEXT1-RECORD perform SYSHEXT1-WRITE if FORMAT-TYPE = 'A' or FORMAT-TYPE = 'B' move PASSHEX4-ASCII to SYSHEXT1-RECORD perform SYSHEXT1-WRITE end-if move PASSHEX4-UPPER to SYSHEXT1-RECORD perform SYSHEXT1-WRITE move PASSHEX4-LOWER to SYSHEXT1-RECORD perform SYSHEXT1-WRITE if FORMAT-TYPE = 'E' or FORMAT-TYPE = 'B' move PASSHEX4-EBCDIC to SYSHEXT1-RECORD perform SYSHEXT1-WRITE end-if exit. ***************************************************************** BUILD-HEX-DUMP-INFO. call 'SIMOHEX4' using PASSHEX4-PASS-AREA exit. ***************************************************************** FIRST-TIME-PROCESSING. perform Z-POST-COPYRIGHT move 'B' to FORMAT-TYPE if PARM-LENGTH = 9 inspect PARM-DATA(1:9) converting LOWER-CASE to UPPER-CASE evaluate PARM-DATA(1:9) when 'FORMAT(B)' move 'B' to FORMAT-TYPE when 'FORMAT(A)' move 'A' to FORMAT-TYPE when 'FORMAT(E)' move 'E' to FORMAT-TYPE end-evaluate exit. ***************************************************************** * I/O ROUTINES TO WRITE THE QSAM FILE FOR HEX-DUMP INFO... * ***************************************************************** SYSHEXT1-CLOSE. add 8 to ZERO giving APPL-RESULT. close SYSHEXT1-FILE if SYSHEXT1-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'SYSHEXT1-FAILURE-CLOSE...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move TEXT0512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* SYSHEXT1-WRITE. write SYSHEXT1-RECORD. if SYSHEXT1-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if TEXT0512-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 'YES' to END-OF-FILE else move 'SYSHEXT1-FAILURE-WRITE...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move TEXT0512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if. exit. *---------------------------------------------------------------* SYSHEXT1-OPEN. add 8 to ZERO giving APPL-RESULT. open output SYSHEXT1-FILE if SYSHEXT1-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'SYSHEXT1-FAILURE-OPEN...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move TEXT0512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. ***************************************************************** * I/O ROUTINES TO READ THE KSDS, VSAM DATA SET... * ***************************************************************** TEXT0512-CLOSE. add 8 to ZERO giving APPL-RESULT. close TEXT0512-FILE if TEXT0512-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'TEXT0512-FAILURE-CLOSE...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move TEXT0512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* TEXT0512-GET-NEXT. read TEXT0512-FILE. if TEXT0512-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if TEXT0512-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 'YES' to END-OF-FILE else move 'TEXT0512-FAILURE-GET...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move TEXT0512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if. exit. *---------------------------------------------------------------* TEXT0512-OPEN. add 8 to ZERO giving APPL-RESULT. open input TEXT0512-FILE if TEXT0512-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'TEXT0512-FAILURE-OPEN...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move TEXT0512-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. ***************************************************************** * The following Z-Routines perform 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 the file status bytes. This routine will display as * * two digits if the full two byte file status is numeric. If * * second byte is non-numeric then it will be treated as a * * binary number. * ***************************************************************** 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. ***************************************************************** * I/O ROUTINES TO DISPLAY MESSAGES TO THE CONSOLE... * ***************************************************************** Z-DISPLAY-MESSAGE-TEXT. if MESSAGE-TEXT-2 = SPACES display MESSAGE-BUFFER(1:79) upon console else display MESSAGE-BUFFER upon console end-if move all SPACES to MESSAGE-TEXT exit. ***************************************************************** Z-POST-COPYRIGHT. display SIM-TITLE upon console display SIM-COPYRIGHT upon console exit. ***************************************************************** Z-THANK-YOU. display SIM-THANKS-01 upon console display SIM-THANKS-02 upon console exit. ***************************************************************** * This example is provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * ***************************************************************** COBOL Hex-Formatting RoutineThe following (SIMOHEX4.cbl) is a sample of the mainframe COBOL Hex-Formatting program. IDENTIFICATION DIVISION. PROGRAM-ID. SIMOHEX4. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * Copyright (C) 1987-2019 SimoTime Technologies. * * * * All rights reserved. Unpublished, all rights reserved under * * copyright law and international treaty. Use of a copyright * * notice is precautionary only and does not imply publication * * or disclosure. * * * * Permission to use, copy, modify and distribute this software * * for any commercial purpose requires a fee to be paid to * * SimoTime Technologies. Once the fee is received by SimoTime * * the latest version of the software 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. * * * * Permission to use, copy and modify this software for any * * non-commercial purpose and without fee is hereby granted, * * 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 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 * * * * SimoTime Technologies * * 15 Carnoustie Drive * * Novato, CA 94949-5849 * * 415.883.6565 * * * * RESTRICTED RIGHTS LEGEND * * Use, duplication, or disclosure by the Government is subject * * to restrictions as set forth in subparagraph (c)(1)(ii) of * * the Rights in Technical Data and Computer Software clause at * * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of * * Commercial Computer Software - Restricted Rights at 48 * * CFR 52.227-19, as applicable. Contact SimoTime Technologies, * * 15 Carnoustie Drive, Novato, CA 94949-5849. * * * ***************************************************************** * This program is provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * ***************************************************************** * ***************************************************************** * Source Member: SIMOHEX4.CBL * Copy Files: HEXTABLE.CPY * PASSHEX4.CPY ***************************************************************** * * PASSHEX4 - Create Hexadecimal Dump information. * * * DESCRIPTION * ----------- * This program will scan the source buffer and create * HEX-Dump information plus ASCII and EBCDIC display info. * * ************ ************ * * TXTHEXJ1 * * TXTHEXE1 * * ********jcl* ********cmd* * * * * * * * ************ ************ * * IEFBR14 * * SIMOEXEC * * ********utl* ********cbl* * * * * ************************* * * * * * ************ ************ ************ * * TEXT0512 *-----* TXTHEXC1 *-----* QSAMHEXW * * *******crlf* ********cbl* *******crlf* * * * * ************ * *------call-* SIMOHEX4 * * * ********cbl* * * * ************ * * EOJ * * ************ * ***************************************************************** * * MAINTENANCE * ----------- * 1996/03/15 Simmons, Created program. * 1996/03/15 Simmons, No changes to date. * ***************************************************************** DATA DIVISION. WORKING-STORAGE SECTION. 01 FIVE-BYTES pic X(5). 01 IDX-1 pic 9(3) BINARY. 01 IDX-1R REDEFINES IDX-1. 05 IDX-1R-01 pic X. 05 IDX-1R-02 pic X. 01 IDX-2 pic 9(3) BINARY. COPY HEXTABLE. ***************************************************************** LINKAGE SECTION. COPY PASSHEX4. ***************************************************************** PROCEDURE DIVISION using PASSHEX4-PASS-AREA. add 8 to ZERO giving PASSHEX4-RESULT if PASSHEX4-LENGTH not NUMERIC add 128 to ZERO giving PASSHEX4-LENGTH end-if if PASSHEX4-LENGTH > 1024 add 128 to ZERO giving PASSHEX4-LENGTH end-if if PASSHEX4-REQUEST = 'DUMP' perform DUMP-PROCESSING else add 16 to ZERO giving PASSHEX4-RESULT end-if GOBACK. ***************************************************************** * The following routines are in alphabetical sequence. * ***************************************************************** DUMP-PROCESSING. move all SPACES to PASSHEX4-DUMP-INFO perform varying IDX-2 from 1 by 1 until IDX-2 > PASSHEX4-LENGTH add 1 to ZERO giving IDX-1 move PASSHEX4-SOURCE(IDX-2:1) to IDX-1R-02 add 1 to IDX-1 move TAB-X1(IDX-1) to FIVE-BYTES move FIVE-BYTES(1:1) to PASSHEX4-UPPER(IDX-2:1) move FIVE-BYTES(2:1) to PASSHEX4-LOWER(IDX-2:1) move FIVE-BYTES(3:1) to PASSHEX4-EBCDIC(IDX-2:1) move FIVE-BYTES(4:1) to PASSHEX4-ASCII(IDX-2:1) end-perform exit. ***************************************************************** * This example is provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * ***************************************************************** SummaryThe purpose of this program is to provide examples for accessing a Sequential file and creating a new Sequential file containing Hexadecimal Dump information. 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.
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. Downloads and LinksThis 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. Current Server or Internet AccessThe 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 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. Internet Access RequiredThe 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. Glossary of TermsExplore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers. Comments or FeedbackThis document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.
We appreciate hearing from you. Company OverviewSimoTime 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
|