|
Test Case 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. 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 that may include binary characters in a Hexadecimal-Dump format. Both COBOL programs were tested on an IBM Mainframe System, a Windows System and a Linux system. Batch Job Scripts are included for each of the systems.
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.
|
| 1. | STPEEK-USR-DATA, this is the 1st parameter. |
| 1.1. | This string is prepared by the TCPEEKC1 program prior to the call to STPEEKC1. |
| 2. | STPEEK-USR-SIZE, this is the 2nd parameter. |
| 2.1. | This string is prepared by the TCPEEKC1 program prior to the call to STPEEKC1. It should be set to the physical size of the TCPEEK-USR-DATA string. |
| 3. | STPEEK-HEX-DUMP, this is the 3rd parameter. |
| 3.1. | This string is modified by the called program (STPEEKC1) and contains the dump information in a hex-notation format. |
| 4. | STPEEK-HEX-TYPE, this is the 4th parameter. |
| 4.1. | This string is prepared by the TCPEEKC1 program prior to the call to STPEEKC1. |
| 4.1.1. | 1 - Prepare one Line with two bytes of Hex Notation for each byte of User Data. |
| 4.1.2. | 2 - Prepare two Lines with two bytes of Hex Notation for each byte of User Data. |
| 4.1.2.1. | The 1st line if the 1st nibble (bits 0-3). |
| 4.1.2.2. | The 2nd line if the 2nd nibble (bits4-7). |
This section provides the sample command file (TCPEEKW1.cmd) required to run the dump programs on a Windows System with Micro Focus COBOL or GnuCOBOL.
@echo OFF
set CmdName=TCPEEKW1
rem * *******************************************************************
rem * TCPEEKW1.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 - Take a peek at a segment of memory in Hex-Dump format.
rem * Author - SimoTime Technologies
rem * Date - January 24, 1996
rem *
rem * The job is one of the Test Cases used for unit and regression
rem * testing of the STPEEKC1 Utility program. for
rem *
rem * This generated program may be compiled and executed on a Mainframe
rem * System under ZOS or on a Linux, UNIX or Windows (LUW) System with
rem * Micro Focus COBOL or GNUCOBOL
rem *
rem * ************
rem * * TCPEEKW1 *
rem * ********cmd*
rem * *
rem * *
rem * ************ ************
rem * * TCPEEKC1 ******* SYSOUT *
rem * ********cbl* *******lseq*
rem * *
rem * ************
rem * * EOJ *
rem * ************
rem *
rem * LSEQ ..... Line Sequential File (ASCII/Text)
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 *
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, Execute the Test Cases.
rem *
call SimoNOTE "* Progress - Execute the TCPEEKC1 Program"
run TCPEEKC1
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
The following shows the COBOL Programs that are used in this test case.
This program (TCPEEKC1.cbl) was written to test and demonstrate the called program (STPEEKC1.cbl) that does the display of a data buffer or segment of memory in the hexadecimal format.
*
*****************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. TCPEEKC1
*AUTHOR. SIMOTIME TECHNOLOGIES
*Generation Date: 2022-10-29
*Generation Time: 01:49:09:00
*
*****************************************************************
DATA DIVISION.
*
*****************************************************************
WORKING-STORAGE SECTION.
*****************************************************************
* Data-structure for Title, Copyright and Thank you...
* ------------------------------------------------------------
01 SIM-TITLE.
05 ST1 pic X(34) value 'Test Case, Hex-Dump using STPEEKC1'.
05 ST2 pic X(34) value ' v22.10.30 http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 ST3 pic X(34) value 'Copyright - 1987-2022 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 '* TCPEEKC1 '.
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.
*
01 PACKED-NBR-S11-00-X.
05 PACKED-NBR-S11-00 pic S9(11) comp-3.
*
01 PACKED-NBR-S11-02-X.
05 PACKED-NBR-S11-02 pic S9(09)V99 comp-3.
*
01 EDITED-NBR-S11-02-X.
05 EDITED-NBR-S11-02 pic ZZZ,ZZZ,ZZZ.99-.
*
COPY STPEEKB1.
*
*****************************************************************
PROCEDURE DIVISION.
perform POST-ROW-OF-STARS
move '* Enter, PROCEDURE DIVISION' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
perform STARTING-PROGRAM
perform FUNCTION-TEST-01
perform FUNCTION-TEST-02
perform FUNCTION-TEST-03
perform STOPPING-PROGRAM
move '* Leave , PROCEDURE DIVISION' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
GOBACK.
*****************************************************************
FUNCTION-TEST-01.
perform POST-ROW-OF-HYPHENS
move '* Enter, FUNCTION-TEST-01' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
perform INIT-PASS-AREA-STPEEK-2
add 12345 to ZERO giving PACKED-NBR-S11-00
* The following will do the following.
* 1. Determine the physical size of the user data string.
* 2. Move the user field to the STPEEK Field.
* 3. Call STPEEKC1 using STPEEK-USR-DATA.
* Note: The group definition is used for the move instruction.
*
add length of PACKED-NBR-S11-00-X to ZERO
giving STPEEK-USR-SIZE
move PACKED-NBR-S11-00-X to STPEEK-USR-DATA
call 'STPEEKC1' using STPEEK-USR-DATA,
STPEEK-USR-SIZE,
STPEEK-HEX-DUMP,
STPEEK-HEX-TYPE
display 'STPEEK-USR-SIZE (Size of Input)..... '
STPEEK-USR-SIZE
display 'PACKED-NBR-S11-00 (CBL-Display)..... '
PACKED-NBR-S11-00
display 'STPEEK-HEX-DUMP (Hex_1st Nibble).... '
STPEEK-HEX-DUMP(01:STPEEK-USR-SIZE)
display 'STPEEK-HEX-DUMP (Hex_2nd Nibble).... '
STPEEK-HEX-DUMP(61:STPEEK-USR-SIZE)
move '* Leave, FUNCTION-TEST-01' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
exit.
*****************************************************************
FUNCTION-TEST-02.
perform POST-ROW-OF-HYPHENS
move '* Enter, FUNCTION-TEST-02' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
perform INIT-PASS-AREA-STPEEK-2
add 12345 to ZERO giving PACKED-NBR-S11-00
add length of PACKED-NBR-S11-00 to ZERO
giving STPEEK-USR-SIZE
* The following will call STPEEKC1 using the user data field
call 'STPEEKC1' using PACKED-NBR-S11-00,
STPEEK-USR-SIZE,
STPEEK-HEX-DUMP,
STPEEK-HEX-TYPE
display 'STPEEK-USR-SIZE (Size of Input)..... '
STPEEK-USR-SIZE
display 'PACKED-NBR-S11-00 (CBL-Display)..... '
PACKED-NBR-S11-00
display 'STPEEK-HEX-DUMP (Hex_1st Nibble).... '
STPEEK-HEX-DUMP(1:STPEEK-USR-SIZE)
display 'STPEEK-HEX-DUMP (Hex_2nd Nibble).... '
STPEEK-HEX-DUMP(61:STPEEK-USR-SIZE)
move '* Leave, FUNCTION-TEST-02' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
exit.
*****************************************************************
FUNCTION-TEST-03.
perform POST-ROW-OF-HYPHENS
move '* Enter, FUNCTION-TEST-03' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
perform FUNCTION-TEST-03-S01
perform FUNCTION-TEST-03-S02
perform FUNCTION-TEST-03-S03
perform FUNCTION-TEST-03-S04
move '* Leave, FUNCTION-TEST-03' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
exit.
*****************************************************************
FUNCTION-TEST-03-S01.
perform POST-ONE-OF-ONE-STAR.
move '* Begin, FUNCTION-TEST-03, Step-01' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
*
move '* Prepare a positive number for processing.'
to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
move '2' to STPEEK-HEX-TYPE
add 1357.98 to ZERO giving PACKED-NBR-S11-02
add length of PACKED-NBR-S11-02 to ZERO
giving STPEEK-USR-SIZE
call 'STPEEKC1' using PACKED-NBR-S11-02,
STPEEK-USR-SIZE,
STPEEK-HEX-DUMP,
STPEEK-HEX-TYPE
display 'STPEEK-USR-SIZE (Size of Input)..... '
STPEEK-USR-SIZE
display 'PACKED-NBR-S11-02 (CBL-Display)..... '
PACKED-NBR-S11-02
display 'STPEEK-HEX-DUMP (Hex_1st Nibble).... '
STPEEK-HEX-DUMP(1:STPEEK-USR-SIZE)
display 'STPEEK-HEX-DUMP (Hex_2nd Nibble).... '
STPEEK-HEX-DUMP(61:STPEEK-USR-SIZE)
exit.
*****************************************************************
FUNCTION-TEST-03-S02.
perform POST-ONE-OF-ONE-STAR.
move '* Begin, FUNCTION-TEST-03, Step-02' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
*
move '* Present a positive number for human observation.'
to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
move '2' to STPEEK-HEX-TYPE
add PACKED-NBR-S11-02 to ZERO giving EDITED-NBR-S11-02
add length of EDITED-NBR-S11-02 to ZERO
giving STPEEK-USR-SIZE
call 'STPEEKC1' using EDITED-NBR-S11-02,
STPEEK-USR-SIZE,
STPEEK-HEX-DUMP,
STPEEK-HEX-TYPE
display 'STPEEK-USR-SIZE (Size of Input)..... '
STPEEK-USR-SIZE
display 'EDITED-NBR-S11-02 (CBL-Display)..... '
EDITED-NBR-S11-02
display 'STPEEK-HEX-DUMP (Hex_1st Nibble).... '
STPEEK-HEX-DUMP(1:STPEEK-USR-SIZE)
display 'STPEEK-HEX-DUMP (Hex_2nd Nibble).... '
STPEEK-HEX-DUMP(61:STPEEK-USR-SIZE)
exit.
*****************************************************************
FUNCTION-TEST-03-S03.
perform POST-ONE-OF-ONE-STAR.
move '* Begin, FUNCTION-TEST-03, Step-03' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
*
move '* Prepare a negative number for processing.'
to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
move '2' to STPEEK-HEX-TYPE
subtract 1357.98 from ZERO giving PACKED-NBR-S11-02
add length of PACKED-NBR-S11-02 to ZERO
giving STPEEK-USR-SIZE
call 'STPEEKC1' using PACKED-NBR-S11-02,
STPEEK-USR-SIZE,
STPEEK-HEX-DUMP,
STPEEK-HEX-TYPE
display 'STPEEK-USR-SIZE (Size of Input)..... '
STPEEK-USR-SIZE
display 'PACKED-NBR-S11-02 (CBL-Display)..... '
PACKED-NBR-S11-02
display 'STPEEK-HEX-DUMP (Hex_1st Nibble).... '
STPEEK-HEX-DUMP(1:STPEEK-USR-SIZE)
display 'STPEEK-HEX-DUMP (Hex_2nd Nibble).... '
STPEEK-HEX-DUMP(61:STPEEK-USR-SIZE)
exit.
*****************************************************************
FUNCTION-TEST-03-S04.
perform POST-ONE-OF-ONE-STAR.
move '* Begin, FUNCTION-TEST-03, Step-04' to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
*
move '* Present a negative number for human observation.'
to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
move '2' to STPEEK-HEX-TYPE
add PACKED-NBR-S11-02 to ZERO giving EDITED-NBR-S11-02
add length of EDITED-NBR-S11-02 to ZERO
giving STPEEK-USR-SIZE
call 'STPEEKC1' using EDITED-NBR-S11-02,
STPEEK-USR-SIZE,
STPEEK-HEX-DUMP,
STPEEK-HEX-TYPE
display 'STPEEK-USR-SIZE (Size of Input)..... '
STPEEK-USR-SIZE
display 'EDITED-NBR-S11-02 (CBL-Display)..... '
EDITED-NBR-S11-02
display 'STPEEK-HEX-DUMP (Hex_1st Nibble).... '
STPEEK-HEX-DUMP(1:STPEEK-USR-SIZE)
display 'STPEEK-HEX-DUMP (Hex_2nd Nibble).... '
STPEEK-HEX-DUMP(61:STPEEK-USR-SIZE)
exit.
*****************************************************************
INIT-PASS-AREA-STPEEK-2.
move SPACES to STPEEK-USR-DATA
move ZERO to STPEEK-USR-SIZE
move SPACES to STPEEK-HEX-DUMP
move '2' to STPEEK-HEX-TYPE
exit.
*****************************************************************
POST-ONE-OF-ONE-STAR.
move '*' to MESSAGE-TEXT-1(001:001)
perform Z-POST-MESSAGE-TO-USER
exit.
*****************************************************************
POST-ROW-OF-HYPHENS.
move all '-' to MESSAGE-TEXT-1
move '*' to MESSAGE-TEXT-1(001:001)
perform Z-POST-MESSAGE-TO-USER
exit.
*****************************************************************
POST-ROW-OF-STARS.
move all '*' to MESSAGE-TEXT-1
perform Z-POST-MESSAGE-TO-USER
exit.
*****************************************************************
STARTING-PROGRAM.
move SIM-TITLE to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
move SIM-COPYRIGHT to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
move '2' to STPEEK-HEX-TYPE
exit.
*****************************************************************
STOPPING-PROGRAM.
move SIM-THANKS-01 to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
move SIM-THANKS-02 to MESSAGE-TEXT
perform Z-POST-MESSAGE-TO-USER
exit.
*****************************************************************
* The following routines are used to access data files.
*****************************************************************
* 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-MESSAGE-TO-SYSOUT
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform Z-POST-MESSAGE-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 message to SYSOUT device... *
*****************************************************************
Z-POST-MESSAGE-TO-SYSOUT.
perform Z-CALCULATE-MESSAGE-LSB
display MESSAGE-BUFFER(1:MSG-LSB)
move all SPACES to MESSAGE-TEXT
exit.
*****************************************************************
* Display message to CONSOLE device... *
*****************************************************************
Z-POST-MESSAGE-TO-CONSOLE.
perform Z-CALCULATE-MESSAGE-LSB
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:MSG-LSB) upon console
exit.
*****************************************************************
Z-POST-MESSAGE-TO-USER.
perform Z-POST-MESSAGE-TO-CONSOLE
perform Z-POST-MESSAGE-TO-SYSOUT
exit.
This program (STPEEKC1.cbl) 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. STPEEKC1.
AUTHOR. SIMOTIME TECHNOLOGIES.
*****************************************************************
* Copyright (C) 1987-2023 SimoTime Technologies. *
* *
* All rights reserved. Unpublished, all rights reserved under *
* copyright law and international treaty. Use of a copyright *
* notice is precautionary only and does not imply publication *
* or disclosure. *
* *
* Permission to use, copy, modify and distribute this software *
* for any commercial purpose requires a fee to be paid to *
* SimoTime Technologies. Once the fee is received by SimoTime *
* the latest version of the software will be delivered and a *
* license will be granted for use within an enterprise, *
* provided the SimoTime copyright notice appear on all copies *
* of the software. The SimoTime name or Logo may not be used *
* in any advertising or publicity pertaining to the use of the *
* software without the written permission of SimoTime *
* Technologies. *
* *
* Permission to use, copy and modify this software for any *
* non-commercial purpose and without fee is hereby granted, *
* provided the SimoTime copyright notice appear on all copies *
* of the software. The SimoTime name or Logo may not be used *
* in any advertising or publicity pertaining to the use of the *
* software without the written permission of SimoTime *
* Technologies. *
* *
* SimoTime Technologies makes no warranty or representations *
* about the suitability of the software for any purpose. It is *
* provided "AS IS" without any expressed or implied warranty, *
* including the implied warranties of merchantability, fitness *
* for a particular purpose and non-infringement. SimoTime *
* Technologies shall not be liable for any direct, indirect, *
* special or consequential damages resulting from the loss of *
* use, data or projects, whether in an action of contract or *
* tort, arising out of or in connection with the use or *
* performance of this software *
* *
* SimoTime Technologies *
* 15 Carnoustie Drive *
* Novato, CA 94949-5849 *
* 415.883.6565 *
* *
* RESTRICTED RIGHTS LEGEND *
* Use, duplication, or disclosure by the Government is subject *
* to restrictions as set forth in subparagraph (c)(1)(ii) of *
* the Rights in Technical Data and Computer Software clause at *
* DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of *
* Commercial Computer Software - Restricted Rights at 48 *
* CFR 52.227-19, as applicable. Contact SimoTime Technologies, *
* 15 Carnoustie Drive, Novato, CA 94949-5849. *
* *
*****************************************************************
* This program is provided by SimoTime Technologies *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
*****************************************************************
*
* PARAMETERS DESCRIPTION
* ------------------- -----------------------------------------
* STPEEK-USR-DATA Byte Buffer (may contain Binary values)
* STPEEK-USR-SIZE Fullword Integer (Computational)
* STPEEK-HEX-DUMP Character Buffer (Hex Notation)
* STPEEK-HEX-TYPE Format of Hex Notation Buffer
* 1 - Define one Line with two bytes
* 2 - Define two Line with one nibble each
*
* Return Code 0 Successful
* Return Code 4 Unexpected Condition
*
*****************************************************************
*
ENVIRONMENT DIVISION.
*****************************************************************
*
DATA DIVISION.
WORKING-STORAGE SECTION.
* ------------------------------------------------------------- *
01 HEX-TABLE pic X(16) value '0123456789ABCDEF'.
01 IX-1 pic 9(7) value 0.
01 IX-2 pic 9(7) value 0.
01 IX-3 pic 9(7) value 0.
01 IX-4 pic 9(7) value 0.
01 REG-1-X.
05 REG-1-9 pic 9(9) COMP value 0.
01 REG-2-X.
05 REG-2-9 pic 9(9) COMP value 0.
01 REG-3-X.
05 REG-3-9 pic 9(9) COMP value 0.
01 USER-RETURN-CODE pic 9(4) value 0.
*****************************************************************
LINKAGE SECTION.
COPY STPEEKB1.
*****************************************************************
PROCEDURE DIVISION using STPEEK-USR-DATA
STPEEK-USR-SIZE
STPEEK-HEX-DUMP
STPEEK-HEX-TYPE.
if STPEEK-USR-SIZE > 0
perform CONVERT-HEX-TO-TXT
add USER-RETURN-CODE to zero giving RETURN-CODE
else
add 4 to ZERO giving RETURN-CODE
end-if
GOBACK.
*****************************************************************
CONVERT-HEX-TO-TXT.
move ZERO to USER-RETURN-CODE
move SPACES to STPEEK-HEX-DUMP
add 1 to ZERO giving IX-1
add 1 to ZERO giving IX-2
add 2 to ZERO giving IX-3
add 61 to ZERO giving IX-4
perform until IX-1 > STPEEK-USR-SIZE
move STPEEK-USR-DATA(IX-1:1) to REG-1-X(4:1)
divide 16 into REG-1-9 giving REG-2-9 remainder REG-3-9
if STPEEK-HEX-TYPE = '1'
move HEX-TABLE(REG-2-9 + 1:1) to STPEEK-HEX-DUMP(IX-2:1)
move HEX-TABLE(REG-3-9 + 1:1) to STPEEK-HEX-DUMP(IX-3:1)
add 2 to IX-2
add 2 to IX-3
else
move HEX-TABLE(REG-2-9 + 1:1) to STPEEK-HEX-DUMP(IX-2:1)
move HEX-TABLE(REG-3-9 + 1:1) to STPEEK-HEX-DUMP(IX-4:1)
add 1 to IX-2
add 1 to IX-4
end-if
add 1 to IX-1
end-perform
exit.
The following shows the COBOL Copy Files that are used to describe the structure of the memory segments use in this test case.
The following is the copy file (STPEEKB1.cpy) used for the pass area when calling the dump routine.
*****************************************************************
* STPEEKB1.cpy is a COBOL Copy Member *
* Data Structure or Pass Area used for calling STPEEKC1. *
* Copyright (C) 1987-2023 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 *
*****************************************************************
*
* PARAMETERS DESCRIPTION
* ------------------- -----------------------------------------
* STPEEK-USR-DATA Byte Buffer (may contain Binary values)
* STPEEK-USR-SIZE Fullword Integer (Computational)
* STPEEK-HEX-DUMP Character Buffer (Hex Notation)
* STPEEK-HEX-TYPE Format of Hex Notation Buffer
* 1 - Define one Line with two bytes
* 2 - Define two Line with one nibble each
* 1st line is 1st nibble (bits 0-3)
* 2nd line is 2nd nibble (bits 4-7)
*
01 STPEEK-USR-DATA PIC X(60).
01 STPEEK-USR-SIZE PIC 9(09) comp.
01 STPEEK-HEX-DUMP PIC X(120).
01 STPEEK-HEX-TYPE PIC X.
*** STPEEKB1 - End-of-Copy File - - - - - - - - - - - STPEEKB1 *
*****************************************************************
*
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.
Software Agreement and Disclaimer
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.
SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.
This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.
Note: A SimoTime License is required for the items to be made available on a local system or server.
The following links may be to the current server or to the Internet.
Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
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.
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.
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.
| 1. | Send an e-mail to our helpdesk. |
| 1.1. | helpdesk@simotime.com. |
| 2. | Our telephone numbers are as follows. |
| 2.1. | 1 415 763-9430 office-helpdesk |
| 2.2. | 1 415 827-7045 mobile |
We appreciate hearing from you.
SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.
Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.
Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.
Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com
| Return-to-Top |
| Hex Dump Test Case |
| Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |