HEX Dump of a KSDS
VSAM with Text & Binary Data Strings
  Table of Contents  v-16.01.01 - ksahex01.htm 
  Introduction
  Execute
  Input Data Structure
  CMD - Produce a Hex-Dump File
  JCL - Produce Hex-Dump Output
  JCL - HEX Dump for a File
  JCL - HEX Dump for Selected Records
  Sample Hex-Dump Output
  Prepare
  Create a Process Control File
  User Defined Include, Working Storage
  User Defined Include, Procedure Division
  Generate the COBOL Source Code
  Technical Details
  Generated COBOL Source Code
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This is an example of how a COBOL program can read from an Indexed file (or a VSAM KSDS) and write to a sequential file (ASCII/Text or Record Sequential) that will contain HEX dump information of a data structure with Text, Packed and Binary Data Strings (or User Defined Fields). The COBOL source code is generated using SimoTime Technologies.

The technique of using a generated COBOL program delivers a solution that may be compiled and executed on an IBM Mainframe System (running ZOS or VSE) and/or a Linux, UNIX or Windows System running Micro Focus Enterprise Server.

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 providing a diagnostic tool for viewing records in a VSAM, KSDS in a HEX-Dump format.

Note: Providing the capability of viewing information in data files will need to be reviewed from a privacy and security perspective based on the requirements of the business.


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

Table of Contents Previous Section Next Section Execute

The following is a quick overview of the members and functions included in the execution phase of this example.

1. KSAHEXW1.cmd - This is targeted for the Windows environment using Micro Focus Server.
1.1. The input is a Micro Focus Indexed (or key-sequenced) file with 512 byte records that may contain text-strings, packed and/or binary data. The key is 12 bytes in length and starts in position 1 of each record.
1.2. The output will include all the records in the file. It produces the HEX-Dump output to files in ASCII/Text format for easy viewing with most text editors.
2. KSAHEXJ2.jcl - This is targeted for a "Mainframe-oriented" environment using ZOS or Micro Focus Enterprise Developer/Server.
2.1. The input is a VSAM Key-Sequenced-Data-Set (KSDS) or a Micro Focus Indexed (or key-sequenced) file with 512 byte records that may contain text-strings, packed and/or binary data. The key is 12 bytes in length and starts in position 1 of each record.
2.2. The output will include all the records in the file. It produces the HEX-Dump output to record sequential files.
3. KSAHEXJ3.jcl - This is targeted for a "Mainframe-oriented" environment using ZOS or Micro Focus Enterprise Developer/Server.
3.1. The input is a VSAM Key-Sequenced-Data-Set (KSDS) or a Micro Focus Indexed (or key-sequenced) file with 512 byte records that may contain text-strings, packed and/or binary data. The key is 12 bytes in length and starts in position 1 of each record.
3.2. The output will include selected records based on the keys defined in SYSUT3 (a record sequential control file). It produces the HEX-Dump output to record sequential files.
4. KSAHEXC1.cbl - This program is executed by the KSAHEXW1.cmd file. The command may be executed from a command line window or simply double-clicking on the item from Windows Explorer.
Note: this command and program will dump the content of an entire file.
5. KSAHEXC2.cbl - This program is executed by the KSAHEXJ2.jcl member.
For the Micro Focus environment the JCL Member may be submitted to the Micro Focus Enterprise Server for execution. The results of the job submission may be reviewed from the Enterprise Server administration screen. The content of the HEX-Dump file may be viewed from the catalog display browser window.
Note: this command and program will dump the content of an entire file.
6. KSAHEXC3.cbl - This program is executed by the KSAHEXJ3.jcl member.
For the Micro Focus environment the JCL Member may be submitted to the Micro Focus Enterprise Server for execution. The results of the job submission may be reviewed from the Enterprise Server administration screen. The content of the HEX-Dump file may be viewed from the catalog display browser window.
Note: this command and program will dump the content of selected records based on the keys defined in SYSUT3.

Table of Contents Previous Section Next Section Input Data Structure

The programs in this example will read a VSAM, Key-Sequenced-Data-Set (KSDS) that has a twelve (12) byte key starting in position 1 of a 512 byte record. The records may contain text-strings, packed and/or binary data.

