Diagnostic Aid
Hex-Dump of Memory Content
  Table of Contents  v-24.01.01 - mem2hx01.htm 
  Introduction
  Diagram of Logic Flow
  HEX-Dump to SYSOUT
  The Call Interface
  CMD File for a Batch Job
  COBOL Programs
  Main COBOL Program
  Hex-Dump Callable Program
  COBOL Copy Files
  Copy File for a Pass Area
  Copy File for a Binary Table
  Copy File for Numeric Values
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Contact or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

The DISPLAY function of COBOL will display a message upon a user's console or the system operator's console in an MVS environment. The content of the message is determined by a user-defined seqment of data stored in random access memory (RAM). This function is quite often used to display information in routines that are performing an abnormal termination of a program. Also, this function may be used as a debugging or diagnostic 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 or non-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

Table of Contents Previous Section Next Section Diagram of Logic Flow

The following flowchart provides a quick overview of processing logic used with the hexadecimal dump routine.

             
Entry Point
ZOS
Entry Point
Windows
The JCL or CMD member with the optional statement to write to a log file.      
   
   
CBLMEMJ1
jcl
CBLMEMW1
cmd
The JCL or CMD member for running the application.
   
   
 
 
   
   
 
 
   
   
   
   
CBLMEMC1
cbl
 
 
SYSOUT
The CBLMEMC1 member is a COBOL test program that calls the actual Hexadecimal Dump routine.
   
   
   
IF EOJ
 
 
 
 
   
   
If EOJ then go to End-of-Job.
   
No
Yes
   
SIMOHEX1
cbl
 
 
SYSOUT
   
The SIMOHEX1 member is a COBOL Hexadecimal Dump routine that displays the dump information to the SYSOUT device
   
   
   
   
   
   
   
 
 
 
 
   
   
EOJ
End-of-Job
 
Example of using the Callable Hex-Dump Routine

Table of Contents Previous Section Next Section HEX-Dump to SYSOUT

The 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 BLACK text with the Light BLUE background identifies the starting point for a segment of user-defined memory. The BLACK text with the YELLOW background shows the hexadecimal dump information. The BLUE text shows the possible EBCDIC encoded values. The RED text shows the possible ASCII encoded values.

* CBLMEMC1 HEX-Dump of Numeric Field Formats  v11.11.03 http://www.simotime.com
* MEM2HXC1 * Enter, PROCEDURE DIVISION
* MEM2HXC1 Test Case for Hex-Dump of Memory   v00.00.00 http://www.simotime.com
* MEM2HXC1 Copyright - 1987-2019 by 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 ADDR is 0000000048254702
* SIMOHEX1 Starting, SIMOHEX1-ID is BINTAB01, Dump Buffer size is 0256
   Offset Hex..... ........ ........ ........ ebcdic.......... ascii...........
 00000000 00010203 04050607 08090A0B 0C0D0E0F ................ ................
 00000010 10111213 14151617 18191A1B 1C1D1E1F ................ ................
 00000020 20212223 24252627 28292A2B 2C2D2E2F ................  !"#$%&'()*+,-./
 00000030 30313233 34353637 38393A3B 3C3D3E3F ................ 0123456789:;<=>?
 00000040 40414243 44454647 48494A4B 4C4D4E4F  ...........<(+| @ABCDEFGHIJKLMNO
 00000050 50515253 54555657 58595A5B 5C5D5E5F &.........!$*);¬ PQRSTUVWXYZ[\]^_
 00000060 60616263 64656667 68696A6B 6C6D6E6F -/........¦,%_>? `abcdefghijklmno
 00000070 70717273 74757677 78797A7B 7C7D7E7F .........`:#@'=" pqrstuvwxyz{|}~.
 00000080 80818283 84858687 88898A8B 8C8D8E8F .abcdefghi...... ................
 00000090 90919293 94959697 98999A9B 9C9D9E9F .jklmnopqr...... ................
 000000A0 A0A1A2A3 A4A5A6A7 A8A9AAAB ACADAEAF .~stuvwxyz...... ......¦.....¬...
 000000B0 B0B1B2B3 B4B5B6B7 B8B9BABB BCBDBEBF ^.........[].... ................
 000000C0 C0C1C2C3 C4C5C6C7 C8C9CACB CCCDCECF {ABCDEFGHI...... ................
 000000D0 D0D1D2D3 D4D5D6D7 D8D9DADB DCDDDEDF }JKLMNOPQR...... ................
 000000E0 E0E1E2E3 E4E5E6E7 E8E9EAEB ECEDEEEF \.STUVWXYZ...... ................
 000000F0 F0F1F2F3 F4F5F6F7 F8F9FAFB FCFDFEFF 0123456789...... ................
* SIMOHEX1 ADDR is 0000000048264702
* 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 ................
* MEM2HXC1 Thank you for using this program provided from SimoTime Technologies
* MEM2HXC1 Please send all inquires or suggestions to the helpdesk@simotime.com
* MEM2HXC1 * Leave, PROCEDURE DIVISION

The 1st segment of memory in the preceding hex-dump is identified with a tag of BINTAB01. This is a 256 byte array of one byte elements that includes values from x'00' through x'FF'.

