COBOL Hex Dump
 Callable Hex-Dump Routine
http://www.simotime.com
When technology complements business    Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 10.03.20 
  Introduction
 
  Introduction, Sample Output
  Introduction, Flowchart
  Call Interface
  CMD for Hex Dump Execution with Net Express
  JCL Member, Sample Jobs for OS/390 or Mainframe Express
 
  JCL Member for Display upon Console
  JCL Member for Write-to-Log File
  The COBOL Demonstration Program
  The COBOL Hex-Dump Routine
  The COBOL Write-to-Log File Routine
  Copy File for Pass Area Parameters
  Copy File for Hex-Table
  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)

The DISPLAY function of COBOL will display a message upon a user's console or the system operator's console in an MVS environment. It is quite often used to display information in routines that are performing an abnormal termination of a program. Also, it is still being used as a debugging tool. This approach provides valuable information when a failure occurs. However, there are times when a field or data string may have information that contains non-printable/displayable characters. A callable routine that would display a field or data string in a hexadecimal, EBCDIC and ASCII format could be an effective tool in providing this information.

This suite of programs provides a demonstration program and a callable program to display a data string in a hexadecimal format for both EBCDIC and ASCII. Both COBOL programs were written and tested using the COBOL/2 dialect. Also, both COBOL programs will work with COBOL for MVS and COBOL/370. A JCL member is provided to run the job as an MVS batch job on an IBM mainframe or as a project with Micro Focus Mainframe Express (MFE) running on a PC with Windows (refer to http://www.microfocus.com).

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

Note: The source code for this example is available from the SimoTime Library under Download Directory at  www.simotime.com

Introduction, Sample Output
(Next) (Previous) (Table-of-Contents)

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.

* SIMODUMP COBOL Hexadecimal Dump Routine     v03.01.24 http://www.simotime.com
* SIMODUMP Copyright 1987-2010   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
* SIMODUMP COBOL Hexadecimal Dump Routine     v03.01.24 http://www.simotime.com
* SIMODUMP Copyright 1987-2010   SimoTime Enterprises, LLC  All Rights Reserved
* SIMOLOGS FAILED-OPEN, Log file, SYSLOG
* SIMOLOGS FILE-STATUS-41
* SIMOLOGS Writing to log file is ABENDING...
* LOGTEST1 Starting... Length = 0128
*  Offset Hex..... ........ ........ ........ ebcdic.......... ascii...........
*   1-016 00010203 04050607 08090A0B 0C0D0E0F ................ ................
*  17-032 10111213 14151617 18191A1B 1C1D1E1F ................ ................
*  33-048 20212223 24252627 28292A2B 2C2D2E2F ................  !"#$%&'()*+,-./
*  49-064 30313233 34353637 38393A3B 3C3D3E3F ................ 0123456789:;<=>?
*  65-080 40414243 44454647 48494A4B 4C4D4E4F  ...........<(+| @ABCDEFGHIJKLMNO
*  81-096 50515253 54555657 58595A5B 5C5D5E5F &.........!$*);. PQRSTUVWXYZ[\]^_
*  97-112 60616263 64656667 68696A6B 6C6D6E6F -/........|.%_>? `abcdefghijklmno
* 113-128 70717273 74757677 78797A7B 7C7D7E7F .........`:#@'=" pqrstuvwxyz{.}~.
* LOGTEST1 Complete... Length = 0128
* SIMODUMP COBOL Hexadecimal Dump Routine     v03.01.24 http://www.simotime.com
* SIMODUMP Copyright 1987-2010   SimoTime Enterprises, LLC  All Rights Reserved
* LOGTEST2 Starting... Length = 0128
*  Offset Hex..... ........ ........ ........ ebcdic.......... ascii...........
*   1-016 80818283 84858687 88898A8B 8C8D8E8F .abcdefghi.{...+ ................
*  17-032 90919293 94959697 98999A9B 9C9D9E9F .jklmnopqr.}.... ................
*  33-048 A0A1A2A3 A4A5A6A7 A8A9AAAB ACADAEAF ..stuvwxyz...... ................
*  49-064 B0B1B2B3 B4B5B6B7 B8B9BABB BCBDBEBF ..........[].... ................
*  65-080 C0C1C2C3 C4C5C6C7 C8C9CACB CCCDCECF {ABCDEFGHI...... ................
*  81-096 D0D1D2D3 D4D5D6D7 D8D9DADB DCDDDEDF }JKLMNOPQR...... ................
*  97-112 E0E1E2E3 E4E5E6E7 E8E9EAEB ECEDEEEF ..STUVWXYZ...... ................
* 113-128 F0F1F2F3 F4F5F6F7 F8F9FAFB FCFDFEFF 0123456789...... ................
* LOGTEST2 Complete... Length = 0128
* SIMODUMP COBOL Hexadecimal Dump Routine     v03.01.24 http://www.simotime.com
* SIMODUMP Copyright 1987-2010   SimoTime Enterprises, LLC  All Rights Reserved
* NUMERIC1 Starting... Length = 0128
* SIMOLOGS FAILED-OPEN, Log file, SYSLOG
* SIMOLOGS FILE-STATUS-41
* SIMOLOGS Writing to log file is ABENDING...
*  Offset Hex..... ........ ........ ........ ebcdic.......... ascii...........
*   1-016 D7C9C360 F9404040 F0F0F0F0 F0F1F2F3 PIC-9   00000123 ...`.@@@........
*  17-032 D7C9C360 F9D74040 F0F0F0F0 F0F1F2C3 PIC-9P  0000012C ...`..@@........
*  33-048 D7C9C360 F9D44040 F0F0F0F0 F0F1F2D3 PIC-9M  0000012L ...`..@@........
*  49-064 D7C9C360 F9E94040 F0F0F0F0 F0F0F0C0 PIC-9Z  0000000{ ...`..@@........
*  65-080 C3D6D4D7 60F34040 00000000 0000123F COMP-3  ........ ....`.@@.......?
*  81-096 C3D6D4D7 60F3D740 00000000 0000123C COMP-3P ........ ....`..@.......<
*  97-112 C3D6D4D7 60F3D440 00000000 0000123D COMP-3M ........ ....`..@.......=
* 113-128 C3D6D4D7 60F3E940 00000000 0000000C COMP-3Z ........ ....`..@........
* NUMERIC1 Complete... Length = 0128
* SIMODUMP COBOL Hexadecimal Dump Routine     v03.01.24 http://www.simotime.com
* SIMODUMP Copyright 1987-2010   SimoTime Enterprises, LLC  All Rights Reserved
* NUMERIC2 Starting... Length = 0128
*  Offset Hex..... ........ ........ ........ ebcdic.......... ascii...........
*   1-016 C3D6D4D7 40404040 0000007B 40404040 COMP    ...#     ....@@@@...{@@@@
*  17-032 C3D6D4D7 61D74040 0000007B 40404040 COMP/P  ...#     ....a.@@...{@@@@
*  33-048 C3D6D4D7 61D44040 FFFFFF85 40404040 COMP/M  ...e     ....a.@@....@@@@
*  49-064 C3D6D4D7 61E94040 00000000 40404040 COMP/Z  ....     ....a.@@....@@@@
*  65-080 40404040 40404040 40404040 40404040                  @@@@@@@@@@@@@@@@
*  81-096 40404040 40404040 40404040 40404040                  @@@@@@@@@@@@@@@@
*  97-112 40404040 40404040 40404040 40404040                  @@@@@@@@@@@@@@@@
* 113-128 40404040 40404040 40404040 40404040                  @@@@@@@@@@@@@@@@
* NUMERIC2 Complete... Length = 0128
* CBLHBXC1 Thank you for using this sample by SimoTime Enterprises, LLC
* CBLHBXC1 Please send comments or suggestions to helpdesk@simotime.com

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

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

CBLHBXJ1
jcl
     
CBLHBXE1
cmd
  The JCL or CMD member with the optional statement to write to a log file.
 
     
 
   
IEFBR14
utl
     
SIMOEXEC
cbl
   
     
     
     
     
     
     
   
   
CBLHBXC1
cobol
      The CBLHBXC1 member is a COBOL Demonstration program that calls the actual Hexadecimal Dump routine.
   
 
       
   
SIMODUMP
cobol
Console
  The SIMODUMP member is a COBOL Hexadecimal Dump routine that displays the dump information on the screen.The dump information is only displayed if the SIMODUMP-REQUEST field contains SHOW or BOTH.
   
 
       
   
SIMOLOGS
cobol
SYSLOG
  The SIMOLOGS member is a COBOL Write-to-Log routine that writes the dump information to a log file. This routine is only called if the SIMODUMP-SYSOUT field contains FILE or BOTH.
             
Call Interface
(Next) (Previous) (Table-of-Contents)

Making the call to the hex dump routine is a standard, simple COBOL call. The pass area must be defined in the Working Storage section as follows. A copy file (PASSDUMP.CPY) is provided for the following data area.

      *****************************************************************
      *           Data Structure used for calling SIMODUMP.           *
      *****************************************************************
      *         Copyright (C) 1987-2010 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Enterprises                 *
      *        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 Heaxedecimal format                 *
      * NOTE   Display or Write the text to the screen or log file    *
      *                                                               *
      * Values for SIMODUMP-SYSOUT                                    *
      * SHOW   Display dump information on screen                     *
      * FILE   Write dump information to the log file (SYSLOG)        *
      * BOTH   Display to screen and write to log file                *
      * NONE   Do not output to screen or file, put dump info in      *
      *        pass area table and return to caller.                  *
      *****************************************************************
       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-SYSOUT         PIC X(4).
           05  SIMODUMP-COPYRIGHT      PIC X(4).
           05  SIMODUMP-LENGTH         PIC 9999.
           05  SIMODUMP-BUFFER         PIC X(128).
      *    The following are modified by the SimoDUMP routine...
           05  SIMODUMP-IDX            PIC 99.
           05  SIMODUMP-LINES          PIC X(80)   OCCURS 8 TIMES.
      *!   PASSDUMP - End-of-Copy File...

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

If the call to the hex dump routine wants to do logging to a file then the appropriate DD statement must be inserted into the JCL. The following is a brief description of each of the fields used within the pass area (SIMODUMP-PASS-AREA).

Field Description
SIMODUMP-REQUEST
DUMP This parameter value will cause the text string in the SIMODUMP-BUFFER to be displayed (and logged if specified) in hexadecimal format. This is the default value..
NOTE This parameter value will simply display and log if specified the first 68 bytes in the SIMODUMP-BUFFER.. This parameter is case sensitive and must be upper-case.
SIMODUMP-RESULT This is an indicator as to the success or failure of the request. A value of zero (0000) indicates the routine was successful in displaying the dump information. A non-zero value indicates a failure.
SIMODUMP-DUMP-ID This is an eight character field that is used to identify the dump. When multiple calls are made to the dump routine it is less confusing if each dump request has a unique identifier.
SIMODUMP-SYSOUT Type of request, must be one of the following and must be upper-case.
SHOW This request will display the dump information on the console.
FILE This request will write the information to the SYSLOG file. This option requires a DD statement in the JCL. This option will not display information on the console.
BOTH This request will display the dump information on the console and write the dump information to the CBLHDXD1 file. This option requires a DD statement in the JCL.
If a parameter other then the preceding are passed the 'SHOW' is assumed.
SIMODUMP-COPYRIGHT 
SHOW This parameter value will cause the SimoTime copyright information to be displayed when the SimoDUMP routine is called. This is the default value..
HIDE This parameter value will cause the SimoTime Copyright information not to be displayed when the SimoDUMP routine is called. Any other value will cause the copyright information to be displayed. This parameter is case sensitive and must be upper-case.
SIMODUMP-LENGTH The length or number of characters to be displayed. This must be a value from 1-128. If a value other than 1-128 is passed then 128 will be assumed.
SIMODUMP-BUFFER A 128 byte buffer containing the information to be displayed.
SIMODUMP-IDX Index for table that contains the dump information
SIMODUMP-LINES This is a table with eight entries of eigty bytes each. Each entry contains a line of dump information.

CMD for Hex Dump Execution with Net Express
(Next) (Previous) (Table-of-Contents)

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

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2010 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text    - COBOL and Commonly User Numeric Formats
rem  * Author  - SimoTime Enterprises
rem  * Date    - November 11, 2003
rem  * Version - 05.07.06
rem  *
rem  * This set of programs illustrates the use of of COBOL to do actual
rem  * hex-dump display and logging of fields that may have non-display
rem  * characters.
rem  *
rem  * The COBOL programs are compiled with the ASSIGN(EXTERNAL)
rem  * directive. This provides for external file mapping of file names.
rem  *
rem  * When running with Net Express the IBMCOMP an NOTRUNC directives
rem  * will be required to maintain compatability with the mainframe
rem  * format and field sizes for binary fields.
rem  *
rem  * This technique provides for the use of a single COBOL source
rem  * program that will run on OS/390, Windows or Unix.
rem  *
rem  * This set of programs will run on a Personal Computer with Windows
rem  * and Micro Focus Net Express.
rem  *
rem  *   ************
rem  *   * CblHbxE1 *
rem  *   ********cmd*
rem  *        *
rem  *        *
rem  *   ************
rem  *   * SIMOEXEC *-------------*
rem  *   ********exe*             *
rem  *        *  *                *
rem  *        *  *                *  ************     ************
rem  *        *  *                *--* SIMOLOGS ******* CONSOLE  *
rem  *        *  *                *  ********dll*  *  ************
rem  *        *  *                *                *
rem  *        *  *                *                *  ************
rem  *        *  *                *                *--*  SYSLOG  *
rem  *        *  *                *                   *******data*
rem  *        *  *  ************  *
rem  *        *  *--* CblHbxC1 *  *
rem  *        *     ********dll*  *
rem  *        *          *        *
rem  *        *     ************  *
rem  *        *     * SIMODUMP *--*
rem  *        *     ********dll*
rem  *        *
rem  *   ************
rem  *   *   EoJ    *
rem  *   ************
rem  *
rem  * *******************************************************************
rem  * Step 1 of 3, Set the global environment variables...
rem  *
     set JobStatus=0000
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     SimoEXEC NOTE *******************************************************CblHbxE1
     SimoEXEC NOTE Starting JobName CblHbxE1
rem  * *******************************************************************
rem  * Step 2 of 3, Execute the Number Format Analysis Program...
rem  *
     SimoEXEC EXEC CblHbxC1
     if errorlevel = 1 set JobStatus=0001
     if not "%JobStatus%" == "0000" goto :EojNok
rem  * *******************************************************************
rem  * Step 3 of 3, End-of-Job...
rem  *
:EojAok
     SimoEXEC NOTE Finished JobName CblHbxE1, Job Status is %JobStatus%
     goto :End
:EojNok
     SimoEXEC NOTE ABENDING JobName CblHbxE1, Job Status is %JobStatus%
:End
     SimoEXEC NOTE Conclude SysLog is %SYSLOG%
     if not "%1" == "nopause" pause

JCL Member, Sample Jobs
(Next) (Previous) (Table-of-Contents)

This section provides the sample JCL required to run the dump programs on a mainframe with MVS or on a PC with Micro Focus Mainframe Express. The JOB, STEPLIB and DD statements will need to be changed for a specific mainframe environment.

The first example shows the JCL when the logging to a file is not used. The dump information will be diplayed to the screen. If the calling program should request a log-to-file (i.e. SIMODUMP-REQUEST = 'FILE' on OPEN failure would occur since there is no DD statement for the logging file (SYSLOG). The dump routine would then assume 'SHOW' and display the dump information to the screen

The second example shows the use of the logging function that writes the dump information to a file (SYSLOG).

JCL Member for Display upon Console
(Next) (Previous) (Table-of-Contents)

The following is the mainframe JCL (CBLHBXJ1.JCL) required to run the mainline program. The JOB and STEPLIB statements will need to be changed for a specific mainframe environment. Since this JCL member does not have a DD statement for the SYSLOG file the SimoLOGS routine will fail on the OPEN and post a message to the console and simply display the dump information to the console. The file I/O error for the SYSLOG file and the dump information will be written to the spool file.

//CBLHBXJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1,
//             COND=(0,LT)
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2010 All Rights Reserved             *
//*                                                                   *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - COBOL calls COBOL for Hexadecimal Dump of a data buffer.
//* Author - SimoTime Enterprises
//* Date   - January 01, 1989
//*
//* This set of programs illustrate the use of COBOL for displaying
//* a data buffer in hexadecimal format.
//*
//* Since this JCL member does not have a DD statement for the SYSLOG
//* file the SimoLOGS routine will fail on the OPEN and post a message
//* to the console and simply display the dump information to the
//* console. The file I/O error for the SYSLOG file and the dump
//* information will be written to the spool file.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//*    ************
//*    * CBLHBXJ1 *
//*    ********jcl*
//*         *
//*         *
//*    ************     ************      ************
//*    * CBLHBXC1 ******* SIMODUMP ******** CONSOLE  *
//*    ********cbl*     ********cbl*      ******dsply*
//*                          *
//*                          *
//*                     ************     ************
//*                     * SIMOLOGS *******  SYSLOG  *
//*                     ********cbl*     *******file*
//*
//* *******************************************************************
//CBLHBXX1 EXEC PGM=CBLHBXC1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//*

JCL Member for Write-to-Log File
(Next) (Previous) (Table-of-Contents)

The following is the mainframe JCL (CBLHBXJ2.JCL) required to run the mainline program. The JOB, STEPLIB and DD statements will need to be changed for a specific mainframe environment.

//CBLHBXJ2 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1,
//             COND=(0,LT)
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2010 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - COBOL calls COBOL for Hexadecimal Dump of a data buffer.
//* Author - SimoTime Enterprises
//* Date   - January 01, 1989
//*
//* This set of programs illustrate the use of COBOL for displaying
//* a data buffer in hexadecimal format. This job may also write
//* to a log file (SYSLOG).
//*
//*      ************
//*      * CBLHBXJ1 *
//*      ********jcl*
//*           *
//*           *
//*      ************
//*      * IEFBR14  *
//*      ************
//*           *
//*           *
//*      ************     ************     ************
//*      * CBLHBXC1 *-----* SIMODUMP *-----* Console  *
//*      ********cbl*     ************     ************
//*                            *
//*                            *
//*                       ************     ************
//*                       * SIMOLOGS *-----*  SYSLOG  *
//*                       ************     ************
//*
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step 1 of 2, Delete previous log file and create new log file...
//*
//HBXDEL01 EXEC PGM=IEFBR14
//SYSLOG   DD  DSN=SIMOTIME.DATA.SYSLOG,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,10),
//             DCB=(RECFM=V,LRECL=1055,DSORG=PS)
//HBXCRT01 EXEC PGM=IEFBR14
//SYSLOG   DD  DSN=SIMOTIME.DATA.SYSLOG,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,10),
//             DCB=(RECFM=V,LRECL=1055,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Write dump info to new QSAM log file...
//*
//CBLHBX22 EXEC PGM=CBLHBXC1
//STEPLIB  DD  DSN=MFI01.SIMOPROD.LOADLIB1,DISP=SHR
//SYSLOG   DD  DSN=SIMOTIME.DATA.SYSLOG,DISP=SHR
//*

The COBOL Demonstration Program
(Next) (Previous) (Table-of-Contents)

This program (CBLHBXC1.CBL) was written to test and demonstrate the calling of theCOBOL program (SIMODUMP.CBL) that does the display of a data buffer in the hexadecimal format.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CBLHBXC1.
       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 does not imply publication or    *
      * disclosure.  This software contains confidential information  *
      * and trade secrets of SimoTime Enterprises, LLC. No part of    *
      * this program or publication may be reproduced, transmitted,   *
      * transcribed, stored in a retrieval system, or translated into *
      * any language or computer language, in any form or by any      *
      * means, electronic, mechanical, magnetic, optical, chemical,   *
      * manual or otherwise, without the prior written permission of: *
      *                                                               *
      * 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: CBLHBXC1.CBL
      * Copy Files     PASSDUMP.CPY
      * Calls to:      SIMODUMP may call SIMOLOGS
      *****************************************************************
      *
      * CBLHBXC1 - Call SIMODUMP to build hexadecimal dump information.
      *
      * CALLING PROTOCOL
      * ----------------
      * Use standard procedure to EXECUTE, RUN or ANIMATE.
      *
      * DESCRIPTION
      * -----------
      * This is a demonstration program to show how to call the
      * COBOL Hexadecimal Dump Routine.
      *
      *          ************
      *          * CBLHBXJ1 *
      *          ********jcl*
      *               *
      *          ************
      *          * CBLHBXC1 *
      *          ********cbl*
      *               *
      *          ************     ************      ************
      *          * CBLHBXC1 *-----* SIMODUMP *-----* CONSOLE  *
      *          ********cbl*     ********cbl*      ******dsply*
      *                                *
      *                                *
      *                           ************     ************
      *                           * SIMOLOGS *-----*  SYSLOG  *
      *                           ********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 '* CBLHBXC1 '.
           05  T2 pic X(34) value 'COBOL Hexadecimal Dump Routine    '.
           05  T3 pic X(10) value ' v1.1.00  '.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CBLHBXC1 '.
           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'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* CBLHBXC1 '.
           05  C2 pic X(32) value 'Thank you for using this sample '.
           05  C3 pic X(32) value 'by SimoTime Enterprises, LLC    '.
           05  C4 pic X(04) value '    '.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* CBLHBXC1 '.
           05  C2 pic X(32) value 'Please send comments or suggesti'.
           05  C3 pic X(32) value 'ons to helpdesk@simotime.com    '.
           05  C4 pic X(04) value '    '.

      *****************************************************************
      *    Buffer used for posting messages to the console.
      *    ------------------------------------------------------------
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CBLHBXC1 '.
           05  MESSAGE-TEXT        pic X(68).

       01  TWO-BYTES.
           05  TWO-BYTES-01        pic X.
           05  TWO-BYTES-02        pic X.
       01  TWO-BYTES-BINARY        redefines   TWO-BYTES
                                   pic S9(3)   comp.

      *****************************************************************
      *    Work fields used for testing call to SIMODUMP.
      *    ------------------------------------------------------------
       01  ASC            pic X(10) value X'30313233343536373839'.
       01  PACK-BINARY    pic X(12) value X'0000615C4040404000000A01'.

       01  ALPHABET-UPPER pic X(26) value 'ABCDEFGHIJKLMNOPQRSTUVWZYZ'.

       01  NUMERIC-BUFFER-01.
           05  filler          pic X(8)            value 'PIC-9   '.
           05  NB-PIC-9        pic 9(8)            value 123.
           05  filler          pic X(8)            value 'PIC-9P  '.
           05  NB-PIC-9-PLUS   pic S9(8)           value 123.
           05  filler          pic X(8)            value 'PIC-9M  '.
           05  NB-PIC-9-MINUS  pic S9(8)           value -123.
           05  filler          pic X(8)            value 'PIC-9Z  '.
           05  NB-PIC-9-ZERO   pic S9(8)           value 0.
           05  filler          pic X(8)            value 'COMP-3  '.
           05  NB-COMP-3       pic 9(15)   comp-3  value 123.
           05  filler          pic X(8)            value 'COMP-3P '.
           05  NB-COMP-3-PLUS  pic S9(15)  comp-3  value 123.
           05  filler          pic X(8)            value 'COMP-3M '.
           05  NB-COMP-3-MINUS pic S9(15)  comp-3  value -123.
           05  filler          pic X(8)            value 'COMP-3Z '.
           05  NB-COMP-3-ZERO  pic S9(15)  comp-3  value 0.

       01  NUMERIC-BUFFER-02.
           05  filler          pic X(8)            value 'COMP    '.
           05  NB-COMP         pic 9(9)    comp    value 123.
           05  filler          pic X(4)            value is SPACES.
           05  filler          pic X(8)            value 'COMP/P  '.
           05  NB-COMP-PLUS    pic S9(9)   comp    value 123.
           05  filler          pic X(4)            value is SPACES.
           05  filler          pic X(8)            value 'COMP/M  '.
           05  NB-COMP-MINUS   pic S9(9)   comp    value -123.
           05  filler          pic X(4)            value is SPACES.
           05  filler          pic X(8)            value 'COMP/Z  '.
           05  NB-COMP-ZERO    pic S9(9)   comp    value 0.
           05  filler          pic X(4)            value is SPACES.
           05  filler          pic X(64)           value is SPACES.

       01  IX-1           pic 9999 value 0.
       01  IX-2           pic 9999 value 0.

       COPY PASSDUMP.

      *****************************************************************
       PROCEDURE DIVISION.

           perform POST-COPYRIGHT.

           perform INITIALIZE-PASS-AREA

           perform DUMP-BUFFER.

           perform DUMP-BUFFER-FOR-ALL.

           perform DUMP-NUMERIC-BUFFER.

           perform THANK-YOU.

           GOBACK.

      *****************************************************************
      * Move information to DUMP BUFFER and display the information.
      *****************************************************************
       DUMP-BUFFER.
           move 'SHOW'         to SIMODUMP-REQUEST
           add 26 to ZERO  giving SIMODUMP-LENGTH
           move 'DISPLAY1'     to SIMODUMP-DUMP-ID
           move ALPHABET-UPPER to SIMODUMP-BUFFER
           move '[]{}()'       to SIMODUMP-BUFFER(33:6)
           move PACK-BINARY    to SIMODUMP-BUFFER(49:12)
           move ASC            to SIMODUMP-BUFFER(65:10)
           move 'end'          to SIMODUMP-BUFFER(126:3)
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA
           exit.

      *****************************************************************
      * Create the full 256 character set and display in hex-dump
      * using two calls of 128 bytes each.
      *****************************************************************
       DUMP-BUFFER-FOR-ALL.
           move 'FILE'         to SIMODUMP-REQUEST
           add 128 to ZERO giving SIMODUMP-LENGTH
           move 'LOGTEST1'     to SIMODUMP-DUMP-ID

           subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-2
           perform 128 times
               move TWO-BYTES-02 to SIMODUMP-BUFFER(IX-1:1)
               add 1 to TWO-BYTES-BINARY
               add 1 to IX-1
           end-perform
           call 'SIMODUMP' using SIMODUMP-PASS-AREA

           add 1 to ZERO giving IX-1
           move 'LOGTEST2' to SIMODUMP-DUMP-ID
           perform 128 times
               move TWO-BYTES-02 to SIMODUMP-BUFFER(IX-1:1)
               add 1 to TWO-BYTES-BINARY
               add 1 to IX-1
           end-perform
           call 'SIMODUMP' using SIMODUMP-PASS-AREA

           exit.

      *****************************************************************
      * Display various numeric values and formats.
      *****************************************************************
       DUMP-NUMERIC-BUFFER.
           move 'BOTH'            to SIMODUMP-REQUEST
           add 128 to ZERO    giving SIMODUMP-LENGTH
           move 'NUMERIC1'        to SIMODUMP-DUMP-ID
           move NUMERIC-BUFFER-01 to SIMODUMP-BUFFER
           call 'SIMODUMP'     using SIMODUMP-PASS-AREA

           move 'NUMERIC2'        to SIMODUMP-DUMP-ID
           move NUMERIC-BUFFER-02 to SIMODUMP-BUFFER
           call 'SIMODUMP'     using SIMODUMP-PASS-AREA
           exit.

      *****************************************************************
       INITIALIZE-PASS-AREA.
           move 'SHOW'         to SIMODUMP-REQUEST
           move 'HEXDUMP1'     to SIMODUMP-DUMP-ID
           move 0              to SIMODUMP-RESULT
           add 128 to ZERO giving SIMODUMP-LENGTH
           move all SPACES     to SIMODUMP-BUFFER
           exit.

      *****************************************************************
       POST-COPYRIGHT.
           display SIM-TITLE     upon console
           display SIM-COPYRIGHT upon console
           exit.

      *****************************************************************
       POST-MESSAGE.
           display MESSAGE-BUFFER upon console
           move SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
       THANK-YOU.
           display SIM-THANKS-01 upon console
           display SIM-THANKS-02 upon console
           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       *
      *****************************************************************

The COBOL Hex-Dump Routine
(Next) (Previous) (Table-of-Contents)

This program (SIMODUMP.CBL) was written to be used as a debugging aid. It uses the DISPLAY function of COBOL to display hexadecimal dump information of a data field. This program requires a copyfile (TAB4DUMP.CPY) that is included in the downloadable package for this set of sample programs.

       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.This software contains confidential information   *
      *                                                               *
      * 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 ' v04.01.06'.
           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).

      *****************************************************************
      *    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-REQUEST 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.
      *    ------------------------------------------------------------
       01  SIMOLOGS-PASS-AREA.
           05  SIMOLOGS-REQUEST        pic X(8)    value 'SIMOLOGS'.
           05  SIMOLOGS-RESULT         pic 9999    value 0.
           05  SIMOLOGS-MESSAGE        pic X(80)   value is SPACES.

       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 POST-MESSAGE
           exit.

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

           exit.

      *****************************************************************
       DISPLAY-HEADER.
           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 DUMP-TEXT
           perform POST-DUMP-INFORMATION

           move DUMP-HEADER to DUMP-TEXT
           perform POST-DUMP-INFORMATION
           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

           move 'Complete'       to DS-DUMP-STATUS
           move DUMP-STATUS-LINE to DUMP-TEXT
           perform POST-DUMP-INFORMATION

           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
           perform POST-DUMP-INFORMATION
           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 POST-MESSAGE
               move MESSAGE-0004-2 to MESSAGE-TEXT
               perform POST-MESSAGE
           end-if

           exit.

       EDIT-PASS-AREA-SYSOUT.
           if  SIMODUMP-SYSOUT = 'SHOW'
           or                  = 'FILE'
           or                  = 'BOTH'
           or                  = 'NONE'
               subtract SIMODUMP-RESULT from SIMODUMP-RESULT
           else
               add 4 to ZERO   giving SIMODUMP-RESULT
               move 'SHOW'     to     SIMODUMP-SYSOUT
               move MESSAGE-0008-1 to MESSAGE-TEXT
               perform POST-MESSAGE
               move MESSAGE-0008-2 to MESSAGE-TEXT
               perform POST-MESSAGE
           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.
           display SIM-TITLE     upon console
           display SIM-COPYRIGHT upon console
           exit.

      *****************************************************************
       POST-MESSAGE.
           evaluate SIMODUMP-SYSOUT
               when 'FILE' move MESSAGE-BUFFER to SIMOLOGS-MESSAGE
                           perform POST-TO-LOG-FILE
                           if  SIMODUMP-RESULT not = ZERO
                               display MESSAGE-BUFFER upon console
                           end-if
               when 'SHOW' display MESSAGE-BUFFER upon console
               when 'BOTH' display MESSAGE-BUFFER upon console
                           move MESSAGE-BUFFER to SIMOLOGS-MESSAGE
                           perform POST-TO-LOG-FILE
               when OTHER  display MESSAGE-BUFFER upon console
           end-evaluate

           move SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
       POST-DUMP-INFORMATION.
           evaluate SIMODUMP-SYSOUT
               when 'FILE' move DUMP-BUFFER to SIMOLOGS-MESSAGE
                           perform POST-TO-LOG-FILE
                           if  SIMODUMP-RESULT not = ZERO
                               display DUMP-BUFFER upon console
                           end-if
               when 'SHOW' display DUMP-BUFFER upon console
               when 'BOTH' display DUMP-BUFFER upon console
                           move DUMP-BUFFER to SIMOLOGS-MESSAGE
                           perform POST-TO-LOG-FILE
               when 'NONE' continue
               when OTHER  display DUMP-BUFFER upon console
           end-evaluate

           move SPACES to DUMP-TEXT
           exit.

      *****************************************************************
       POST-TO-LOG-FILE.
           add  16 to ZERO giving SIMOLOGS-RESULT
           call 'SIMOLOGS' using SIMOLOGS-PASS-AREA
           if  SIMOLOGS-RESULT not = ZERO
               move 'SHOW' to SIMODUMP-SYSOUT
               add SIMOLOGS-RESULT to ZERO giving SIMODUMP-RESULT
           end-if
           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       *
      *****************************************************************

The COBOL Write-to-Log File
(Next) (Previous) (Table-of-Contents)

This program (SIMOLOGS.CBL) performs the necessary I/O to write to a log file (SYSLOG). If the logging function is used (i.e SIMODUMP-REQUEST contains a value of 'FILE' or 'BOTH' ) then a DD statement is required in the JCL. This program uses a Y2K (Year 2000) compliant date access function and required the COBOL/390 dialect.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SIMOLOGS.
       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 does not imply publication or    *
      * disclosure.  This software contains confidential information  *
      * and trade secrets of SimoTime Enterprises, LLC. No part of    *
      * this program or publication may be reproduced, transmitted,   *
      * transcribed, stored in a retrieval system, or translated into *
      * any language or computer language, in any form or by any      *
      * means, electronic, mechanical, magnetic, optical, chemical,   *
      * manual or otherwise, without the prior written permission of: *
      *                                                               *
      * 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: SIMOLOGS.CBL
      *****************************************************************
      *
      *>SIMOLOGS - Call SIMOLOGS to write record to the Message file.
      *
      * CALLING PROTOCOL
      * ----------------
      * Use standard procedure to EXECUTE, RUN or ANIMATE.
      *
      * DESCRIPTION
      * -----------
      * This program will write a message to the SYSLOG file.
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1997/12/18 Simmons, Created program.
      * 1997/12/18 Simmons, No changes to date.
      *
      *****************************************************************
      *
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT   SECTION.
       FILE-CONTROL.
      *****************************************************************
           SELECT SYSLOG-FILE
                  ASSIGN       to SYSLOG
                  ORGANIZATION is SEQUENTIAL
                  ACCESS MODE  is SEQUENTIAL
                  FILE STATUS  is SYSLOG-LOG-STATUS.
      *****************************************************************
      *
       DATA DIVISION.
       FILE SECTION.
      *
      *****************************************************************
       FD  SYSLOG-FILE.
       01  SYSLOG-RECORD.
           05  SYSLOG-DATE         pic X(10).
           05  filler              pic X.
           05  SYSLOG-TIME         pic X(11).
           05  filler              pic X.
           05  SYSLOG-DATA         pic X(80).
           05  filler              pic X(25).

      *****************************************************************
       WORKING-STORAGE SECTION.

       01  SYSLOG-LOG-STATUS.
           05  SYSLOG-LOG-STAT1    pic X.
           05  SYSLOG-LOG-STAT2    pic X.

       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  TWO-BYTES.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.
       01  TWO-BYTES-BINARY        redefines TWO-BYTES pic 9(4) comp.

       01  SYSLOG-OPEN-FLAG        pic X       value 'N'.

       01  FIRST-TIME              pic X       value 'Y'.

       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* SIMOLOGS '.
           05  MESSAGE-TEXT        pic X(68).

       01  APPL-RESULT             pic S9(9)   comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       01  WORK-DATE.
           05  WORK-DATE-08        pic X(8).
       01  WORK-TIME               pic X(8).

       01  LOG-DATE                pic X(10)   value 'yyyy/nn/nn'.
       01  LOG-TIME                pic X(11)   value 'nn:nn:nn:nn'.

      *****************************************************************
       LINKAGE SECTION.
       01  SIMOLOGS-PASS-AREA.
           05  SIMOLOGS-REQUEST    pic X(8).
           05  SIMOLOGS-STATUS     pic 9999.
           05  SIMOLOGS-MESSAGE    pic X(80).

      *****************************************************************
       PROCEDURE DIVISION using SIMOLOGS-PASS-AREA.

           evaluate SIMOLOGS-REQUEST
               when 'SIMOLOGS' perform WRITE-TO-LOG
               when OTHER      perform WRITE-TO-LOG
           end-evaluate

           if  APPL-AOK
               subtract SIMOLOGS-STATUS from SIMOLOGS-STATUS
           end-if

           GOBACK.

      *****************************************************************
      * I/O ROUTINE TO DISPLAY MESSAGES TO THE CONSOLE...             *
      *****************************************************************
       DISPLAY-SIMOLOGS-MESSAGE.
           if  SIMOLOGS-MESSAGE(80:1) = ' '
               display SIMOLOGS-MESSAGE(1:79) upon console
           else
               display SIMOLOGS-MESSAGE(1:80) upon console
           end-if
           exit.

      *****************************************************************
       GET-DATE-AND-TIME.
           accept WORK-DATE from DATE YYYYMMDD
           accept WORK-TIME from TIME

           move WORK-DATE(1:4) to LOG-DATE(1:4)
           move WORK-DATE(5:2) to LOG-DATE(6:2)
           move WORK-DATE(7:2) to LOG-DATE(9:2)

           move WORK-TIME(1:2) to LOG-TIME(1:2)
           move WORK-TIME(3:2) to LOG-TIME(4:2)
           move WORK-TIME(5:2) to LOG-TIME(7:2)
           move WORK-TIME(7:2) to LOG-TIME(10:2)

           exit.

      *****************************************************************
       WRITE-TO-LOG.
           perform SIMOLOGS-OPEN
           if  SYSLOG-OPEN-FLAG = 'Y'
               perform GET-DATE-AND-TIME
               move all SPACES       to SYSLOG-RECORD
               move LOG-DATE         to SYSLOG-DATE
               move LOG-TIME         to SYSLOG-TIME
               move SIMOLOGS-MESSAGE to SYSLOG-DATA
               perform SIMOLOGS-WRITE
               perform SIMOLOGS-CLOSE
               move 'N' to SYSLOG-OPEN-FLAG
           end-if
           exit.

      *****************************************************************
      * I/O ROUTINES TO CREATE THE MESSAGE FILE, SIMOLOGS...
      *****************************************************************
       SIMOLOGS-WRITE.
           write SYSLOG-RECORD.
           if  SYSLOG-LOG-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SYSLOG-LOG-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'FAILED-WRITE, Log file, SYSLOG' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSLOG-LOG-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SIMOLOGS-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open EXTEND SYSLOG-FILE
           if  SYSLOG-LOG-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'Y' to SYSLOG-OPEN-FLAG
           else
               open output SYSLOG-FILE
               if  SYSLOG-LOG-STATUS = '00'
                   subtract APPL-RESULT from APPL-RESULT
                   move 'Y' to SYSLOG-OPEN-FLAG
               end-if
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'FAILED-OPEN, Log file, SYSLOG' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSLOG-LOG-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SIMOLOGS-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SYSLOG-FILE
           if  SYSLOG-LOG-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'FAILED-CLOSE, Log file, SYSLOG' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSLOG-LOG-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-Routines perform administrative functions     *
      * for this program.                                             *
      *****************************************************************

      *****************************************************************
      * ABEND the program and return to caller...                     *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-CONSOLE-MESSAGE
           end-if
           move 'Writing to log file is ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE
           add 12 to ZERO giving RETURN-CODE
           GOBACK
           exit.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * two digits if the full two byte file status is numeric. If    *
      * second byte is non-numeric then it will be treated as a       *
      * binary number.                                                *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS NUMERIC
               display '* SIMOLOGS FILE-STATUS-' IO-STATUS upon console
           else
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               display '* SIMOLOGS FILE-STATUS-'
                       IO-STAT1 '/' TWO-BYTES-BINARY upon console
           end-if
           exit.
      *****************************************************************
      * Display a message generated by this program.                  *
      *****************************************************************
       Z-DISPLAY-CONSOLE-MESSAGE.
           display MESSAGE-BUFFER upon console
           move SPACES to MESSAGE-TEXT
           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       *
      *****************************************************************

The Copy File for Pass Area Parameters
(Next) (Previous) (Table-of-Contents)

The following is the copy file (PASSDUMP.CPY) used for the pass area when calling the dump routine.

      *****************************************************************
      *           Data Structure used for calling SIMODUMP.           *
      *****************************************************************
      *         Copyright (C) 1987-2010 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Enterprises                 *
      *        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 Heaxedecimal format                 *
      * NOTE   Display or Write the text to the screen or log file    *
      *                                                               *
      * Values for SIMODUMP-SYSOUT                                    *
      * SHOW   Display dump information on screen                     *
      * FILE   Write dump information to the log file (SYSLOG)        *
      * BOTH   Display to screen and write to log file                *
      * NONE   Do not output to screen or file, put dump info in      *
      *        pass area table and return to caller.                  *
      *****************************************************************
       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-SYSOUT         PIC X(4).
           05  SIMODUMP-COPYRIGHT      PIC X(4).
           05  SIMODUMP-LENGTH         PIC 9999.
           05  SIMODUMP-BUFFER         PIC X(128).
      *    The following are modified by the SimoDUMP routine...
           05  SIMODUMP-IDX            PIC 99.
           05  SIMODUMP-LINES          PIC X(80)   OCCURS 8 TIMES.
      *!   PASSDUMP - End-of-Copy File...

The Copy File for Hex-Table
(Next) (Previous) (Table-of-Contents)

The following is the copy file (HEXTABLE.CPY) of the conversion table used by the dump routine.

      *****************************************************************
      *            Table for Hexadecimal Dump and Display.            *
      *****************************************************************
      *         Copyright (C) 1987-2010 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *****************************************************************
      *                                                               *
      * The following table contains 256, 5-byte elements.            *
      *                                                               *
      * The format of the table elements is as follows                *
      * Byte  Function                                                *
      *  1-2  Two-byte hexadecimal print value                        *
      *    3  Print character for EBCDIC                              *
      *    4  Print character for ASCII                               *
      *    5  0 - non-printable                                       *
      *       1 - printable for EBCDIC                                *
      *       2 - printable for ASCII                                 *
      *       3 - printable for Both                                  *
      *****************************************************************
      *
       01  TABLE-OF-DATA.
           05  HEX-00  PIC X(5)    VALUE '00..0'.
           05  HEX-01  PIC X(5)    VALUE '01..0'.
           05  HEX-02  PIC X(5)    VALUE '02..0'.
           05  HEX-03  PIC X(5)    VALUE '03..0'.
           05  HEX-04  PIC X(5)    VALUE '04..0'.
           05  HEX-05  PIC X(5)    VALUE '05..0'.
           05  HEX-06  PIC X(5)    VALUE '06..0'.
           05  HEX-07  PIC X(5)    VALUE '07..0'.
           05  HEX-08  PIC X(5)    VALUE '08..0'.
           05  HEX-09  PIC X(5)    VALUE '09..0'.
           05  HEX-0A  PIC X(5)    VALUE '0A..0'.
           05  HEX-0B  PIC X(5)    VALUE '0B..0'.
           05  HEX-0C  PIC X(5)    VALUE '0C..0'.
           05  HEX-0D  PIC X(5)    VALUE '0D..0'.
           05  HEX-0E  PIC X(5)    VALUE '0E..0'.
           05  HEX-0F  PIC X(5)    VALUE '0F..0'.

           05  HEX-10  PIC X(5)    VALUE '10..0'.
           05  HEX-11  PIC X(5)    VALUE '11..0'.
           05  HEX-12  PIC X(5)    VALUE '12..0'.
           05  HEX-13  PIC X(5)    VALUE '13..0'.
           05  HEX-14  PIC X(5)    VALUE '14..0'.
           05  HEX-15  PIC X(5)    VALUE '15..0'.
           05  HEX-16  PIC X(5)    VALUE '16..0'.
           05  HEX-17  PIC X(5)    VALUE '17..0'.
           05  HEX-18  PIC X(5)    VALUE '18..0'.
           05  HEX-19  PIC X(5)    VALUE '19..0'.
           05  HEX-1A  PIC X(5)    VALUE '1A..0'.
           05  HEX-1B  PIC X(5)    VALUE '1B..0'.
           05  HEX-1C  PIC X(5)    VALUE '1C..0'.
           05  HEX-1D  PIC X(5)    VALUE '1D..0'.
           05  HEX-1E  PIC X(5)    VALUE '1E..0'.
           05  HEX-1F  PIC X(5)    VALUE '1F..0'.

           05  HEX-20  PIC X(5)    VALUE '20. 2'.
           05  HEX-21  PIC X(5)    VALUE '21.!2'.
           05  HEX-22  PIC X(5)    VALUE '22."2'.
           05  HEX-23  PIC X(5)    VALUE '23.#2'.
           05  HEX-24  PIC X(5)    VALUE '24.$2'.
           05  HEX-25  PIC X(5)    VALUE '25.%2'.
           05  HEX-26  PIC X(5)    VALUE '26.&2'.
           05  HEX-27  PIC X(5)    VALUE '27..2'.
           05  HEX-28  PIC X(5)    VALUE '28.(2'.
           05  HEX-29  PIC X(5)    VALUE '29.)2'.
           05  HEX-2A  PIC X(5)    VALUE '2A.*2'.
           05  HEX-2B  PIC X(5)    VALUE '2B.+2'.
           05  HEX-2C  PIC X(5)    VALUE '2C.,2'.
           05  HEX-2D  PIC X(5)    VALUE '2D.-2'.
           05  HEX-2E  PIC X(5)    VALUE '2E..2'.
           05  HEX-2F  PIC X(5)    VALUE '2F./2'.

           05  HEX-30  PIC X(5)    VALUE '30.02'.
           05  HEX-31  PIC X(5)    VALUE '31.12'.
           05  HEX-32  PIC X(5)    VALUE '32.22'.
           05  HEX-33  PIC X(5)    VALUE '33.32'.
           05  HEX-34  PIC X(5)    VALUE '34.42'.
           05  HEX-35  PIC X(5)    VALUE '35.52'.
           05  HEX-36  PIC X(5)    VALUE '36.62'.
           05  HEX-37  PIC X(5)    VALUE '37.72'.
           05  HEX-38  PIC X(5)    VALUE '38.82'.
           05  HEX-39  PIC X(5)    VALUE '39.92'.
           05  HEX-3A  PIC X(5)    VALUE '3A.:2'.
           05  HEX-3B  PIC X(5)    VALUE '3B.;2'.
           05  HEX-3C  PIC X(5)    VALUE '3C.<2'.
           05  HEX-3D  PIC X(5)    VALUE '3D.=2'.
           05  HEX-3E  PIC X(5)    VALUE '3E.>2'.
           05  HEX-3F  PIC X(5)    VALUE '3F.?2'.

           05  HEX-40  PIC X(5)    VALUE '40 @3'.
           05  HEX-41  PIC X(5)    VALUE '41.A2'.
           05  HEX-42  PIC X(5)    VALUE '42.B2'.
           05  HEX-43  PIC X(5)    VALUE '43.C2'.
           05  HEX-44  PIC X(5)    VALUE '44.D2'.
           05  HEX-45  PIC X(5)    VALUE '45.E2'.
           05  HEX-46  PIC X(5)    VALUE '46.F2'.
           05  HEX-47  PIC X(5)    VALUE '47.G2'.
           05  HEX-48  PIC X(5)    VALUE '48.H2'.
           05  HEX-49  PIC X(5)    VALUE '49.I2'.
           05  HEX-4A  PIC X(5)    VALUE '4A.J2'.
           05  HEX-4B  PIC X(5)    VALUE '4B.K3'.
           05  HEX-4C  PIC X(5)    VALUE '4C<L3'.
           05  HEX-4D  PIC X(5)    VALUE '4D(M3'.
           05  HEX-4E  PIC X(5)    VALUE '4E+N3'.
           05  HEX-4F  PIC X(5)    VALUE '4F|O3'.

           05  HEX-50  PIC X(5)    VALUE '50&P3'.
           05  HEX-51  PIC X(5)    VALUE '51.Q2'.
           05  HEX-52  PIC X(5)    VALUE '52.R2'.
           05  HEX-53  PIC X(5)    VALUE '53.S2'.
           05  HEX-54  PIC X(5)    VALUE '54.T2'.
           05  HEX-55  PIC X(5)    VALUE '55.U2'.
           05  HEX-56  PIC X(5)    VALUE '56.V2'.
           05  HEX-57  PIC X(5)    VALUE '57.W2'.
           05  HEX-58  PIC X(5)    VALUE '58.X2'.
           05  HEX-59  PIC X(5)    VALUE '59.Y2'.
           05  HEX-5A  PIC X(5)    VALUE '5A!Z3'.
           05  HEX-5B  PIC X(5)    VALUE '5B$[3'.
           05  HEX-5C  PIC X(5)    VALUE '5C*\3'.
           05  HEX-5D  PIC X(5)    VALUE '5D)]3'.
           05  HEX-5E  PIC X(5)    VALUE '5E;^3'.
           05  HEX-5F  PIC X(5)    VALUE '5F._2'.

           05  HEX-60  PIC X(5)    VALUE '60-`3'.
           05  HEX-61  PIC X(5)    VALUE '61/a3'.
           05  HEX-62  PIC X(5)    VALUE '62.b2'.
           05  HEX-63  PIC X(5)    VALUE '63.c2'.
           05  HEX-64  PIC X(5)    VALUE '64.d2'.
           05  HEX-65  PIC X(5)    VALUE '65.e2'.
           05  HEX-66  PIC X(5)    VALUE '66.f2'.
           05  HEX-67  PIC X(5)    VALUE '67.g2'.
           05  HEX-68  PIC X(5)    VALUE '68.h2'.
           05  HEX-69  PIC X(5)    VALUE '69.i2'.
           05  HEX-6A  PIC X(5)    VALUE '6A|j3'.
           05  HEX-6B  PIC X(5)    VALUE '6B.k3'.
           05  HEX-6C  PIC X(5)    VALUE '6C%l3'.
           05  HEX-6D  PIC X(5)    VALUE '6D_m3'.
           05  HEX-6E  PIC X(5)    VALUE '6E>n3'.
           05  HEX-6F  PIC X(5)    VALUE '6F?o3'.

           05  HEX-70  PIC X(5)    VALUE '70.p2'.
           05  HEX-71  PIC X(5)    VALUE '71.q2'.
           05  HEX-72  PIC X(5)    VALUE '72.r2'.
           05  HEX-73  PIC X(5)    VALUE '73.s2'.
           05  HEX-74  PIC X(5)    VALUE '74.t2'.
           05  HEX-75  PIC X(5)    VALUE '75.u2'.
           05  HEX-76  PIC X(5)    VALUE '76.v2'.
           05  HEX-77  PIC X(5)    VALUE '77.w2'.
           05  HEX-78  PIC X(5)    VALUE '78.x2'.
           05  HEX-79  PIC X(5)    VALUE '79`y3'.
           05  HEX-7A  PIC X(5)    VALUE '7A:z3'.
           05  HEX-7B  PIC X(5)    VALUE '7B#{3'.
           05  HEX-7C  PIC X(5)    VALUE '7C@.3'.
           05  HEX-7D  PIC X(5)    VALUE '7D.}3'.
           05  HEX-7E  PIC X(5)    VALUE '7E=~3'.
           05  HEX-7F  PIC X(5)    VALUE '7F".2'.

           05  HEX-80  PIC X(5)    VALUE '80..0'.
           05  HEX-81  PIC X(5)    VALUE '81a.1'.
           05  HEX-82  PIC X(5)    VALUE '82b.1'.
           05  HEX-83  PIC X(5)    VALUE '83c.1'.
           05  HEX-84  PIC X(5)    VALUE '84d.1'.
           05  HEX-85  PIC X(5)    VALUE '85e.1'.
           05  HEX-86  PIC X(5)    VALUE '86f.1'.
           05  HEX-87  PIC X(5)    VALUE '87g.1'.
           05  HEX-88  PIC X(5)    VALUE '88h.1'.
           05  HEX-89  PIC X(5)    VALUE '89i.1'.
           05  HEX-8A  PIC X(5)    VALUE '8A..0'.
           05  HEX-8B  PIC X(5)    VALUE '8B{.1'.
           05  HEX-8C  PIC X(5)    VALUE '8C..0'.
           05  HEX-8D  PIC X(5)    VALUE '8D..0'.
           05  HEX-8E  PIC X(5)    VALUE '8E..0'.
           05  HEX-8F  PIC X(5)    VALUE '8F+.1'.

           05  HEX-90  PIC X(5)    VALUE '90..0'.
           05  HEX-91  PIC X(5)    VALUE '91j.1'.
           05  HEX-92  PIC X(5)    VALUE '92k.1'.
           05  HEX-93  PIC X(5)    VALUE '93l.1'.
           05  HEX-94  PIC X(5)    VALUE '94m.1'.
           05  HEX-95  PIC X(5)    VALUE '95n.1'.
           05  HEX-96  PIC X(5)    VALUE '96o.1'.
           05  HEX-97  PIC X(5)    VALUE '97p.1'.
           05  HEX-98  PIC X(5)    VALUE '98q.1'.
           05  HEX-99  PIC X(5)    VALUE '99r.1'.
           05  HEX-9A  PIC X(5)    VALUE '9A..0'.
           05  HEX-9B  PIC X(5)    VALUE '9B}.1'.
           05  HEX-9C  PIC X(5)    VALUE '9C..0'.
           05  HEX-9D  PIC X(5)    VALUE '9D..0'.
           05  HEX-9E  PIC X(5)    VALUE '9E..0'.
           05  HEX-9F  PIC X(5)    VALUE '9F..0'.

           05  HEX-A0  PIC X(5)    VALUE 'A0..0'.
           05  HEX-A1  PIC X(5)    VALUE 'A1..0'.
           05  HEX-A2  PIC X(5)    VALUE 'A2s.1'.
           05  HEX-A3  PIC X(5)    VALUE 'A3t.1'.
           05  HEX-A4  PIC X(5)    VALUE 'A4u.1'.
           05  HEX-A5  PIC X(5)    VALUE 'A5v.1'.
           05  HEX-A6  PIC X(5)    VALUE 'A6w.1'.
           05  HEX-A7  PIC X(5)    VALUE 'A7x.1'.
           05  HEX-A8  PIC X(5)    VALUE 'A8y.1'.
           05  HEX-A9  PIC X(5)    VALUE 'A9z.1'.
           05  HEX-AA  PIC X(5)    VALUE 'AA..0'.
           05  HEX-AB  PIC X(5)    VALUE 'AB..0'.
           05  HEX-AC  PIC X(5)    VALUE 'AC..0'.
           05  HEX-AD  PIC X(5)    VALUE 'AD..0'.
           05  HEX-AE  PIC X(5)    VALUE 'AE..0'.
           05  HEX-AF  PIC X(5)    VALUE 'AF..0'.

           05  HEX-B0  PIC X(5)    VALUE 'B0..0'.
           05  HEX-B1  PIC X(5)    VALUE 'B1..0'.
           05  HEX-B2  PIC X(5)    VALUE 'B2..0'.
           05  HEX-B3  PIC X(5)    VALUE 'B3..0'.
           05  HEX-B4  PIC X(5)    VALUE 'B4..0'.
           05  HEX-B5  PIC X(5)    VALUE 'B5..0'.
           05  HEX-B6  PIC X(5)    VALUE 'B6..0'.
           05  HEX-B7  PIC X(5)    VALUE 'B7..0'.
           05  HEX-B8  PIC X(5)    VALUE 'B8..0'.
           05  HEX-B9  PIC X(5)    VALUE 'B9..0'.
           05  HEX-BA  PIC X(5)    VALUE 'BA[.1'.
           05  HEX-BB  PIC X(5)    VALUE 'BB].1'.
           05  HEX-BC  PIC X(5)    VALUE 'BC..0'.
           05  HEX-BD  PIC X(5)    VALUE 'BD..0'.
           05  HEX-BE  PIC X(5)    VALUE 'BE..0'.
           05  HEX-BF  PIC X(5)    VALUE 'BF..0'.

           05  HEX-C0  PIC X(5)    VALUE 'C0{.1'.
           05  HEX-C1  PIC X(5)    VALUE 'C1A.1'.
           05  HEX-C2  PIC X(5)    VALUE 'C2B.1'.
           05  HEX-C3  PIC X(5)    VALUE 'C3C.1'.
           05  HEX-C4  PIC X(5)    VALUE 'C4D.1'.
           05  HEX-C5  PIC X(5)    VALUE 'C5E.1'.
           05  HEX-C6  PIC X(5)    VALUE 'C6F.1'.
           05  HEX-C7  PIC X(5)    VALUE 'C7G.1'.
           05  HEX-C8  PIC X(5)    VALUE 'C8H.1'.
           05  HEX-C9  PIC X(5)    VALUE 'C9I.1'.
           05  HEX-CA  PIC X(5)    VALUE 'CA..0'.
           05  HEX-CB  PIC X(5)    VALUE 'CB..0'.
           05  HEX-CC  PIC X(5)    VALUE 'CC..0'.
           05  HEX-CD  PIC X(5)    VALUE 'CD..0'.
           05  HEX-CE  PIC X(5)    VALUE 'CE..0'.
           05  HEX-CF  PIC X(5)    VALUE 'CF..0'.

           05  HEX-D0  PIC X(5)    VALUE 'D0}.1'.
           05  HEX-D1  PIC X(5)    VALUE 'D1J.1'.
           05  HEX-D2  PIC X(5)    VALUE 'D2K.1'.
           05  HEX-D3  PIC X(5)    VALUE 'D3L.1'.
           05  HEX-D4  PIC X(5)    VALUE 'D4M.1'.
           05  HEX-D5  PIC X(5)    VALUE 'D5N.1'.
           05  HEX-D6  PIC X(5)    VALUE 'D6O.1'.
           05  HEX-D7  PIC X(5)    VALUE 'D7P.1'.
           05  HEX-D8  PIC X(5)    VALUE 'D8Q.1'.
           05  HEX-D9  PIC X(5)    VALUE 'D9R.1'.
           05  HEX-DA  PIC X(5)    VALUE 'DA..0'.
           05  HEX-DB  PIC X(5)    VALUE 'DB..0'.
           05  HEX-DC  PIC X(5)    VALUE 'DC..0'.
           05  HEX-DD  PIC X(5)    VALUE 'DD..0'.
           05  HEX-DE  PIC X(5)    VALUE 'DE..0'.
           05  HEX-DF  PIC X(5)    VALUE 'DF..0'.

           05  HEX-E0  PIC X(5)    VALUE 'E0..0'.
           05  HEX-E1  PIC X(5)    VALUE 'E1..0'.
           05  HEX-E2  PIC X(5)    VALUE 'E2S.1'.
           05  HEX-E3  PIC X(5)    VALUE 'E3T.1'.
           05  HEX-E4  PIC X(5)    VALUE 'E4U.1'.
           05  HEX-E5  PIC X(5)    VALUE 'E5V.1'.
           05  HEX-E6  PIC X(5)    VALUE 'E6W.1'.
           05  HEX-E7  PIC X(5)    VALUE 'E7X.1'.
           05  HEX-E8  PIC X(5)    VALUE 'E8Y.1'.
           05  HEX-E9  PIC X(5)    VALUE 'E9Z.1'.
           05  HEX-EA  PIC X(5)    VALUE 'EA..0'.
           05  HEX-EB  PIC X(5)    VALUE 'EB..0'.
           05  HEX-EC  PIC X(5)    VALUE 'EC..0'.
           05  HEX-ED  PIC X(5)    VALUE 'ED..0'.
           05  HEX-EE  PIC X(5)    VALUE 'EE..0'.
           05  HEX-EF  PIC X(5)    VALUE 'EF..0'.

           05  HEX-F0  PIC X(5)    VALUE 'F00.1'.
           05  HEX-F1  PIC X(5)    VALUE 'F11.1'.
           05  HEX-F2  PIC X(5)    VALUE 'F22.1'.
           05  HEX-F3  PIC X(5)    VALUE 'F33.1'.
           05  HEX-F4  PIC X(5)    VALUE 'F44.1'.
           05  HEX-F5  PIC X(5)    VALUE 'F55.1'.
           05  HEX-F6  PIC X(5)    VALUE 'F66.1'.
           05  HEX-F7  PIC X(5)    VALUE 'F77.1'.
           05  HEX-F8  PIC X(5)    VALUE 'F88.1'.
           05  HEX-F9  PIC X(5)    VALUE 'F99.1'.
           05  HEX-FA  PIC X(5)    VALUE 'FA..0'.
           05  HEX-FB  PIC X(5)    VALUE 'FB..0'.
           05  HEX-FC  PIC X(5)    VALUE 'FC..0'.
           05  HEX-FD  PIC X(5)    VALUE 'FD..0'.
           05  HEX-FE  PIC X(5)    VALUE 'FE..0'.
           05  HEX-FF  PIC X(5)    VALUE 'FF..0'.

       01  TABLE-OF-PRINT          REDEFINES TABLE-OF-DATA.
           05  TAB-X1  PIC X(5)    OCCURS 256 TIMES.

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

The purpose of this document is to assist as a tutorial for new programmers or as a quick reference for experienced programmers. These sample programs are made available on an "as-is" basis and may be downloaded, copied and modified for specific situations as long as the copyright information is not removed or changed. As always, it is the programmer's responsibility to thoroughly test all programs.

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.

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

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

You may download this example at http://www.simotime.com/sim4dzip.htm#COBOLHexDump as a Z-Pack. The Z-Packs provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.

Please view the complete list of SimoTime Z-Pack Examples at http://www.simotime.com/sim4dzip.htm.

Note: You must be attached to the Internet to download a Z-Pack or view the list.

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

The following is a list of sample conversion programs created by the GENERATE function of SimoZAPS.

Program Description
zap00101 Convert from an EBCDIC-Sequential file to an ASCII-Text file.
zap00201 Convert from an EBCDIC-Sequential file to an ASCII-Indexed file (Sequential-Add).
zap00301 Convert from an EBCDIC-Sequential file to an ASCII-Sequential file.
zap00401 Convert from an ASCII-Text file to an EBCDIC-Indexed file (Sequential-Add).
zap00501 Convert from an ASCII-Text file to an EBCDIC-Indexed file (Random-Add).

Check out  The COBOL Connection  for more examples of mainframe COBOL coding techniques and sample code.

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

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

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