Table of Contents Previous Section Next Section CMD - Produce a Hex-Dump File

This is targeted for the Windows environment using Micro Focus Server. It produces the HEX-Dump output to files in ASCII/Text format for easy viewing with most text editors. The input is a Micro Focus Indexed (or key-sequenced) file with 512 byte records that may contain text-strings, packed and/or binary data. The key is 12 bytes in length and starts in position 1 of each record. The output will include all the records in the file.

The following Windows Command File (KSAHEXW1.cmd) is a multi-step job that will initialize the environment and produce a HEX Dump file of a VSAM KSDS (or Indexed Data Structure).

@echo OFF
rem  * *******************************************************************
rem  *               KSAHEXW1.cmd - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2017 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  * This is a multiple-step job.
rem  * Step 1 of 3 - Initialize the environment
rem  * Step 2 of 3 - Read the VSAM, KSDS and Produce a HEX-Dump output
rem  * Step 3 of 3 - End of Job Processing
rem  *
rem  * *************************************************************1 of 3
rem  * Step 1 of 3,
rem  * Initialize the environment.
     set CmdName=KSAHEXW1
     call ..\Env1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
     set JobStatus=0000
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%, User is %USERNAME%"
     call SimoNOTE "Continue Step 1 of 3, Initialize the environment."
     set KSADB512=%BASELIB1%\DATA\APPL\SIMOTIME.DATA.KSADB512.dat
     set HEXDB512=%BASELIB1%\DATA\TXT1\SIMOTIME.DATA.HEXDB512.txt
     if exist %HEXDB512% del %HEXDB512%
rem  *
rem  * *************************************************************2 of 3
rem  * Step 2 of 3,
rem  * Dump the File.
     call SimoNOTE "Continue Step 2 of 3, Dump the File."
     run KSAHEXC1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto :EOJNOK
     goto EOJAOK
rem  *
rem  * *************************************************************3 of 3
rem  * Step 3 of 3,
rem  * End of Job Processing.
:EOJNOK
     call SimoNOTE "ABENDING JobName %CmdName%, JobStatus %JobStatus%"
     call SimoNOTE "ABENDING Message JobStatus %JobStatus%"
     goto :EOJ
:EOJAOK
     if exist %HEXDB512% START NOTEPAD %HEXDB512%
     call SimoNOTE "Finished JobName %CmdName%"
:EOJ

Table of Contents Previous Section Next Section JCL - Produce Hex-Dump Output

This section describes the two jobs (JCL Members) that are included in this example. The first JCL Member (KSAHEXJ2.jcl) will dump the content of every record in a file. This may be an acceptable solution in a development or test environment where the test files are small.

For larger files the second job (KSAHEXJ3.jcl) offers an alternative solution to select the records to be dumped by defining the keys of the records in a control file (SYSUT3).

Table of Contents Previous Section Next Section JCL - HEX Dump for a File

This HEX-Dump job is targeted for a "Mainframe-oriented" environment using ZOS or Micro Focus Enterprise Developer/Server.

The input is a VSAM Key-Sequenced-Data-Set (KSDS) or a Micro Focus Indexed (or key-sequenced) file with 512 byte records that may contain text-strings, packed and/or binary data. The key is 12 bytes in length and starts in position 1 of each record.

The output will include all the records in the file. It produces the HEX-Dump output to a record sequential file with a fixed record length that is equal to the record length of the input file.

The following JCL Member (KSAHEXJ2.jcl) is a multi-step job that will initialize the environment and produce a HEX Dump file of a VSAM KSDS (or Indexed Data Structure).