The 2nd segment of memory in the preceding hex-dump is identified with a tag of NBRITEMS. This is a 256 byte group item that contains various numeric values that are stored in memory using a Zoned-decimal, Packed-decimal (COMP-3) and Binary (COMP) format.

Table of Contents Previous Section Next Section The Call Interface

The coding to do an 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.

1. SIMOHEX1-PASS-AREA, this is the 1st parameter. It is a group item of four (4) fields.
1.1. SIMOHEX1-REQUEST, this parameter is four (4) chatacters and is case sensitive. It must be upper-case.
1.1.1. DUMP - This parameter value will cause the text string in the SIMOHEX1-BUFFER to be displayed to the SYSOUT device in hexadecimal format. This is the default value.
1.1.2. NOTE - This parameter value will simply post the first 68 bytes in the SIMOHEX1-BUFFER to the SYSOUT device.
1.2. SIMOHEX1-RESULT, this is an indicator as to the success or failure of the request. A value of zero (0000) indicates the routine was successful in displaying the dump information. A non-zero value indicates a failure.
1.3. SIMOHEX1-DUMP-ID, this is an eight character field that is used to identify the dump. When multiple calls are made to the dump routine it is less confusing if each dump request has a unique identifier.
1.4. SIMOHEX1-LENGTH, the length or number of characters to be displayed. This must be a value from 1-128. If a value other than 1-128 is passed then 128 will be assumed.
2. SIMOHEX1-BUFFER, this is the 2nd parameter. It identifies the data string that will be processed by the the Hex-Dump utility (SIMOHEX1). This is a 128 byte buffer containing the information to be posted to the SYSOUT device. This parameter may be replaced by a user-defined data string (or field name).

 

Table of Contents Previous Section Next Section CMD File for a Batch Job

This section provides the sample command file (MEM2HXW1.cmd) required to run the dump programs on a PC with Micro Focus Net Express.

@echo OFF
rem  * *******************************************************************
rem  *               MEM2HXW1.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   - Do a Sequential File Copy using a generated program.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The job is one of the Installation Verification Procedures for
rem  * the UTGENRIO Utility program. The program that is executed by
rem  * this job was generated using the UTGENRIO program.
rem  *
rem  * The generated program (IVP4ZAC1.cbl) will display a trace message
rem  * as each paragraph is executed..
rem  *
rem  * This generated program may be compiled and executed on a Mainframe
rem  * System under MVS or on a Linux, UNIX or Windows (LUW) System with
rem  * Micro Focus COBOL or GNUCOBOL
rem  *
rem  *                     ************
rem  *                     * MEM2HXW1 *
rem  *                     ********cmd*
rem  *                          *
rem  *                          *
rem  *    ************     ************     ************
rem  *    *  SYSUT1  ******* MEM2HXC1 *******  SYSUT2  *
rem  *    *******rseq*     ********cbl*  *  *******rseq*
rem  *                          *        *
rem  *                          *        *  ************
rem  *                          *        ****  SYSOUT  *
rem  *                          *           ********txt*
rem  *                          *
rem  *                     ************
rem  *                     *    EOJ   *
rem  *                     ************
rem  *
rem  * RSEQ ..... Record Sequential File
rem  * TXT ...... ASCII/Text of Line Sequential File (LSEQ)
rem  *
rem  * The documentation and software were developed and tested on systems
rem  * that are configured for a SimoTime environment based on the
rem  * hardware, operating systems, user requirements and security
rem  * requirements. Therefore, adjustments may be needed to execute the
rem  * jobs and programs when transferred to a system of a different
rem  * architecture or configuration.
rem  *
rem  * *******************************************************************
rem  *
rem  * Step 1,   Prepare the environment.
rem  *
     set CmdName=MEM2HXW1
     call ..\ENV1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "* Starting - CmdName %CmdName%"
     call SimoNOTE "* Progress - Preparing the environment"
     set SYSOUT=%BASELIB1%\LOGS\SYSOUT_%CmdName%.txt
rem  *
rem  * *******************************************************************
rem  * Step 2, Copy the File.
rem  *
     call SimoNOTE "* Progress - Execute the IVP4ZAC1 Program"
     run MEM2HXC1
     if not "%ERRORLEVEL%"== "0" set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
rem  *
rem  * *******************************************************************
rem  * Step 3, End of Job processing..
rem  *
:EojAok
     call SimoNOTE "* Finished - JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "* ABENDING - JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section COBOL Programs

The following shows the COBOL Programs that are used in this test case.

Table of Contents Previous Section Next Section Main COBOL Program

