Hex-Dump of a Data Buffer
SimoDUMP - The COBOL Source Code
  Table of Contents  v-16.01.01 - simodump.htm 
  Introduction
  SimoDUMP, What It Does
  SimoDUMP, How To Use
  The COBOL Members
  The Program Source Code
  Pass Area Structure, a Copy File
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This document provides a listing of the COBOL source code for the callable routine SimoDUMP. Additional information about this program may be obtained by sending an e-mail to: helpdesk@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-2024
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section SimoDUMP, What It Does

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

Table of Contents Previous Section Next Section SimoDUMP, How To Use

The coding to do the actual call to display and/or log the hexadecimal 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.

Table of Contents Previous Section Next Section The COBOL Members

The set of program members includes a program that creates the hexadecimal dump information and a copy file that defines the structure for a pass area.

Table of Contents Previous Section Next Section The Program Source Code

The following (SIMODUMP.cbl) is the COBOL Source Code for the SimoDUMP callable routine.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SIMODUMP.
      *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: 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 ' v16.06.15'.
           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-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(011)  value '* SIMODUMP '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(068)  value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.
       01  MSG-LSB                 pic 9(3)    value 256.

      *****************************************************************
      *    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(5)      value 128.
       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 'Position'.
           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 'SIMODUMP-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 '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(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 'SIMODUMP-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'.

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

       COPY HEXTABLE.

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

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

           evaluate SIMODUMP-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 SIMODUMP-REQUEST
                           perform ACTION-IS-POST-DUMP-INFO
           end-evaluate
           GOBACK.

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

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

           set USR-PTR-VALUE to address of SIMODUMP-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 '* SIMODUMP ADDR is ' ADDRESS-DUMP-FMT-64

           if  SIMODUMP-OUTPUT = 'LOG1'
           or                  = 'OUT1'
           or                  = 'OUT2'
           or                  = 'OPR1'
           or                  = 'OPR2'
               move 'Starting'       to DS-DUMP-STATUS
               move SIMODUMP-DUMP-ID to DS-DUMP-ID
               move SIMODUMP-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

      *    move SIMOLOGS-REQUEST to SIMODUMP-OUTPUT
           move SIMOLOGS-STATUS  to SIMODUMP-RESULT

           exit.

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

           if  SIMODUMP-BUFFER(1:7) = 'FORMAT='
               evaluate SIMODUMP-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 SIMODUMP-BUFFER(1:6) = 'LIMIT='
              perform until SIMODUMP-BUFFER(11:1) not = SPACE
                if SIMODUMP-BUFFER(11:1) = ' '
                   move SIMODUMP-BUFFER(10:1) to SIMODUMP-BUFFER(11:1)
                   move SIMODUMP-BUFFER(09:1) to SIMODUMP-BUFFER(10:1)
                   move SIMODUMP-BUFFER(08:1) to SIMODUMP-BUFFER(09:1)
                   move SIMODUMP-BUFFER(07:1) to SIMODUMP-BUFFER(08:1)
                   move ZERO to SIMODUMP-BUFFER(7:1)
                end-if
               end-perform
               move SIMODUMP-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  SIMODUMP-LENGTH - IX-1 > 16
                 add 16 to ZERO giving LINE-LENGTH
             else
                 compute LINE-LENGTH = SIMODUMP-LENGTH - IX-1 + 1
                 move 'Y' to LOOP-QUIT
             end-if
      *      display 'DEBUG ' SIMODUMP-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 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 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 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 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 SIMODUMP-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 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
           if  SIMODUMP-IDX < 8
               add 1 to SIMODUMP-IDX
               move DUMP-LINE to SIMODUMP-LINES(SIMODUMP-IDX)
           end-if

           if  SIMODUMP-OUTPUT = 'LOG1'
           or                  = 'OUT2'
           or                  = 'OPR2'
               move DUMP-LINE to SIMOLOGS-MESSAGE
               perform POST-TO-LOG-FILE
           else
               move DUMP-LINE to MESSAGE-TEXT
               perform Z-POST-MESSAGE-TEXT
           end-if
           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 BUFFER-SIZE-LIMIT
               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-MESSAGE-BUFFER
               move MESSAGE-0004-2 to MESSAGE-TEXT
               perform Z-POST-MESSAGE-BUFFER
           end-if

           exit.

       EDIT-PASS-AREA-SYSOUT.
           if  SIMODUMP-OUTPUT = 'NONE'
           or                  = 'OUT1'
           or                  = 'OUT2'
           or                  = 'OPR1'
           or                  = 'OPR2'
           or                  = 'LOG1'
               subtract SIMODUMP-RESULT from SIMODUMP-RESULT
           else
               add 4 to ZERO   giving SIMODUMP-RESULT
               move 'OPR1'     to     SIMODUMP-OUTPUT
               move MESSAGE-0008-1 to MESSAGE-TEXT
               perform Z-POST-MESSAGE-BUFFER
               move MESSAGE-0008-2 to MESSAGE-TEXT
               perform Z-POST-MESSAGE-BUFFER
           end-if
           exit.

      *****************************************************************
       FIRST-TIME-PROCESSING.
           add 8 to ZERO giving SIMODUMP-RESULT

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

      *****************************************************************
       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 'OPR1' to SIMODUMP-OUTPUT
               add SIMOLOGS-STATUS to ZERO giving SIMODUMP-RESULT
           end-if
           exit.

      *****************************************************************
       Z-DISPLAY-MESSAGE-BUFFER.
           perform Z-CALCULATE-MSG-LENGTH
           if  SIMODUMP-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 SIMODUMP-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 SIMODUMP-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-TEXT-2 = SPACES
               subtract 188 from MSG-LSB
           else
               perform until MSG-LSB < 12
                          or MESSAGE-BUFFER(MSG-LSB:1) not = SPACE
                 if  MESSAGE-BUFFER(MSG-LSB:1) = SPACE
                     subtract 1 from MSG-LSB
                 end-if
               end-perform
           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 Pass Area Structure, a Copy File

The following (PASSDUMP.cpy) is the COBOL copy file that may be used when calling SimoDUMP.

      *****************************************************************
      *                PASSDUMP is a COBOL Copy File                  *
      *     Data Structure or Pass Area used for calling SIMODUMP.    *
      *         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 SIMODUMP-REQUEST                                   *
      * DUMP   Dump the Buffer in Hexadecimal format                  *
      * NOTE   Display or Write the text to the screen or log file    *
      *                                                               *
      * Values for SIMODUMP-SYSOUT                                    *
      * OPR1   Display dump information on operator console           *
      * OPR2   Display to operator console and write to log file      *
      * OUT1   Display dump information to SYSOUT device              *
      * OUT2   Display to SYSOUT device and write to log file         *
      * LOG1   Write dump information to the log file (SYSLOG)        *
      * NONE   Do not output to screen or file, put dump info in      *
      *        pass area table and return to caller.                  *
      *                                                               *
      * Values for SIMODUMP-COPYRIGHT                                 *
      * HIDE   Do not display the copyright information. Any other    *
      *        entry will display the copyright information.          *
      *****************************************************************
       01  SIMODUMP-PASS-AREA.
      *    Initial information is provided by the calling program,
      *    The SIMODUMP-REQUEST field will be modified to "DUMP" if it
      *    does not contain a valid entry.
      *    The SIMODUMP-RESULT field may also be modified by the
      *    SimoDUMP routine.
           05  SIMODUMP-REQUEST        PIC X(4).
           05  SIMODUMP-RESULT         PIC 9999.
      *    The following are not modified by the SimoDUMP routine...
           05  SIMODUMP-DUMP-ID        PIC X(8).
           05  SIMODUMP-OUTPUT         PIC X(4).
           05  SIMODUMP-COPYRIGHT      PIC X(4).
      *    The following are modified by the SimoDUMP routine...
           05  SIMODUMP-IDX            PIC 99.
           05  SIMODUMP-LINES          PIC X(80)   OCCURS 8 TIMES.
      *    The following are not modified by the SimoDUMP routine...
           05  SIMODUMP-LENGTH         PIC 9(4).
       01  SIMODUMP-BUFFER             PIC X(128).
      *
      ***  PASSDUMP - End-of-Copy File - - - - - - - - - - - PASSDUMP *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Summary

This document provides a listing of the COBOL source code for the callable routine SimoDUMP. 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, Comment 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.

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

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

Link to Internet   Link to Server   Explore a complete list of the SimoTime Callable Routines or Utility Programs. This includes the callable routines and utility programs for the Micro Focus environment.

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

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

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

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

Explore The Micro Focus Web Site for more information about products (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 Comments 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
Hexadecimal Dump of a Data Buffer
Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com