//KSAHEXJ2 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*           KSAHEXJ2.JCL - a Job Control Language Member            *
//*         This program is provided by SimoTime Technologies         *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Subject: Read KSDS and write to RSEQ HEX-Dump. All the records in
//*          the file are dumped.
//* Author:  SimoTime Technologies
//* Date:    January 24, 1996
//*
//* *******************************************************************
//* Step 1 of 2, Delete previously created HEX-Dump file,
//*              use IEFBR14 with a DD Statement
//*
//JOBSETUP EXEC PGM=IEFBR14
//SYSOUT   DD  SYSOUT=*
//HEXDB512 DD  DSN=SIMOTIME.HEXDUMP.CUSTSML1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=F,LRECL=512,DSORG=PS)
//*
//*********************************************************************
//* Step 2 of 2, Dump all the records in the file
//*
//EXECUTE  EXEC PGM=KSAHEXC2
//KSADB512 DD  DSN=SIMOTIME.DATA.DATKS512,DISP=SHR
//HEXDB512 DD  DSN=SIMOTIME.HEXDUMP.CUSTSML1,DISP=(NEW,CATLG,CATLG),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=F,LRECL=512,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section JCL - HEX Dump for Selected Records

This HEX-Dump job is targeted for a "Mainframe-oriented" environment using ZOS or Micro Focus Enterprise Developer/Server.

The input is a VSAM Key-Sequenced-Data-Set (KSDS) or a Micro Focus Indexed (or key-sequenced) file with 512 byte records that may contain text-strings, packed and/or binary data. The key is 12 bytes in length and starts in position 1 of each record.

The output will include selected records based on the keys defined in SYSUT3 (a record sequential control file). It produces the HEX-Dump output to a record sequential file with a fixed record length that is equal to the record length of the input file.

The following JCL Member (KSAHEXJ3.jcl) is a multi-step job that will initialize the environment and produce a HEX Dump file of selected records within a VSAM KSDS (or Indexed Data Structure).

