Hex-Dump of Data Buffer
SimoDUMP - The COBOL Source Code
http://www.simotime.com
When technology complements business    Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 10.03.20 
  Introduction
 
  What It Does
  How to Use
  The COBOL Source Code
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Glossary of Terms
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

This document provides a listing of the COBOL source code for viewing. Additional information about this program may be obtained by sending an e-mail to: helpdesk@simotime.com

SimoDUMP, What It Does
(Next) (Previous) (Table-of-Contents)

The SimoDUMP routine (or callable program) will convert a text string to its hexadecimal value with a display or logging capability. It will also translate the possible printable characters for both ASCII and EBCDIC.

The following is an example of the hexadecimal dump information provided by the sample programs.This information may be displayed to the screen or written to a log file. The high-lighted YELLOW shows the hexadecimal dump information. The BLUE shows the possible EBCDIC display values and the RED shows the possible ASCII display values.

* SIMODUMP COBOL Hexadecimal Dump Routine     v03.01.24 http://www.simotime.com
* SIMODUMP Copyright 1987-2004   SimoTime Enterprises, LLC  All Rights Reserved
* DISPLAY1 Starting... Length = 0026
*  Offset Hex..... ........ ........ ........ ebcdic.......... ascii...........
*   1-016 C1C2C3C4 C5C6C7C8 C9D1D2D3 D4D5D6D7 ABCDEFGHIJKLMNOP ................
*  17-032 D8D9E2E3 E4E5E6E9 E8E9xxxx xxxxxxxx QRSTUVWZYZ...... ................
* DISPLAY1 Complete... Length = 0026
* CBLHBXC1 Thank you for using this sample by SimoTime Enterprises, LLC
* CBLHBXC1 Please send comments or suggestions to helpdesk@simotime.com

SimoDUMP, How To Use
(Next) (Previous) (Table-of-Contents)

The coding to do the actual call to display and/or log the hex dump information is as follows.

      *****************************************************************
      *    The coding required to do the call to the Hex-Dump program.
      *    ------------------------------------------------------------
           CALL 'SIMODUMP' USING SIMODUMP-PASS-AREA

A copy file is provided to define the pass area to be used when calling SimoDUMP. The following statement is required in the WORKING STORAGE section of the calling program.

       WORKING STORAGE.
       ...
       ...
       COPY PASSDUMP.
       ...

You may view an example of a COBOL program that uses SimoDUMP at http://www.simotime.com/cblhbx01.htm.

The COBOL Source Code
(Next) (Previous) (Table-of-Contents)