This program (MEM2HXC1.cbl) was written to test and demonstrate the called program (SIMOHEX1.cbl) that does the display of a data buffer or segment of memory in the hexadecimal format.

      *
      *****************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID.      MEM2HXC1
      *AUTHOR.          SIMOTIME TECHNOLOGIES
      *Generation Date: 2018-11-14
      *Generation Time: 15:47:37:53
      *
      *****************************************************************
       DATA DIVISION.
      *
      *****************************************************************
       WORKING-STORAGE SECTION.
      *****************************************************************
      *    Data-structure for Title, Copyright and Thank you...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05 ST1 pic X(34) value 'Test Case for Hex-Dump of Memory  '.
           05 ST2 pic X(34) value ' v00.00.00 http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05 ST3 pic X(34) value 'Copyright - 1987-2019 by SimoTime '.
           05 ST4 pic X(34) value 'Technologies - All Rights Reserved'.

       01  SIM-THANKS-01.
           05 TU1 pic X(34) value 'Thank you for using this program p'.
           05 TU2 pic X(34) value 'rovided from SimoTime Technologies'.
       01  SIM-THANKS-02.
           05 TU3 pic X(34) value 'Please send all inquires or sugges'.
           05 TU4 pic X(34) value 'tions to the helpdesk@simotime.com'.

      *
      *****************************************************************
      *    Message Buffer used for display to SYSOUT or CONSOLE.
      *    MSG-CTR, Counter of trailing spaces in the Message Buffer
      *    MSG-LOB, Allocated Length of Message Buffer
      *    MSG-LSB, Last Significant Byte in Message Buffer
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(011)  value '* MEM2HXC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(068)  value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.
       01  MSG-CTR                 pic 9(3)    value 0.
       01  MSG-LOB                 pic 9(3)    value 267.
       01  MSG-LSB                 pic 9(3)    value 267.
      *
      *    COBOL Copy Files containing Data Structure Definitions.
       COPY PASSHEX1.
       COPY BIN256B1.
       COPY MEM2HXB2.
      *
      *****************************************************************
       PROCEDURE DIVISION.
           move '* Enter, PROCEDURE DIVISION' to MESSAGE-TEXT
           perform Z-POST-TO-USER

           perform PROGRAM-START-UP

           perform FUNCTION-01-BIN-TABLE
           perform FUNCTION-02-NBR-STRUCTURES

           perform PROGRAM-SHUT-DOWN

           move '* Leave, PROCEDURE DIVISION' to MESSAGE-TEXT
           perform Z-POST-TO-USER
           GOBACK.
      *
      ****************************************************************
       PROGRAM-START-UP.
           move SIM-TITLE to MESSAGE-TEXT
           perform Z-POST-TO-USER
           move SIM-COPYRIGHT to MESSAGE-TEXT
           perform Z-POST-TO-USER

           move 'DUMP'           to SIMOHEX1-REQUEST
           move 'MEM2HXR1'       to SIMOHEX1-DUMP-ID
           add 128 to ZERO   giving SIMOHEX1-LENGTH
           exit.
      *
      ****************************************************************
       PROGRAM-SHUT-DOWN.
           move SIM-THANKS-01 to MESSAGE-TEXT
           perform Z-POST-TO-USER
           move SIM-THANKS-02 to MESSAGE-TEXT
           perform Z-POST-TO-USER
           exit.

      *****************************************************************
       FUNCTION-01-BIN-TABLE.
           move 'DUMP'           to SIMOHEX1-REQUEST
           move 'BINTAB01'       to SIMOHEX1-DUMP-ID
           add length of BINARY-DATA to ZERO giving SIMOHEX1-LENGTH
           CALL 'SIMOHEX1' USING SIMOHEX1-PASS-AREA
                                 BINARY-DATA
           exit.

      *****************************************************************
       FUNCTION-02-NBR-STRUCTURES.
           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.

      *****************************************************************
      * The following routines are provided by SIMOTIME Technologies.

      *****************************************************************
      * 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-POST-TO-SYSOUT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-POST-TO-SYSOUT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
       Z-CALCULATE-MESSAGE-LSB.
           add 267 to ZERO giving MSG-LSB
           perform until MSG-LSB < 80
                      or MESSAGE-BUFFER(MSG-LSB:1) not = SPACE
             if MESSAGE-BUFFER(MSG-LSB:1) = SPACE
                subtract 1 from MSG-LSB
             end-if
           end-perform
           exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-POST-TO-SYSOUT.
           perform Z-CALCULATE-MESSAGE-LSB
           display MESSAGE-BUFFER(1:MSG-LSB)
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-POST-TO-CONSOLE.
           perform Z-CALCULATE-MESSAGE-LSB
           if MESSAGE-TEXT-2 = SPACES
           display MESSAGE-BUFFER(1:MSG-LSB) upon console
           exit.

      *****************************************************************
       Z-POST-TO-USER.
           perform Z-POST-TO-CONSOLE
           perform Z-POST-TO-SYSOUT
           exit.


Table of Contents Previous Section Next Section Hex-Dump Callable Program

This 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.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SIMOHEX1.
       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: SIMOHEX1.CBL
      * Copy Files:    PASSHEX1.CPY
      *                HEXTABLE.CPY
      *****************************************************************
      *
      * SIMOHEX1 - Create and Post HEX-Dump info to SYSOUT.
      *
      * CALLING PROTOCOL
      * ----------------
      * Use standard procedure to EXECUTE, RUN or ANIMATE.
      *
      * DESCRIPTION
      * -----------
      * This set of programs illustrate the use of COBOL for displaying
      * a data buffer in hexadecimal format.
      *
      *          ************
      *          * ASMCBLJ1 *
      *          ********jcl*
      *               *
      *          ************
      *          * ASMCBLA1 *
      *          ********asm*
      *               *
      *          ************     ************     ************
      *          * ASMCBLC1 *-----* SIMOHEX1 *-----*  SYSOUT  *
      *          ********cbl*     ********cbl*     *******lseq*
      *
      *****************************************************************
      *
      * 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 '* SIMOHEX1 '.
           05  T2 pic X(34) value 'COBOL Hexadecimal Dump Routine    '.
           05  T3 pic X(10) value ' v16.06.15'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* SIMOHEX1 '.
           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'.

      *****************************************************************
      *    Buffer used for posting messages to the console.
      *    ------------------------------------------------------------
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* SIMOHEX1 '.
           05  MESSAGE-TEXT        pic X(256)  value SPACES.
       01  MSG-LSB                 pic 9(3)    value 256.

       01  MSG-79                  pic X(79)   value SPACES.

      *****************************************************************
      *    Buffer used for posting dump information to the console.
      *    ------------------------------------------------------------
       01  DUMP-BUFFER.
           05  DUMP-TEXT           pic X(79).

      *****************************************************************

       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.

       01  IX-0           pic 9999 value 0.
       01  IX-1           pic 9999 value 0.
       01  IX-2           pic 9999 value 0.
       01  IX-3           pic 9999 value 0.
       01  IX-4           pic 9999 value 0.
       01  IX-5           pic 9999 value 0.

       01  IP-1           pic 9(5) value 0.
       01  IP-2           pic 9(5) value 0.

       01  POSITION-PTR   pic 9(7) value 0.
       01  LOOP-QUIT      pic X    value 'N'.

       01  WA-4                    pic X(4)      value LOW-VALUES.
       01  WA-5                    pic X(5)      value is SPACES.
       01  WA-8                    pic X(9)      value '00000000'.

       01  BUFFER-SIZE-LIMIT-GROUP.
           05  BUFFER-SIZE-LIMIT   pic 9(7)      value 16384.
       01  BUFFER-LENGTH           pic 9999      value 0.
       01  LINE-LENGTH             pic 9999      value 0.

       01  DUMP-HEADER.
      *    05  filler pic X value '*'.
           05  filler pic X value ' '.
           05  H1 pic X(8)  value '  Offset'.
           05  filler pic X value ' '.
           05  H2 pic X(35) value 'Hex..... ........ ........ ........'.
           05  filler pic X value ' '.
           05  H3 pic X(16) value 'ebcdic..........'.
           05  filler pic X value ' '.
           05  H4 pic X(16) value 'ascii...........'.

       01  DUMP-LINE.
      *    05  filler pic X value '*'.
           05  filler pic X value ' '.
           05  D1 pic X(8)  value ' x00-x0F'.
           05  filler pic X value ' '.
           05  D2 pic X(35) value 'xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx'.
           05  filler pic X value ' '.
           05  D3 pic X(16) value '................'.
           05  filler pic X value ' '.
           05  D4 pic X(16) value '................'.

       01  X-DUMP-LINE.
      *    05  filler pic X value '*'.
           05  filler pic X value ' '.
           05  X1 pic X(8)  value ' x00-x0F'.
           05  filler pic X value ' '.
           05  X2 pic X(35) value 'xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx'.
           05  filler pic X value ' '.
           05  X3 pic X(16) value '................'.
           05  filler pic X value ' '.
           05  X4 pic X(16) value '................'.

       01  ADDRESS-OFFSET-HEX.
           05  A0 pic X(8)  value ' x00-x0F'.
           05  A1 pic X(8)  value ' x10-x1F'.
           05  A2 pic X(8)  value ' x20-x2F'.
           05  A3 pic X(8)  value ' x30-x3F'.
           05  A4 pic X(8)  value ' x40-x4F'.
           05  A5 pic X(8)  value ' x50-x5F'.
           05  A6 pic X(8)  value ' x60-x6F'.
           05  A7 pic X(8)  value ' x70-x7F'.

       01  ADDRESS-OFFSET-DEC.
           05  B0 pic X(8)  value '   1-016'.
           05  B1 pic X(8)  value '  17-032'.
           05  B2 pic X(8)  value '  33-048'.
           05  B3 pic X(8)  value '  49-064'.
           05  B4 pic X(8)  value '  65-080'.
           05  B5 pic X(8)  value '  81-096'.
           05  B6 pic X(8)  value '  97-112'.
           05  B7 pic X(8)  value ' 113-128'.

       01  DUMP-STATUS-LINE.
           05  DS-DUMP-STATUS  pic X(08) value 'Starting'.
           05  filler          pic X(2)  value ', '.
           05  filler          pic X(15) value 'SIMOHEX1-ID is '.
           05  DS-DUMP-ID      pic X(8)  value 'HEXDUMP1'.
           05  filler          pic X(2)  value ', '.
           05  filler          pic X(20) value 'Dump Buffer size is '.
           05  DS-LENGTH       pic 9999  value 0.

       01  MESSAGE-0004-1.
           05  filler pic X(9)  value 'Warning, '.
           05  filler pic X(29) value 'SIMOHEX1-LENGTH is invalid,  '.
           05  filler pic X(29) value 'must be value from 1 to 128. '.
       01  MESSAGE-0004-2.
           05  filler pic X(9)  value 'Warning, '.
           05  filler pic X(29) value 'Assuming length of 128 bytes.'.

       01  MESSAGE-0008-1.
           05  filler pic X(9)  value 'Warning, '.
           05  filler pic X(24) value 'SIMOHEX1-OUTPUT must be '.
           05  filler pic X(12) value 'OUT1, OUT2, '.
           05  filler pic X(19) value 'OPR1, OPR2 or LOG1.'.
       01  MESSAGE-0008-2.
           05  filler pic X(9)  value 'Warning, '.
           05  filler pic X(22) value 'Assuming OUT1 mode.'.

       01  FIRST-TIME                  pic X    value 'Y'.
       01  USR-PTR-GROUP.
           05  USR-PTR-VALUE           usage is pointer.
       01  USR-PTR-LENGTH              pic 99   value 0.
       01  USR-PTR-DUMP-ADDR           pic X(8) value '00000000'.

       01  HEX-OFFSET-GROUP.
           05  HEX-OFFSET-VALUE        pic 9(9) comp.
       01  HEX-OFFSET-LENGTH           pic 99   value 0.
       01  HEX-OFFSET-DUMP-ADDR        pic X(8) value '00000000'.

       01  DEC-POSITION-GROUP.
           05  DEC-POSITION-VALUE      pic 9(8).
       01  DEC-POSITION-LENGTH         pic 99   value 0.

       01  ADDRESS-DUMP-FMT-64.
           05  ADDRESS-DUMP-FMT-32A    pic X(8) value '00000000'.
           05  ADDRESS-DUMP-FMT-32B    pic X(8) value '00000000'.

       01  OLD-COPY.
           05  SIMOHEX1-OUTPUT         PIC X(4).
           05  SIMOHEX1-COPYRIGHT      PIC X(4).
           05  SIMOHEX1-IDX            PIC 99.
           05  SIMOHEX1-LINES          PIC X(80)   OCCURS 8 TIMES.


       COPY HEXTABLE.

      *****************************************************************
       LINKAGE SECTION.
       COPY PASSHEX1.

      *****************************************************************
       PROCEDURE DIVISION using SIMOHEX1-PASS-AREA, SIMOHEX1-BUFFER.
           if  FIRST-TIME = 'Y'
               perform FIRST-TIME-PROCESSING
           end-if

           evaluate SIMOHEX1-REQUEST
               when 'NOTE' perform ACTION-IS-POST-TEXT-INFO
               when 'DUMP' perform ACTION-IS-POST-DUMP-INFO
               when 'USER' perform ACTION-IS-POST-USER-INFO
               when other  move 'DUMP' to SIMOHEX1-REQUEST
                           perform ACTION-IS-POST-DUMP-INFO
           end-evaluate
           GOBACK.

      *****************************************************************
       ACTION-IS-POST-TEXT-INFO.
           move SIMOHEX1-DUMP-ID      to MESSAGE-TEXT
           move SIMOHEX1-BUFFER(1:68) to MESSAGE-TEXT(10:68)
           perform Z-POST-MESSAGE-TO-CONSOLE
           exit.

      *****************************************************************
       ACTION-IS-POST-DUMP-INFO.
           perform EDIT-PASS-AREA

           set USR-PTR-VALUE to address of SIMOHEX1-BUFFER
           move ZERO to HEX-OFFSET-VALUE
           add 1 to ZERO giving DEC-POSITION-VALUE

           move USR-PTR-GROUP to WA-4
           perform ADDRESS-FORMATTING
           move WA-8 to USR-PTR-DUMP-ADDR
           move WA-8 to ADDRESS-DUMP-FMT-32B

           display '* SIMOHEX1 ADDR is ' ADDRESS-DUMP-FMT-64

           if  SIMOHEX1-OUTPUT = 'LOG1'
           or                  = 'OUT1'
           or                  = 'OUT2'
           or                  = 'OPR1'
           or                  = 'OPR2'
               move 'Starting'       to DS-DUMP-STATUS
               move SIMOHEX1-DUMP-ID to DS-DUMP-ID
               move SIMOHEX1-LENGTH  to DS-LENGTH
               move DUMP-STATUS-LINE to MESSAGE-TEXT
               perform Z-POST-MESSAGE-BUFFER
               move DUMP-HEADER to MESSAGE-TEXT
               perform Z-POST-MESSAGE-TEXT
           end-if

           perform DUMP-PROCESSING

           exit.

      *****************************************************************
       ACTION-IS-POST-USER-INFO.

           if  SIMOHEX1-BUFFER(1:7) = 'FORMAT='
               evaluate SIMOHEX1-BUFFER(8:8)
                 when 'ADDRESS ' move ' Address' to H1
                 when 'POSITION' move 'Position' to H1
                 when 'OFFSET  ' move '  Offset' to H1
               end-evaluate
           end-if
           if SIMOHEX1-BUFFER(1:6) = 'LIMIT='
              perform until SIMOHEX1-BUFFER(11:1) not = SPACE
                if SIMOHEX1-BUFFER(11:1) = ' '
                   move SIMOHEX1-BUFFER(10:1) to SIMOHEX1-BUFFER(11:1)
                   move SIMOHEX1-BUFFER(09:1) to SIMOHEX1-BUFFER(10:1)
                   move SIMOHEX1-BUFFER(08:1) to SIMOHEX1-BUFFER(09:1)
                   move SIMOHEX1-BUFFER(07:1) to SIMOHEX1-BUFFER(08:1)
                   move ZERO to SIMOHEX1-BUFFER(7:1)
                end-if
               end-perform
               move SIMOHEX1-BUFFER(7:5) to BUFFER-SIZE-LIMIT-GROUP
               if BUFFER-SIZE-LIMIT is NUMERIC
                  move 'Accepted User Request, increase Buffer Size '
                    to MESSAGE-TEXT
                  move 'maximum limit to '     to MESSAGE-TEXT(45:17)
                  move BUFFER-SIZE-LIMIT-GROUP to MESSAGE-TEXT(62:5)
                  perform Z-POST-MESSAGE-BUFFER
               else
                  add 128 to ZERO giving BUFFER-SIZE-LIMIT
                  move 'Rejected User Request to increase Buffer '
                    to MESSAGE-TEXT
                  move 'Size maximum, reset to ' to MESSAGE-TEXT(42:23)
                  move BUFFER-SIZE-LIMIT-GROUP to MESSAGE-TEXT(64:5)
                  perform Z-POST-MESSAGE-BUFFER
               end-if
           end-if
           exit.

       ACTION-IS-POST-USER-INFO-OLD.
           move DUMP-HEADER to MESSAGE-TEXT
           move '*     Pos' to MESSAGE-TEXT(1:9)
           move '* ....Pos' to MESSAGE-TEXT(1:9)
           perform Z-POST-MESSAGE-TEXT

           move SPACES to D1
           add 1 to ZERO giving POSITION-PTR
           move 'N' to LOOP-QUIT

           add 1 to ZERO giving IX-1
           perform until LOOP-QUIT = 'Y'
             add 1 to ZERO giving IX-2
             add 1 to ZERO giving IX-3
             add 1 to ZERO giving IX-4
             if  SIMOHEX1-LENGTH - IX-1 > 16
                 add 16 to ZERO giving LINE-LENGTH
             else
                 compute LINE-LENGTH = SIMOHEX1-LENGTH - IX-1 + 1
                 move 'Y' to LOOP-QUIT
             end-if
      *      display 'DEBUG ' SIMOHEX1-LENGTH ' ' LINE-LENGTH ' ' IX-1
             move X2 to D2
             move X3 to D3
             move X4 to D4
             perform until LINE-LENGTH = 0
      *        Get table element
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move SIMOHEX1-BUFFER(IX-1:1) to TWO-BYTES-02
               add TWO-BYTES-BINARY to 1 giving IX-5
               move TAB-X1(IX-5) to WA-5
               move WA-5(1:2) to D2(IX-2:2)
      *        Increment to next position in hex-dump area of buffer
               add 2 to IX-2
               if  IX-2 = 9
               or  IX-2 = 18
               or  IX-2 = 27
                   add 1 to IX-2
               end-if
      *        EBCDIC Print Character and increment to next position
               move WA-5(3:1) to D3(IX-3:1)
               add 1 to IX-3
      *        ASCII  Print Character and increment to next position
               move WA-5(4:1) to D4(IX-4:1)
               add 1 to IX-4
      *        Increment pointer to next input buffer byte
               add 1 to IX-1
               subtract 1 from LINE-LENGTH
             end-perform
      *
             move POSITION-PTR to D1
             move DUMP-LINE to MESSAGE-TEXT
             perform Z-POST-MESSAGE-TEXT
             add 16 to POSITION-PTR
           end-perform
           exit.

      *****************************************************************
       ADDRESS-FORMATTING.
           add 1 to ZERO giving IP-1
           add 1 to ZERO giving IP-2
           perform 4 times
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move WA-4(IP-1:1) to TWO-BYTES-02
               add TWO-BYTES-BINARY to 1 giving IX-5
               move TAB-X1(IX-5) to WA-5
               move WA-5(1:2) to WA-8(IP-2:2)
               add 1 to IP-1
               add 2 to IP-2
           end-perform
           exit.

      *****************************************************************
       DUMP-PROCESSING.
           add 1 to ZERO giving IX-0
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-5
           subtract SIMOHEX1-IDX from SIMOHEX1-IDX
           add SIMOHEX1-LENGTH to ZERO giving BUFFER-LENGTH
           if  BUFFER-LENGTH greater than 15
               add 16 to ZERO giving LINE-LENGTH
           else
               add BUFFER-LENGTH to ZERO giving LINE-LENGTH
           end-if
           perform until BUFFER-LENGTH = 0
               add 1 to ZERO giving IX-2
               add 1 to ZERO giving IX-3
               add 1 to ZERO giving IX-4
               move X-DUMP-LINE to DUMP-LINE
               move DEC-POSITION-GROUP to D1
               evaluate H1
                 when ' Address' move USR-PTR-GROUP         to WA-4
                                 perform ADDRESS-FORMATTING
                                 move WA-8                  to D1
                 when '  Offset' move HEX-OFFSET-GROUP      to WA-4
                                 perform ADDRESS-FORMATTING
                                 move WA-8                  to D1
               end-evaluate
               add 8 to IX-0
               perform DUMP-SINGLE-LINE
               if  BUFFER-LENGTH greater than 15
                   subtract 16 from BUFFER-LENGTH
                   set USR-PTR-VALUE up by 16
                   add 16 to HEX-OFFSET-VALUE
                   add 16 to DEC-POSITION-VALUE
               else
                   subtract BUFFER-LENGTH from BUFFER-LENGTH
                   set USR-PTR-VALUE to address of SIMOHEX1-BUFFER
                   move ZERO to HEX-OFFSET-VALUE
                   add 1 to ZERO giving DEC-POSITION-VALUE
               end-if
               if  BUFFER-LENGTH greater than 15
                   add 16 to ZERO giving LINE-LENGTH
               else
                   add BUFFER-LENGTH to ZERO giving LINE-LENGTH
               end-if
           end-perform

           exit.

      *****************************************************************
       DUMP-SINGLE-LINE.
           perform until LINE-LENGTH = 0
      *        Get table element
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move SIMOHEX1-BUFFER(IX-1:1) to TWO-BYTES-02
               add TWO-BYTES-BINARY to 1 giving IX-5
               move TAB-X1(IX-5) to WA-5
               move WA-5(1:2) to D2(IX-2:2)
      *        Increment to next position in hex-dump area of buffer
               add 2 to IX-2
               if  IX-2 = 9
               or  IX-2 = 18
               or  IX-2 = 27
                   add 1 to IX-2
               end-if
      *        EBCDIC Print Character and increment to next position
               move WA-5(3:1) to D3(IX-3:1)
               add 1 to IX-3
      *        ASCII  Print Character and increment to next position
               move WA-5(4:1) to D4(IX-4:1)
               add 1 to IX-4
      *        Increment pointer to next input buffer byte
               add 1 to IX-1
               subtract 1 from LINE-LENGTH
           end-perform
           move DUMP-LINE to DUMP-TEXT
           if  SIMOHEX1-IDX < 8
               add 1 to SIMOHEX1-IDX
               move DUMP-LINE to SIMOHEX1-LINES(SIMOHEX1-IDX)
           end-if
      *    Post HEX-Dump information to the SYSOUT device
           move DUMP-LINE to MESSAGE-TEXT
           perform Z-POST-MESSAGE-TEXT
           exit.

      *****************************************************************
       EDIT-PASS-AREA.
           perform EDIT-PASS-AREA-LENGTH
           exit.

      *****************************************************************
       EDIT-PASS-AREA-LENGTH.
           subtract SIMOHEX1-RESULT from SIMOHEX1-RESULT

           if  SIMOHEX1-LENGTH not NUMERIC
               add 128 to ZERO giving SIMOHEX1-LENGTH
               add 4 to ZERO giving SIMOHEX1-RESULT
           end-if

           if  SIMOHEX1-LENGTH less than 1
           or  SIMOHEX1-LENGTH greater than BUFFER-SIZE-LIMIT
               add 4 to ZERO giving SIMOHEX1-RESULT
               add 128 to ZERO giving SIMOHEX1-LENGTH
           end-if

           if  SIMOHEX1-RESULT not = ZERO
               move MESSAGE-0004-1 to MESSAGE-TEXT
               perform Z-POST-MESSAGE-BUFFER
               move MESSAGE-0004-2 to MESSAGE-TEXT
               perform Z-POST-MESSAGE-BUFFER
           end-if

           exit.

      *****************************************************************
       FIRST-TIME-PROCESSING.
           add 8 to ZERO giving SIMOHEX1-RESULT
           move 'OUT1'          to SIMOHEX1-OUTPUT

           perform POST-COPYRIGHT

           add 1 to ZERO giving SIMOHEX1-IDX
           perform 8 times
               move SPACES to SIMOHEX1-LINES(SIMOHEX1-IDX)
               add 1 to SIMOHEX1-IDX
           end-perform
           subtract SIMOHEX1-IDX from SIMOHEX1-IDX
           move 'N' to FIRST-TIME
           exit.

      *****************************************************************
       POST-COPYRIGHT.
           move SIM-TITLE to     MESSAGE-TEXT
           perform        Z-POST-MESSAGE-TEXT
           move SIM-COPYRIGHT to MESSAGE-TEXT
           perform        Z-POST-MESSAGE-TEXT
           exit.

      *****************************************************************
       Z-POST-MESSAGE-TO-CONSOLE.
           perform Z-CALCULATE-MSG-LENGTH
           if  SIMOHEX1-OUTPUT(1:3) = 'OUT'
               display MESSAGE-BUFFER(1:MSG-LSB)
           else
               display MESSAGE-BUFFER(1:MSG-LSB) upon console
           end-if
           move SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
       Z-POST-MESSAGE-BUFFER.
           evaluate SIMOHEX1-OUTPUT(1:4)
             when 'OUT1' perform Z-POST-MESSAGE-BUFFER-2-SYSOUT
             when other  perform Z-POST-MESSAGE-BUFFER-2-SYSOUT
           end-evaluate
           exit.

      *****************************************************************
       Z-POST-MESSAGE-TEXT.
           evaluate SIMOHEX1-OUTPUT(1:4)
             when 'OUT1' perform Z-POST-MESSAGE-TEXT-TO-SYSOUT
             when other  perform Z-POST-MESSAGE-TEXT-TO-SYSOUT
           end-evaluate
           exit.

      *****************************************************************
       Z-POST-MESSAGE-BUFFER-2-SYSOUT.
           perform Z-CALCULATE-MSG-LENGTH
           display MESSAGE-BUFFER(1:MSG-LSB)
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
       Z-POST-MESSAGE-TEXT-TO-SYSOUT.
           perform Z-CALCULATE-MSG-LENGTH
           display MESSAGE-TEXT(1:MSG-LSB - 11)
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
       Z-CALCULATE-MSG-LENGTH.
           add 267 to ZERO giving MSG-LSB
           if  MESSAGE-BUFFER(122:146) = SPACES
               subtract 146 from MSG-LSB
               if  MESSAGE-BUFFER(80:41) = SPACES
                   subtract 41 from MSG-LSB
               end-if
           end-if
           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       *
      *****************************************************************

