Diagnostic Aid Hex-Dump of Memory Content |
The SimoTime Home Page |
The DISPLAY function of COBOL will display a message upon a user's console or the system operator's console in an MVS environment. It is quite often used to display information in routines that are performing an abnormal termination of a program. Also, it is still being used as a debugging tool. This approach provides valuable information when a failure occurs. However, there are times when a field or data string may have information that contains non-printable/displayable characters. A callable routine that would display a field or data string in a hexadecimal dump (Hex-Dump) format along with a possible EBCDIC and ASCII interpretation could be an effective tool in providing this information.
This suite of programs provides a demonstration program and a callable program to display a data string in a Hex-Dump format for both EBCDIC and ASCII. Both COBOL programs were written and tested using the COBOL/2 dialect. Also, both COBOL programs will work with COBOL for MVS and COBOL/370. A JCL member is provided to run the job as an MVS batch job on an IBM mainframe or with Micro Focus technologies that support the execution of a mainframe-oriented application running on a Linux, UNIX or Windows platform.
In the world of programming there are many ways to solve a problem. This suite of programs is provided as a COBOL example of a possible solution for producing hexadecimal dump information without an assembler subroutine.
Note: The source code for this example is available from the SimoTime Library under Download Directory at www.simotime.com.
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
The following flowchart provides a quick overview of processing logic used with the hexadecimal dump routine.
HEX-Dump to SYSOUTThe following is an example of the hexadecimal dump information written to the SYSOUT device The following is an example of the hexadecimal dump information provided by the sample programs. This information may be displayed to the screen or written to a log file. The high-lighted YELLOW shows the hexadecimal dump information. The BLUE shows the possible EBCDIC display values and the RED shows the possible ASCII display values. * CBLMEMC1 HEX-Dump of Numeric Field Formats v11.11.03 http://www.simotime.com * CBLMEMC1 Copyright 1987-2019 SimoTime Technologies All Rights Reserved * SIMOHEX1 COBOL Hexadecimal Dump Routine v16.06.15 http://www.simotime.com * SIMOHEX1 Copyright 1987-2019 SimoTime Technologies All Rights Reserved * SIMOHEX1 TXTINFO1 Text String * SIMOHEX1 ADDR is 0000000050243702 * SIMOHEX1 Starting, SIMOHEX1-ID is NBRITEMS, Dump Buffer size is 0256 Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... 00000000 5049432D 39202020 30303030 30313233 &............... PIC-9 00000123 00000010 5049432D 39502020 30303030 30313233 &....&.......... PIC-9P 00000123 00000020 5049432D 394D2020 30303030 30313273 &....(.......... PIC-9M 0000012s 00000030 5049432D 395A2020 30303030 30303030 &....!.......... PIC-9Z 00000000 00000040 434F4D50 2D332020 00000000 0000123F .|(&............ COMP-3 .......? 00000050 434F4D50 2D335020 00000000 0000123C .|(&..&......... COMP-3P .......< 00000060 434F4D50 2D334D20 00000000 0000123D .|(&..(......... COMP-3M .......= 00000070 434F4D50 2D335A20 00000000 0000000C .|(&..!......... COMP-3Z ........ 00000080 434F4D50 20202020 0000007B 20202020 .|(&.......#.... COMP ...{ 00000090 434F4D50 2F502020 0000007B 20202020 .|(&.&.....#.... COMP/P ...{ 000000A0 434F4D50 2F4D2020 FFFFFF85 20202020 .|(&.(.....e.... COMP/M .... 000000B0 434F4D50 2F5A2020 00000000 20202020 .|(&.!.......... COMP/Z .... 000000C0 20202020 20202020 20202020 20202020 ................ 000000D0 20202020 20202020 20202020 20202020 ................ 000000E0 20202020 20202020 20202020 20202020 ................ 000000F0 20202020 20202020 20202020 20202020 ................ * CBLMEMC1 Thank you for using this program provided from SimoTime Technologies * CBLMEMC1 Please send all inquires or suggestions to the helpdesk@simotime.com The Call InterfaceThe coding to do the actual call to display and/or log the hex dump information is as follows. ***************************************************************** * Prepare the Pass Area and call the SIMOHEX1 program. * ----------------------------------------------------------------- move 'DUMP' to SIMOHEX1-REQUEST move 'USERINFO' to SIMOHEX1-DUMP-ID add length of USER-STRING-01 to ZERO giving SIMOHEX1-LENGTH CALL 'SIMOHEX1' USING SIMOHEX1-PASS-AREA USER-STRING-01 Note: In the preceding example the SIMOHEX1-BUFFER is replaced with the name of a user data field. The call to SIMOHEX1 requires two parameters. The following describes the parameters.
Job ScriptsA job script may be defined as a text file containing job setup information followed by job steps that identify programs to be executed along with parameters unique to the job step. A job script may be created using a text editor. The naming of a job script is determined by the Operating System. A simple job script may contain a single job step that performs a single function. A typical job script will contain multiple job steps executed in a predefined sequence. The status of each job step may be tested at the end of each job step. Windows CMD FileThis section provides the command file (CBLMEMW1.cmd) required to run the dump programs on a Microsoft Windows System using Micro Focus COBOL technology. The test job writes the dump information to a user defined SYSOUT device. @echo OFF rem * ******************************************************************* rem * CBLMEMW1.cmd - a Windows Command File * rem * This program is provided by SimoTime Technologies * rem * (C) Copyright 1987-2019 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * ******************************************************************* rem * rem * Text - HEX-Dump using various Numeric Field Formats. rem * Author - SimoTime Technologies rem * Date - January 24, 1996 rem * rem * ******************************************************************* rem * Step 1, Delete any previously created file... rem * set CmdName=CBLMEMW1 call ..\Env1BASE %CmdName% if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG rem * call SimoNOTE "*******************************************************%CmdName%" call SimoNOTE "Starting JobName %CmdName%" run CBLMEMC1 if not ERRORLEVEL = 0 set JobStatus=0010 if not %JobStatus% == 0000 goto :EojNok :EojAok call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%" goto :End :EojNok call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%" :End call SimoNOTE "Conclude SYSOUT is %SYSOUT%" if not "%1" == "nopause" pause JCL MemberThe following is the mainframe JCL (CBLMEMJ1.jcl) required to run the mainline program. The JOB and STEPLIB statements will need to be changed for a specific mainframe environment. This JCL member has a DD statement for the SYSOUT spool file. //CBLMEMJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1, // COND=(0,LT) //* ******************************************************************* //* CBLMEMJ1.JCL - a JCL Member for Batch Job Processing * //* This JCL Member is provided by SimoTime Technologies * //* (C) Copyright 1987-2019 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Text - COBOL calls COBOL for Hexadecimal Dump of a data buffer. //* Author - SimoTime Technologies //* Date - January 01, 1989 //* //* This set of programs illustrate the use of COBOL for displaying //* a data buffer in hexadecimal format. //* //* This set of programs will run on an IBM Mainframe System under ZOS //* or on a Windows System with Micro Focus Enterprise Developer. //* //* ************ //* * CBLMEMJ1 * //* ********jcl* //* * //* * //* ************ ************ ************ //* * CBLMEMC1 ******* SIMOHEX1 ******** SYSOUT * //* ********cbl* ********cbl* ************ //* * //* * //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 of 1, This is a single step job. //* //CBLMEMX1 EXEC PGM=CBLMEMC1 //STEPLIB DD DSN=MFI01.SIMOPROD.LOADLIB1,DISP=SHR //SYSOUT DD SYSOUT=* //* COBOL MembersThere are three (3) COBOL source members in this suite of programs, a mainline (or demonstration) program, a callable bit-manipulation routine and a copy file that defines the pass area. Primary Test ProgramThis program (CBLMEMC1.cbl) was written to test and demonstrate the calling of the COBOL program (SIMOHEX1.CBL) that does the display of a data buffer in the hexadecimal format. IDENTIFICATION DIVISION. PROGRAM-ID. CBLMEMC1. 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: CBLMEMC1.CBL * Copy Files PASSDUMP.CPY * Calls to: SIMOHEX1 may call SIMOLOGS ***************************************************************** * * CBLMEMC1 - Call SIMOHEX1 to build hexadecimal dump information. * * CALLING PROTOCOL * ---------------- * Use standard procedure to EXECUTE, RUN or ANIMATE. * * DESCRIPTION * ----------- * This is a demonstration program to show how to call the * COBOL Hexadecimal Dump Routine. * * ************ * * CBLMEMJ1 * * ********jcl* * * * * * ************ ************ ************ * * CBLMEMC1 ******* SIMOHEX1 ******* SYSOUT * * ********cbl* ********cbl* ************ * * * * * ************ * * EOJ * * ************ * ***************************************************************** * * MAINTENANCE * ----------- * 1989/02/27 Simmons, Created program. * 1997/03/17 Simmons, Updated for COBOL/2. * ***************************************************************** * ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. ***************************************************************** * Data-structure for Title and Copyright... * ------------------------------------------------------------ 01 SIM-TITLE. 05 T1 pic X(11) value '* CBLMEMC1 '. 05 T2 pic X(34) value 'HEX-Dump of Numeric Field Formats '. 05 T3 pic X(10) value ' v11.11.03'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* CBLMEMC1 '. 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 '* CBLMEMC1 '. 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 '* CBLMEMC1 '. 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'. ***************************************************************** * Buffer used for posting messages to the console. * ------------------------------------------------------------ 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(11) value '* CBLMEMC1 '. 05 MESSAGE-TEXT. 10 MESSAGE-TEXT-1 pic X(68). 10 MESSAGE-TEXT-2 pic X(41). 01 TWO-BYTES. 05 TWO-BYTES-01 pic X. 05 TWO-BYTES-02 pic X. 01 TWO-BYTES-BINARY redefines TWO-BYTES pic S9(3) comp. ***************************************************************** * Work fields used for testing call to SIMOHEX1. * ------------------------------------------------------------ 01 ASC pic X(10) value X'30313233343536373839'. 01 PACK-BINARY pic X(12) value X'0000615C4040404000000A01'. 01 ALPHABET-UPPER pic X(26) value 'ABCDEFGHIJKLMNOPQRSTUVWZYZ'. 01 NUMERIC-BUFFER-01. 05 filler pic X(8) value 'PIC-9 '. 05 NB-PIC-9 pic 9(8) value 123. 05 filler pic X(8) value 'PIC-9P '. 05 NB-PIC-9-PLUS pic S9(8) value 123. 05 filler pic X(8) value 'PIC-9M '. 05 NB-PIC-9-MINUS pic S9(8) value -123. 05 filler pic X(8) value 'PIC-9Z '. 05 NB-PIC-9-ZERO pic S9(8) value 0. 05 filler pic X(8) value 'COMP-3 '. 05 NB-COMP-3 pic 9(15) comp-3 value 123. 05 filler pic X(8) value 'COMP-3P '. 05 NB-COMP-3-PLUS pic S9(15) comp-3 value 123. 05 filler pic X(8) value 'COMP-3M '. 05 NB-COMP-3-MINUS pic S9(15) comp-3 value -123. 05 filler pic X(8) value 'COMP-3Z '. 05 NB-COMP-3-ZERO pic S9(15) comp-3 value 0. 05 filler pic X(8) value 'COMP '. 05 NB-COMP pic 9(9) comp value 123. 05 filler pic X(4) value is SPACES. 05 filler pic X(8) value 'COMP/P '. 05 NB-COMP-PLUS pic S9(9) comp value 123. 05 filler pic X(4) value is SPACES. 05 filler pic X(8) value 'COMP/M '. 05 NB-COMP-MINUS pic S9(9) comp value -123. 05 filler pic X(4) value is SPACES. 05 filler pic X(8) value 'COMP/Z '. 05 NB-COMP-ZERO pic S9(9) comp value 0. 05 filler pic X(4) value is SPACES. 05 filler pic X(64) value is SPACES. COPY PASSHEX1. ***************************************************************** PROCEDURE DIVISION. perform Z-POST-COPYRIGHT. perform INITIALIZE-PASS-AREA perform POST-TEXT-INFO-TO-SYSOUT perform POST-GROUP-OF-NUMERICS perform Z-THANK-YOU. GOBACK. ***************************************************************** POST-GROUP-OF-NUMERICS. move 'DUMP' to SIMOHEX1-REQUEST move 'NBRITEMS' to SIMOHEX1-DUMP-ID * Note: the maximum length for a user-defined data string is * 16Kilobytes (16,384 bytes). add length of NUMERIC-BUFFER-01 to ZERO giving SIMOHEX1-LENGTH call 'SIMOHEX1' using SIMOHEX1-PASS-AREA NUMERIC-BUFFER-01 exit. ***************************************************************** * Post a Text Note to SYSOUT. ***************************************************************** POST-TEXT-INFO-TO-SYSOUT. move 'NOTE' to SIMOHEX1-REQUEST move 'TXTINFO1' to SIMOHEX1-DUMP-ID move SPACES to SIMOHEX1-BUFFER move 'Text String ' to SIMOHEX1-BUFFER add 12 to ZERO giving SIMOHEX1-LENGTH call 'SIMOHEX1' using SIMOHEX1-PASS-AREA SIMOHEX1-BUFFER exit. ***************************************************************** INITIALIZE-PASS-AREA. move 'DUMP' to SIMOHEX1-REQUEST move 0 to SIMOHEX1-RESULT move 'CBLMEMC1' to SIMOHEX1-DUMP-ID add 128 to ZERO giving SIMOHEX1-LENGTH move all SPACES to SIMOHEX1-BUFFER exit. ***************************************************************** * The following Z-Routines perform administrative tasks * * for this program. * ***************************************************************** Z-POST-COPYRIGHT. display SIM-TITLE display SIM-COPYRIGHT exit. ***************************************************************** Z-POST-MESSAGE. if MESSAGE-TEXT-2 = SPACES display MESSAGE-BUFFER(1:79) else display MESSAGE-BUFFER end-if move SPACES to MESSAGE-TEXT exit. ***************************************************************** Z-THANK-YOU. display SIM-THANKS-01 display SIM-THANKS-02 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 * ***************************************************************** Hex-Dump RoutineThis program (SIMOHEX1.gnt) is provided as a diagnostic aid. It uses the DISPLAY function of COBOL to display hexadecimal dump information of a data field to the SYSOUT device. Copy File for a Pass AreaThe following is the copy file (PASSHEX1.cpy) used for the pass area when calling the dump routine. ***************************************************************** * PASSHEX1 is a COBOL Copy File * * Data Structure or Pass Area used for calling SIMOHEX1. * * Copyright (C) 1987-2019 SimoTime Technologies * * All Rights Reserved * ***************************************************************** * Provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * ***************************************************************** * Values for SIMOHEX1-REQUEST * DUMP Dump the Buffer in Hexadecimal format * NOTE Display or Write the text to the screen or log file * * One format for calling SIMOHEX1 uses the data buffer * defined within this COBOL Copy file. * * move 'DUMP' to SIMOHEX1-REQUEST * move 'MYDUMPID' to SIMOHEX1-DUMP-ID * move SPACES to SIMOHEX1-BUFFER * move 'Text String ' to SIMOHEX1-BUFFER * add 12 to ZERO giving SIMOHEX1-LENGTH * call 'SIMOHEX1' using SIMOHEX1-PASS-AREA * SIMOHEX1-BUFFER * * An alternate call passes a user-defined data structure. * * move 'DUMP' to SIMOHEX1-REQUEST * move 'NBRITEMS' to SIMOHEX1-DUMP-ID * add length of NUMERIC-BUFFER-01 to ZERO * giving SIMOHEX1-LENGTH * call 'SIMOHEX1' using SIMOHEX1-PASS-AREA * NUMERIC-BUFFER-01 * ***************************************************************** 01 SIMOHEX1-PASS-AREA. * Initial information is provided by the calling program, * The SIMOHEX1-REQUEST field will be modified to "DUMP" if it * does not contain a valid entry. 05 SIMOHEX1-REQUEST PIC X(4). 05 SIMOHEX1-RESULT PIC 9999. 05 SIMOHEX1-DUMP-ID PIC X(8). 05 SIMOHEX1-LENGTH PIC 9(7). 01 SIMOHEX1-BUFFER PIC X(128). * *** PASSHEX1 - End-of-Copy File - - - - - - - - - - - PASSHEX1 * ***************************************************************** * SummaryThe primary purpose of the document is to describe a callable routine that will display a field or data string in a hexadecimal dump (Hex-Dump) format along with a possible EBCDIC and ASCII interpretation. This document may be used to assist 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. Explore the COBOL Connection for more examples of COBOL programming techniques and sample code. 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 how to convert a memory-resident data string of one-byte items to a text string of two-byte items using hexadecimal notation. The hexadecimal notation string is then posted to the SYSOUT device. This test case executes an assembler (HLASM) program that calls a COBOL program to write the HEX-Dump information to the SYSOUT device. 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. 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. Contact 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
|