The following is the COBOL Source Code.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SIMODUMP.
       AUTHOR.        SIMOTIME ENTERPRISES.
      *****************************************************************
      * Copyright (C) 1987-2010 SimoTime Enterprises, LLC.            *
      *                                                               *
      * 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    *
      * Enterprises.                                                  *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Enterprises. 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           *
      * Enterprises.                                                  *
      *                                                               *
      * SimoTime Enterprises makes no warranty or representations     *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any express or implied warranty,     *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Enterprises 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 Enterprises                                          *
      * 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 Enterprises,  *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Enterprises         *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *****************************************************************
      *
      *****************************************************************
      * Source Member: SIMODUMP.CBL
      * Copy Files:    PASSDUMP.CPY
      *                HEXTABLE.CPY
      * Calls to:      SIMOLOGS is optional
      *****************************************************************
      *
      * SIMODUMP - Call SIMOLOGS to build hexadecimal dump information.
      *
      * 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.
      *
      *          ************
      *          * CBLHBXJ1 *
      *          ********jcl*
      *               *
      *          ************
      *          * CBLHBXC1 *
      *          ********cbl*
      *               *
      *          ************     ************      ************
      *          * CBLHBXC1 *-----* SIMODUMP *-----* CONSOLE  *
      *          ********cbl*     ********cbl*      ******dsply*
      *                                *
      *                                *
      *                           ************     ************
      *                           * SIMOLOGS *-----* CBLHBXD1 *
      *                           ********cbl*     *******file*
      *
      *****************************************************************
      *
      * 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 '* SIMODUMP '.
           05  T2 pic X(34) value 'COBOL Hexadecimal Dump Routine    '.
           05  T3 pic X(10) value ' v10.02.28'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* SIMODUMP '.
           05  C2 pic X(20) value 'Copyright 1987-2010 '.
           05  C3 pic X(28) value '  SimoTime Enterprises, LLC '.
           05  C4 pic X(20) value ' All Rights Reserved'.

      *****************************************************************
      *    Buffer used for posting messages to the console.
      *    ------------------------------------------------------------
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER.
               10  filler          pic X(02)   value '* '.
               10  MESSAGE-HEAD02  pic X(08)   value 'SIMODUMP'.
               10  filler          pic X       value SPACE.
           05  MESSAGE-TEXT        pic X(68).

       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  WA-5                    pic X(5)    value is SPACES.

       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(7)  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(7)  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(7)  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(7)  value 'x00-x0F'.
           05  A1 pic X(7)  value 'x10-x1F'.
           05  A2 pic X(7)  value 'x20-x2F'.
           05  A3 pic X(7)  value 'x30-x3F'.
           05  A4 pic X(7)  value 'x40-x4F'.
           05  A5 pic X(7)  value 'x50-x5F'.
           05  A6 pic X(7)  value 'x60-x6F'.
           05  A7 pic X(7)  value 'x70-x7F'.

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

       01  DUMP-STATUS-LINE.
           05  filler          pic X(2)  value '* '.
           05  DS-DUMP-ID      pic X(8)  value 'HEXDUMP1'.
           05  filler          pic X     value is SPACE.
           05  DS-DUMP-STATUS  pic X(8)  value 'Starting'.
           05  filler          pic X(4)  value '... '.
           05  filler          pic X(9)  value 'Length = '.
           05  DS-LENGTH       pic 9999  value 0.

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

       01  MESSAGE-0008-1.
           05  filler pic X(29) value 'SIMODUMP-SYSOUT is invalid,  '.
           05  filler pic X(29) value 'must be SHOW, FILE or BOTH.  '.
       01  MESSAGE-0008-2.
           05  filler pic X(22) value 'Assuming SHOW mode.   '.

      *****************************************************************
      *    Pass area for call SIMOLOGS.
      *    ------------------------------------------------------------
       COPY PASSLOGS.

       COPY HEXTABLE.

      *****************************************************************
       LINKAGE SECTION.
       COPY PASSDUMP.

      *****************************************************************
       PROCEDURE DIVISION using SIMODUMP-PASS-AREA.
           perform FIRST-TIME-PROPCESSING

           evaluate SIMODUMP-REQUEST
               when 'DUMP' perform ACTION-IS-DUMP-PROCESSING
               when 'NOTE' perform ACTION-IS-POST-A-NOTE
               when other  move 'DUMP' to SIMODUMP-REQUEST
                           perform ACTION-IS-DUMP-PROCESSING
           end-evaluate

           GOBACK.

      *****************************************************************
       ACTION-IS-POST-A-NOTE.
           move SIMODUMP-DUMP-ID      to MESSAGE-HEAD02
           move SIMODUMP-BUFFER(1:68) to MESSAGE-TEXT
           perform Z-POST-MSG-79
           exit.

      *****************************************************************
       ACTION-IS-DUMP-PROCESSING.
           perform EDIT-PASS-AREA

           if  SIMODUMP-SYSOUT = 'OPER'
           or  SIMODUMP-SYSOUT = 'USER'
               move SIMODUMP-DUMP-ID to DS-DUMP-ID
               move SIMODUMP-LENGTH  to DS-LENGTH
               move 'Starting'       to DS-DUMP-STATUS
               move DUMP-STATUS-LINE to MSG-79
               perform Z-POST-MSG-79
               move DUMP-HEADER to MSG-79
               perform Z-POST-MSG-79
           end-if

           perform DUMP-PROCESSING

           if  SIMODUMP-SYSOUT = 'OPER'
           or  SIMODUMP-SYSOUT = 'USER'

               perform varying IX-1 from 1 by 1
               until IX-1 > 8
               or    IX-1 > SIMODUMP-IDX
                 move SIMODUMP-LINES(IX-1) to MSG-79
                 perform Z-POST-MSG-79
               end-perform

               move 'Complete'       to DS-DUMP-STATUS
               move DUMP-STATUS-LINE to MSG-79
               perform Z-POST-MSG-79
           end-if


           move SIMOLOGS-REQUEST to SIMODUMP-SYSOUT
           move SIMOLOGS-STATUS  to SIMODUMP-RESULT

           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 SIMODUMP-IDX from SIMODUMP-IDX
           add SIMODUMP-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 ADDRESS-OFFSET-DEC(IX-0:7) to D1
               add 7 to IX-0
               perform DUMP-SINGLE-LINE
               if  BUFFER-LENGTH greater than 15
                   subtract 16 from BUFFER-LENGTH
               else
                   subtract BUFFER-LENGTH from BUFFER-LENGTH
               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 SIMODUMP-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
           add 1 to SIMODUMP-IDX
           move DUMP-LINE to SIMODUMP-LINES(SIMODUMP-IDX)
           exit.

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

       EDIT-PASS-AREA-LENGTH.
           subtract SIMODUMP-RESULT from SIMODUMP-RESULT

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

           if  SIMODUMP-LENGTH less than 1
           or  SIMODUMP-LENGTH greater than 128
               add 4 to ZERO giving SIMODUMP-RESULT
               add 128 to ZERO giving SIMODUMP-LENGTH
           end-if

           if  SIMODUMP-RESULT not = ZERO
               move MESSAGE-0004-1 to MESSAGE-TEXT
               perform Z-POST-MSG-79
               move MESSAGE-0004-2 to MESSAGE-TEXT
               perform Z-POST-MSG-79
           end-if

           exit.

       EDIT-PASS-AREA-SYSOUT.
           if  SIMODUMP-SYSOUT = 'NONE'
           or                  = 'USER'
           or                  = 'OPER'
           or                  = 'SHOW'
           or                  = 'FILE'
           or                  = 'BOTH'
               subtract SIMODUMP-RESULT from SIMODUMP-RESULT
           else
               add 4 to ZERO   giving SIMODUMP-RESULT
               move 'OPER'     to     SIMODUMP-SYSOUT
               move MESSAGE-0008-1 to MESSAGE-TEXT
               perform Z-POST-MSG-79
               move MESSAGE-0008-2 to MESSAGE-TEXT
               perform Z-POST-MSG-79
           end-if
           exit.

      *****************************************************************
       FIRST-TIME-PROPCESSING.
           add 8 to ZERO giving SIMODUMP-RESULT
           move 'SIMODUMP'   to MESSAGE-HEAD02

           if  SIMODUMP-COPYRIGHT not = 'HIDE'
               perform POST-COPYRIGHT
           end-if

           add 1 to ZERO giving SIMODUMP-IDX
           perform 8 times
               move SPACES to SIMODUMP-LINES(SIMODUMP-IDX)
               add 1 to SIMODUMP-IDX
           end-perform
           subtract SIMODUMP-IDX from SIMODUMP-IDX
           exit.

      *****************************************************************
       POST-COPYRIGHT.
           move SIM-TITLE to     MSG-79
           perform        Z-POST-MSG-79
           move SIM-COPYRIGHT to MSG-79
           perform        Z-POST-MSG-79
           exit.

      *****************************************************************
       POST-TO-LOG-FILE.
           add  16 to ZERO giving SIMOLOGS-STATUS
      *    move DUMP-BUFFER to SIMOLOGS-MESSAGE
           call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
           if  SIMOLOGS-STATUS not = ZERO
               move 'SHOW' to SIMODUMP-SYSOUT
               add SIMOLOGS-STATUS to ZERO giving SIMODUMP-RESULT
           end-if
           exit.

      *****************************************************************
       Z-POST-MSG-79.
           if  SIMODUMP-SYSOUT = 'USER'
               display MSG-79
           else
               display MSG-79 upon console
           end-if
           move SPACES to MSG-79
           exit.
      *****************************************************************
      *      This example is provided by SimoTime Enterprises         *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Summary