//KSAHEXJ3 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*           KSAHEXJ3.JCL - a Job Control Language Member            *
//*         This program is provided by SimoTime Technologies         *
//*           (C) Copyright 1987-2017 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Subject: Read KSDS and write to RSEQ HEX-Dump. Records to be
//*          dumped are determined at execution time by SYSUT3.
//* Author:  SimoTime Technologies
//* Date:    January 24, 1996
//*
//* *******************************************************************
//* Step 1 of 3, Delete previously created HEX-Dump and Control file,
//*              use IEFBR14 with a DD Statement
//*
//JOBSETUP EXEC PGM=IEFBR14
//SYSOUT   DD  SYSOUT=*
//SYSUT3   DD  DSN=SIMOTIME.HEXDUMP.SYSUT3,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=F,LRECL=80,DSORG=PS)
//HEXDB512 DD  DSN=SIMOTIME.HEXDUMP.CUSBYKEY,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=F,LRECL=512,DSORG=PS)
//*
//*********************************************************************
//* Step 2 of 3, Build a Control File that defines records that will
//*              be written to the HEX-Dump file
//*
//PREPCNTL EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
000000000010
000000000020
/*
//SYSUT2   DD  DISP=(NEW,CATLG,CATLG),
//             UNIT=SYSDA,
//             SPACE=(TRK,(1,1)),
//             DCB=(RECFM=F,LRECL=80,DSORG=PS),
//             DSN=SIMOTIME.HEXDUMP.SYSUT3
//*
//*********************************************************************
//* Step 3 of 3, Dump selected records
//*
//EXECUTE  EXEC PGM=KSAHEXC3
//KSADB512 DD  DSN=SIMOTIME.DATA.CUSTMAST,DISP=SHR
//HEXDB512 DD  DSN=SIMOTIME.HEXDUMP.CUSBYKEY,DISP=(NEW,CATLG,CATLG),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=F,LRECL=512,DSORG=PS)
//SYSUT3   DD  DSN=SIMOTIME.HEXDUMP.SYSUT3,DISP=SHR
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section Sample Hex-Dump Output

The HEX-dump may provide up to six lines of information based on the user-defined parameters.

The following is an example of the HEX-Dump output for a VSAM, KSDS. After the header information the dump format for each record is as follows.

The first two lines are the position indicators that show the byte position within the record.

The third line show the possible ASCII character translation

The fourth and fifth lines contain the HEX Dump information. The fourth line is the high-order nibble (four bits) of the byte. The fifth line is the low-order nibble (four bits) of the byte.

The sixth line is the possible EBCDIC character translation.

********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
* KSAHEXC3 KSD/512 to Hex Dump using SYSUT3   v13.10.28   helpdesk@simotime.com
* KSAHEXC3 This Data File Convert Member was generated by SimoTime Technologies
Starting, KSD/512 to Hex Dump using SYSUT3   http://www.SimoTime.com
********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
        10        20        30        40        50        60        70        80        90       100       110       120       130       140       150       160       170       180       190       200       210       220       230       240       250       260       270       280       290       300       310       320       330       340       350       360       370       380       390       400       410       420       430       440       450       460       470       480       490       500       510
....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+
000000000010 Taylor                      Elizabeth                               47 Hayes Street                                                                                 Angeles                     PR                          00611                                                             ......00000        ..00000        ..00000        2013031913121266000
33333333333325676672222222222222222222222466766676222222222222222222222222222222233246767257766722222222222222222222222222222222222222222222222222222222222222222222222222222222246666672222222222222222222225522222222222222222222222222333332222222222222222222222222222222222222222222222222222222222222000000333332222222200333332222222200333332222222233333333333333333332222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
0000000000100419CF200000000000000000000005C9A1254800000000000000000000000000000004708195303425540000000000000000000000000000000000000000000000000000000000000000000000000000000001E75C530000000000000000000000200000000000000000000000000006110000000000000000000000000000000000000000000000000000000000000000F00000000000000000000000000000000000000000000020130319131212660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
............../`%?........................%.:/......................................./`...........................................................................................>..%.......................&..................................................................................................................................................................................................................................................................................................................
*
        10        20        30        40        50        60        70        80        90       100       110       120       130       140       150       160       170       180       190       200       210       220       230       240       250       260       270       280       290       300       310       320       330       340       350       360       370       380       390       400       410       420       430       440       450       460       470       480       490       500       510
....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+....:....+
000000000020 Robinson                    Dorothy                                 442 Sansome Street                                                                              Castaner                    PR                          00631                                                             ......00000        ..00000        ..00000        2013031913121266000
33333333333325666676622222222222222222222467676722222222222222222222222222222222233325667666257766722222222222222222222222222222222222222222222222222222222222222222222222222222246776667222222222222222222225522222222222222222222222222333332222222222222222222222222222222222222222222222222222222222222000000333332222222200333332222222200333332222222233333333333333333332222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
00000000002002F29E3FE000000000000000000004F2F489000000000000000000000000000000000442031E3FD5034255400000000000000000000000000000000000000000000000000000000000000000000000000000031341E52000000000000000000000200000000000000000000000000006310000000000000000000000000000000000000000000000000000000000000000F00000000000000000000000000000000000000000000020130319131212660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
..............?..>.?>.....................?.?..`....................................../>.?_......................................................................................./../>......................&..................................................................................................................................................................................................................................................................................................................
* 

Table of Contents Previous Section Next Section Prepare

Creating a process and an environment for the development and deployment of a utility program or suite of programs requires planning, preparation and execution. This section will focus on the preparation effort to create a utility program that will provide a Hex-Dump capability for a VSAM, Key-Sequenced-Data-Set (KSDS). For non-relational data structures this process will leverage a variety of skills and a broad knowledge base that may be acquired through training, experience, research and assistance.

Table of Contents Previous Section Next Section Create a Process Control File

In this example we will generate a COBOL program that will read a VSAM, KSDS and write to a HEX Dump file. The following member (KSAHEX01.pcf) is the Process Control File used to generate the COBOL program.

***********************************************************************
*                KSAHEX01.pcf - a Process Control File                *
*               SimoTime Program Generation Technologies              *
*            (C) Copyright 1987-2017 All Rights Reserved              *
*               Web Site URL:   http://www.simotime.com               *
*                     e-mail:   helpdesk@simotime.com                 *
***********************************************************************
* SYSUT1 should be an INDEXED, 512-byte, min/average, ASCII content
*        with key position at 1 for a key length of 12.
* SYSUT2 should be an ASCII/Text, 512-byte, maximum record length.
*
* The DIALECT statement specifies the use of Micro Focus compliant
* code for the generated conversion program.
* *********************************************************************
&SIMOPREP  call ..\..\ENV1BASE
&USERPREP  call USERCONV
&CONFORM   IBM
&Dialect   C2
*HEAD34    ....:....1....:....2....:....3....
&HEAD34    KSD/512 input to Hex Dump Output
&progid    KSAHEXC1
&sysut1    name=KSADB512 org=indexed    recfm=variable rlen=512 kpos=1 klen=12
&sysut2    name=HEXDB512 org=ASCII/Text recfm=fixed rlen=512
*
*          --------------------------------------------------------------------
*          The following statement incorporate the use of the "User Exit"
*          functions of the conversion program generator.
*          The USR keyword of the TRANSMODE statement causes the generator
*          to do the following.
*          1. Process the USERDATA statement to create the Data Definitions
*             in WORKING STORAGE of the generated program.
*          2. Process the USEREXEC statement to do the processing logic in
*             the PROCEDURE DIVISION of the generated program.
*
&transmode USR
&USERDATA  HEX4WSUI.inc
&USEREXEC  KSAHEXUI.inc
*
&END

Note:  The &USERDATA statement identifies the name of the include member that contains COBOL source code to be included in the generated programs WORKING-STORAGE section.

Note:  The &USEREXEC statement identifies the name of the include member that contains COBOL source code to be included in the generated programs PROCEDURE DIVISION in the paragraph that builds the output record.

Table of Contents Previous Section Next Section User Defined Include, Working Storage

The following member (HEX4WSUI.inc) is the INCLUDE file that will be inserted into the WORKING-STORAGE Section of the generated the COBOL program.

      *    -----------------------------------------------------------*
      *    User INCLUDE member for WORKING STORAGE. Define the
      *    Pass Area for calling SIMOHEX4.
       01  USER-1ST        pic X       value 'N'.
       COPY PASSHEX4.
      *    -----------------------------------------------------------*

Table of Contents Previous Section Next Section User Defined Include, Procedure Division

The following member (KSAHEXUI.inc) is the INCLUDE file that will be inserted into the Procedure Division of the generated the COBOL program.

      *
      *    -----------------------------------------------------------* KSAHEXUI
      *    User Interface to SIMOHEX4 to provide HEX Dump Information.
           if  USER-1ST not = 'Y'
               move 'DUMP' to PASSHEX4-REQUEST
               move 'Y' to USER-1ST
               add 512 to ZERO giving PASSHEX4-LENGTH
           end-if
           move SYSUT1-REC to PASSHEX4-SOURCE
           CALL 'SIMOHEX4' USING PASSHEX4-PASS-AREA
           move PASSHEX4-ASCII(1:PASSHEX4-LENGTH) to SYSUT2-REC
           perform SYSUT2-WRITE
           move PASSHEX4-UPPER(1:PASSHEX4-LENGTH) to SYSUT2-REC
           perform SYSUT2-WRITE
           move PASSHEX4-LOWER(1:PASSHEX4-LENGTH) to SYSUT2-REC
           perform SYSUT2-WRITE
           move PASSHEX4-EBCDIC(1:PASSHEX4-LENGTH) to SYSUT2-REC
           perform SYSUT2-WRITE
           move '*' to SYSUT2-REC
           exit.
      *    -----------------------------------------------------------* KSAHEXUI

Table of Contents Previous Section Next Section Generate the COBOL Source Code

The following is the content of the Windows command file (EZUTCONV.cmd) 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  * Set the environment variable to use the default directives file.
     set CmdName=ezUTCONV
     call USERCONV
     call SimoNOTE "***********************************************************************%CmdName%"
     call SimoNOTE "Starting %CmdName% Preparation, RC=%ConvertStatus%, PGM=%1"
     set ConvertStatus=0000
     set UTCONVD1=%UTGENGET%\%1proc.PRC
     set UTCONVD2=%UTGENGET%\%1genr.CMD
     set UTCONVD3=%UTGENGET%\%1spec.TXT
     if exist %UTCONVD2% erase %UTCONVD2%
     if exist %UTCONVD3% erase %UTCONVD3%
     call SimoNOTE "*---------------------------------------------------------------------*"
     call SimoNOTE "Starting %CmdName% Generation, RC=%ConvertStatus%, PGM=%1"
     run UTCONVRT
     if not "%ERRORLEVEL%" == "0" set ConvertStatus=0010
     if not "%ConvertStatus%" == "0000" goto :ConvertEojNOK
rem  *
rem  * ************************************************************************
:ConvertEojAOK
     set /A AOK_Count=%AOK_Count% + 1
     call SimoNOTE "*---------------------------------------------------------------------*"
     call SimoNOTE "Starting %CmdName% Execution, RC=%ConvertStatus%, PGM=%1"
     call %1genr
     if not "%ERRORLEVEL%" == "0" set ConvertStatus=0020
     if not "%ConvertStatus%" == "0000" goto :ConvertEojNOK
     call SimoNOTE "Complete %CmdName%, RC=%ConvertStatus%, PGM=%1"
     goto :End
rem  *
rem  * ************************************************************************
:ConvertEojNOK
     set JobStatus=%ConvertStatus%
     set /A NOK_Count=%NOK_Count% + 1
     call SimoNOTE "ABENDING %CmdName%, RC=%ConvertStatus%, PGM=%1, !!!ABENDING!!!"
     echo %1 - Error during Compile, refer to %BaseLib1%\LIST\%1.LST>%BaseLib1%\LOGS\%1.ERR
     goto :End
rem  *
rem  * ************************************************************************
pause
:End

Table of Contents Previous Section Next Section Technical Details

This section provides additional technical detail about the program generation process and the source code that is generated.

Table of Contents Previous Section Next Section Generated COBOL Source Code

The following (KSAHEXC1.cbl) is the COBOL source code that is generated and may be compiled and executed to read a KSDS and create a sequential file of hexadecimal dump information for each record in the data set.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    KSAHEXC1.
       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: 2013-10-13  Generation Time: 22:29:30:01    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   KSADB512 INDEXED       VARIABLE   00512    00001   *
      *                                                       00012   *
      *  SECONDARY HEXDB512 ASCII/CRLF    FIXED      00512            *
      *                                                               *
      *                                                               *
      *****************************************************************
       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 HEXDB512-FILE  ASSIGN TO       HEXDB512
                  ORGANIZATION  IS LINE SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS HEXDB512-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  HEXDB512-FILE
           DATA RECORD    IS HEXDB512-REC
           .
       01  HEXDB512-REC.
           05  HEXDB512-DATA-01 PIC X(00512).

      *****************************************************************
      * This program was created with the SYSMASK3.TXT file as the    *
      * template for the File I/O. It is intended for use with the    *
      * TransCALL facility that makes a call to a routine that does   *
      * the actual conversion between EBCDIC and ASCII. For more      *
      * information or questions contact SimoTime Technologies.       *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      * The SYSMASK3 provides for the sequential reading of the input *
      * file and the sequential writing of the output file.           *
      *                                                               *
      * This program mask is used with a callable subroutine that     *
      * will do ASCII/EBCDIC Conversion based on a COBOL Copy 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.                                          *
      *                                                               *
      * If the key field is not in sequence then refer to SYSMASK4    *
      * to provide for a random add or update of the indexed file.    *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* KSAHEXC1 '.
           05  T2 pic X(34) value 'KSD/512 input to Hex Dump Output  '.
           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 '* KSAHEXC1 '.
           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  HEXDB512-STATUS.
           05  HEXDB512-STATUS-L     pic X.
           05  HEXDB512-STATUS-R     pic X.
       01  HEXDB512-EOF              pic X       value 'N'.
       01  HEXDB512-OPEN-FLAG        pic X       value 'C'.

       01  KSADB512-LRECL            pic 9(5)    value 00512.
       01  HEXDB512-LRECL            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 '* KSAHEXC1 '.
           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 'KSAHEXC1'.

       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   'KSD/512 input to Hex Dump Output  '.
           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  HEXDB512-TOTAL.
           05  HEXDB512-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for HEXDB512'.
      *****************************************************************
      *    User defined working storage...
      *    USERDATA       HEX4WSUI.inc
      *    -----------------------------------------------------------*
      *    User INCLUDE member for WORKING STORAGE. Define the
      *    Pass Area for calling SIMOHEX4.
       01  USER-1ST        pic X       value 'N'.
       COPY PASSHEX4.
      *    -----------------------------------------------------------*

      *****************************************************************
       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 HEXDB512-OPEN

           perform until KSADB512-STATUS not = '00'
               perform KSADB512-READ
               if  KSADB512-STATUS = '00'
                   add 1 to KSADB512-RDR
                   perform BUILD-OUTPUT-RECORD
                   perform HEXDB512-WRITE
                   if  HEXDB512-STATUS = '00'
                       add 1 to HEXDB512-ADD
                   end-if
               end-if
           end-perform

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

           move HEXDB512-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 HEXDB512-CLOSE
           perform KSADB512-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    TransCALL *INC KSAHEXUI.inc
      *
      *    -----------------------------------------------------------* KSAHEXUI
      *    User Interface to SIMOHEX4 to provide HEX Dump Information.
           if  USER-1ST not = 'Y'
               move 'DUMP' to PASSHEX4-REQUEST
               move 'Y' to USER-1ST
               add 512 to ZERO giving PASSHEX4-LENGTH
           end-if
           move KSADB512-REC to PASSHEX4-SOURCE
           CALL 'SIMOHEX4' USING PASSHEX4-PASS-AREA
           move PASSHEX4-ASCII(1:PASSHEX4-LENGTH) to HEXDB512-REC
           perform HEXDB512-WRITE
           move PASSHEX4-UPPER(1:PASSHEX4-LENGTH) to HEXDB512-REC
           perform HEXDB512-WRITE
           move PASSHEX4-LOWER(1:PASSHEX4-LENGTH) to HEXDB512-REC
           perform HEXDB512-WRITE
           move PASSHEX4-EBCDIC(1:PASSHEX4-LENGTH) to HEXDB512-REC
           perform HEXDB512-WRITE
           move '*' to HEXDB512-REC
      *    -----------------------------------------------------------* KSAHEXUI
           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...                           *
      *****************************************************************
       HEXDB512-WRITE.
           if  HEXDB512-OPEN-FLAG = 'C'
               perform HEXDB512-OPEN
           end-if
           write HEXDB512-REC
           if  HEXDB512-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  HEXDB512-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 HEXDB512' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move HEXDB512-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       HEXDB512-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT HEXDB512-FILE
           if  HEXDB512-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to HEXDB512-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with HEXDB512' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move HEXDB512-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       HEXDB512-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close HEXDB512-FILE
           if  HEXDB512-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to HEXDB512-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with HEXDB512' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move HEXDB512-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: 2013-10-13  Generation Time: 22:29:30:05    *
      *****************************************************************

Table of Contents Previous Section Next Section Summary

This is an example of how a COBOL program can read from an Indexed file (or a VSAM KSDS) and write to a sequential file (ASCII/Text or Record Sequential) that will contain HEX dump information of a data structure with Text, Packed and Binary Data Strings (or User Defined Fields). This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers.

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

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

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

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

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

Table of Contents Previous Section Next Section Downloads and Links

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

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

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

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

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

Link to Internet   Link to Server   Explore How to Produce a Hex-Dump for a Record or group of records in an Item File that is a VSAM, KSDS. The Hex-Dump information will be written to an ASCII/Text File and may be easily viewed using a text editor such as NotePAD.

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

Link to Internet   Link to Server   Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.

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

Link to Internet   Link to Server   Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.

Link to Internet   Link to Server   Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connection.

This suite of programs and documentation is available for download. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Comments or Feedback

This document was created and is copyrighted and maintained by SimoTime Technologies.

If you have any questions, suggestions, comments or feedback please call or send an e-mail to: helpdesk@simotime.com

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions or need assistance with converting non-relational data structures simply give us a call at 415 883-6565 or check the web site at http://www.simotime.com


Return-to-Top
Provide a Formatted HEX Dump for a VSAM KSDS or Indexed File
Copyright © 1987-2017
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com