Table of Contents Previous Section Next Section COBOL Copy Files

The following shows the COBOL Copy Files that are used to describe the structure of the memory segments use in this test case.

Table of Contents Previous Section Next Section Copy File for a Pass Area

The 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 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Copy File for a Binary Table

The following is the copy file (BIN256B1.cpy) used to define the structure of a binary table or array.

      *****************************************************************
      *               BIN256B1.CPY - a COBOL Copy File                *
      *         Copyright (C) 1987-2018 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
....:.*..1....:....2....:....3....:....4....:....5....:....6....:....7. ..:....8
       01  BINARY-DATA.
           05  FILLER pic X(16)
                          value X'000102030405060708090A0B0C0D0E0F'.    000-015
           05  FILLER pic X(16)
                          value X'101112131415161718191A1B1C1D1E1F'.    016-031
           05  FILLER pic X(16)
                          value X'202122232425262728292A2B2C2D2E2F'.    032-047
           05  FILLER pic X(16)
                          value X'303132333435363738393A3B3C3D3E3F'.    048-063
           05  FILLER pic X(16)
                          value X'404142434445464748494A4B4C4D4E4F'.    064-079
           05  FILLER pic X(16)
                          value X'505152535455565758595A5B5C5D5E5F'.    080=095
           05  FILLER pic X(16)
                          value X'606162636465666768696A6B6C6D6E6F'.    096-111
           05  FILLER pic X(16)
                          value X'707172737475767778797A7B7C7D7E7F'.    112-127
           05  FILLER pic X(16)
                          value X'808182838485868788898A8B8C8D8E8F'.    128-143
           05  FILLER pic X(16)
                          value X'909192939495969798999A9B9C9D9E9F'.    144-159
           05  FILLER pic X(16)
                          value X'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'.    160-175
           05  FILLER pic X(16)
                          value X'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'.    176-191
           05  FILLER pic X(16)
                          value X'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'.    192-207
           05  FILLER pic X(16)
                          value X'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'.    208-223
           05  FILLER pic X(16)
                          value X'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'.    224-239
           05  FILLER pic X(16)
                          value X'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'.    240-255
....:.*..1....:....2....:....3....:....4....:....5....:....6....:....7. ..:....8
      *
       01  B-INFO          redefines BINARY-DATA pic X(256).
       01  BINARY-TABLE    redefines BINARY-DATA.
           05  BINARY-BYTE pic X     occurs 256 times.
      *
      ***  BIN256B1 - End-of-Copy File - - - - - - - - - - - BIN256B1 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Copy File for Numeric Values

The following is the copy file (MEM2HXB2.cpy) used to define the structure of various numeric values stored in different physical formats.

      *****************************************************************
      *               MEM2HXB2.cpy - a COBOL Copy File                *
      *                 A Variety of Numeric Formats                  *
      *         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       *
      *****************************************************************
      *    Numeric strucures of various formats that are used to
      *    describe and demonstrate the properties of the physical
      *    structure of a numeric format.
      *
       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.
      *
      ***  MEM2HXB2 - End-of-Copy File - - - - - - - - - - - MEM2HXB2 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Summary

The 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.

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.

Link to Internet   Link to Server   Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.

Link to Internet   Link to Server   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.

Table of Contents Previous Section Next Section Internet Access Required

The 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.

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 Contact or Feedback

This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.

1. Send an e-mail to our helpdesk.
1.1. helpdesk@simotime.com.
2. Our telephone numbers are as follows.
2.1. 1 415 763-9430 office-helpdesk
2.2. 1 415 827-7045 mobile

 

We appreciate hearing from you.

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 simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Hex Dump of Memory using COBOL
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com