(Next) (Previous) (Table-of-Contents)

The purpose of this document is to provide a COBOL Source member for viewing.

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to Simotime Enterprises. 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 Enterprises.

Permission to use, copy, modify and distribute this software for a 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 Enterprises.

SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises 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.

Downloads and Links to Similar Pages
(Next) (Previous) (Table-of-Contents)

You may view an example of a COBOL program that uses SimoDUMP at http://www.simotime.com/cblhbx01.htm.

You may view the complete list of SimoTime callable Modules or Driver Programs at http://www.simotime.com/simomods.htm.

The SimoZAPS Utility Program has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPScan also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.

This item will provide a link to  an ASCII or EBCDIC translation table. A column for decimal, hexadecimal and binary is also included.

This document provides a quick summary of the  File Status Key  for VSAM data sets and QSAM files.

Check out  The SimoTime Library  for a wide range of topics for Programmers, Project Managers and Software Developers.

To review all the information available on this site start at  The SimoTime Home Page .

Glossary of Terms
(Next) (Previous) (Table-of-Contents)

Check out  The SimoTime Glossary  for a list of terms and definitions used in the documents provided by SimoTime.

Comments or Suggestions
(Next) (Previous) (Table-of-Contents)

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

We appreciate your comments and feedback.

About SimoTime Enterprises
(Next) (Previous) (Table-of-Contents)

Founded in 1987, SimoTime Enterprises 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. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. 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. 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
Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
When technology complements business
http://www.simotime.com