Numeric Field Analysis
Access & View Bytes within a Field
  Table of Contents  v-24.01.01 - nbrtst02.htm 
  Introduction
  Basic Functionality
  Simple Alpha-Numeric Field
  Zoned Decimal Unsigned Field
  Binary Unsigned Field
  Packed Unsigned Field
  Understand, Execute & Review
  HEX-Dump of Working Storage
  HEX-Dump of a Field
  Command File
  JCL Member
  COBOL Mainline Program
  Technical Details
  Convert One Byte to Two Bytes
  Ancillary Functions
  Set the Environment
  Display and Log Messages
  Hex-Dump Callable Routine
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Contact or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This program is used to show techniques for analyzing and testing the content of numeric fields. Each byte within a numeric field will be accessed using Reference Modification. The program shows the content of a field in HEX-Dump format. Two techniques are used to produce HEX-Dump information.

1. At the start and end of program execution a call is made to SIMOSNAP to dump the content of WORKING-STORAGE.
2. A perform of the "CONVERT-BYTE-TO-HEX-DISPLAY" paragraph is used to dump the content of a single field

 


We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.

Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section Basic Functionality

This section will provide a quick review of numeric formats.

The sample program starts by defining one Alpha-Numeric field and three Numeric fields in WORKING STORAGE.

           05  TXT-X-016         pic X(16) value 'Part-1,  Part-2 '.
           05  ZDU-5-V-2         pic 99999V99    value 7.98.
           05  BNU-4-V-0         pic 9(7)        COMP    value 4671.
           05  PKU-4-V-0         pic 9(7)        COMP-3  value 123.

The primary CMD Files will call other command files to perform ancillary tasks. These secondary command files and programs will be described in the Ancillary Functions section of this document.

Table of Contents Previous Section Next Section Simple Alpha-Numeric Field

The TXT-X-016 field is defined as follows.

           05  TXT-X-016         pic X(16) value 'Part-1,  Part-2 '.

This is an Alpha-Numeric Field. The ENTCOBOL Compiler directive is used and bytes within the field may be accessed using Reference Modification. The data string may contain embedded HEX characters. Since the USAGE clause is missing then USAGE IS DISPLAY is implied.

Table of Contents Previous Section Next Section Zoned Decimal Unsigned Field

The ZDU-5-V-2 field is defined as follows.

           05  ZDU-5-V-2         pic 99999V99    value 7.98.

This is a numeric Field. The ENTCOBOL Compiler directive is used and bytes within the field may be accessed using Reference Modification. When there is no explicit USAGE clause, it defaults to USAGE IS DISPLAY.

Table of Contents Previous Section Next Section Binary Unsigned Field

The BNU-4-V-0 field is defined as follows.

           05  BNU-4-V-0         pic 9(7)        COMP    value 4671.

The program that uses this field definition is compiled with the IBMCOMP and NOTRUNC directives.

The IBMCOMP directive sets "word-storage" mode. In word-storage mode every data item of USAGE IS COMP occupies either two bytes or a multiple of four bytes. The PIC 9(7) COMP field would only require a three (3) byte physical memory allocation. However, since we are using the IBMCOMP directive the actual physical length will be four (4) bytes (this is compatible with the IBM Mainframe).

The TRUNC directive specifies whether data being stored into a USAGE IS COMP item is to be truncated to the size given by the item's PICTURE clause or to the maximum size the item can hold. The NOTRUNC will not truncate to the picture size but will allow the arithmetic value to be the maximum size the item can hold which is x'FFFFFFFF" or 4,294,967,295 for an unsigned number.

Also, for COMP fields the units position of the arithmetic value is at the high-memory address.

Note:  The ENTCOBOL dialect will post an error if Reference Modification access is attempted on a field that is not designated as USAGE IS DISPLAY.

Table of Contents Previous Section Next Section Packed Unsigned Field

A packed decimal representation stores two decimal digits in one byte. A packed decimal representation stores decimal digits in each "nibble" of a byte. Each byte has two nibbles, and each nibble is indicated by a hexadecimal digit. For example, the value 23 would be stored in two nibbles, using the hexadecimal digits 2 and 3. The sign indication is dependent on your operating environment. On an IBM mainframe, the sign is indicated by the last nibble of the last byte (or high memory address). For explicitly signed fields the "C" indicates a positive value and "D" indicates a negative value. For unsigned (or implied positive) fields the "F" indicates a positive value.

The PKU-4-V-07 field is defined as follows.

           05  PKU-4-V-0         pic 9(7)        COMP-3  value 123.

Table of Contents Previous Section Next Section Understand, Execute & Review

The following shows the COBOL group definition of the data structure that contains the three numeric fields.

      *****************************************************************
       01  NUMBERS-01.
      *
      * ------------------------------------------------------------- *
      *    Numeric Data, With the ENTCOBOL dialect the use of Reference
      *                  Modification requires a field designated as
      *                  USAGE IS DISPLAY. Therefore, numeric fields
      *                  with a designation of USAGE IS COMPUTATIONAL
      *                  will require a redefinition of the field to
      *                  access individual bytes within the field.
      *
      * ------------------------------------------------------------- *
      *    Numeric Field, Zoned-Decimal-Unsigned (ZDU)
      *                   implied USAGE is DISPLAY
      *                   ENTCOBOL can use Reference Modification
           05  ZDU-5-V-2         pic 99999V99    value 7.98.
      *
      * ------------------------------------------------------------- *
      *    Numeric Field, BiNary-Unsigned (BNU)
      *                   explicit USAGE is COMP
      *                   ENTCOBOL cannot use Reference Modification
      *                   a REDEFINES is used to access individual
      *                   bytes via Reference Modification
           05  BNU-4-V-0         pic 9(7)        COMP    value 4671.
           05  BNU-4-V-0-R       redefines BNU-4-V-0
                                 pic X(4).
      *
      * ------------------------------------------------------------- *
      *    Numeric Field, PacKed-Unsigned (PKU)
      *                   explicit USAGE is COMP-3
      *                   ENTCOBOL cannot use Reference Modification
      *                   a REDEFINES is used to access individual
      *                   bytes via Reference Modification
           05  PKU-4-V-0         pic 9(7)        COMP-3  value 123.
           05  PKU-4-V-0-R       redefines PKU-4-V-0
                                 pic X(4).
      *

Table of Contents Previous Section Next Section HEX-Dump of Working Storage

At the beginning and end of the job (or program execution) the content of the WORKING-STORAGE Section is written to an output file (SYSOUT) in a HEX-Dump format. The following shows a HEX-Dump that was created at the start of the job.

* SIMOSNAP User callable memory dump routine  v10.06.08 http://www.simotime.com
* SIMOSNAP Copyright 1987-2016    SimoTime Technologies     All Rights Reserved
@SimoSNAP by SimoTime Technologies*********************************************
@SimoSNAP Dump Buffer Size is 0000504
@Hex-Disp Hex..... ........ ........ ........ ebcdic.......... ascii...........
@00000000 5354534E 41502D53 54415254 2D544147 ...+.&.......... STSNAP-START-TAG
@00000010 2A204E42 52545354 43322043 6F6E7465 ..+.........?>.. * NBRTSTC2 Conte
@00000020 6E742041 6E616C79 73697320 6F66204E >...>/%`....?..+ nt Analysis of N
@00000030 756D6572 69632046 69656C64 73207631 ._........%..... umeric Fields v1
@00000040 312E3132 2E303420 68747470 3A2F2F77 ................ 1.12.04 http://w
@00000050 77772E73 696D6F74 696D652E 636F6D20 ....._?.._...?_. ww.simotime.com
@00000060 2A204E42 52545354 43322043 6F707972 ..+.........?.`. * NBRTSTC2 Copyr
@00000070 69676874 20313938 372D3230 31372020 ................ ight 1987-2017
@00000080 20205369 6D6F5469 6D652054 6563686E ...._?.._......>   SimoTime Techn
@00000090 6F6C6F67 69657320 20202020 416C6C20 ?%?..........%%. ologies     All
@000000A0 52696768 74732052 65736572 76656420 ................ Rights Reserved
@000000B0 2A204E42 52545354 43322054 68616E6B ..+........../>, * NBRTSTC2 Thank
@000000C0 20796F75 20666F72 20757369 6E672074 .`?...?.....>...  you for using t
@000000D0 68697320 70726F67 72616D20 70726F76 ......?../_...?. his program prov
@000000E0 69646564 2066726F 6D205369 6D6F5469 .......?_..._?.. ided from SimoTi
@000000F0 6D652054 6563686E 6F6C6F67 69657320 _......>?%?..... me Technologies
@00000100 2A204E42 52545354 43322050 6C656173 ..+........&%./. * NBRTSTC2 Pleas
@00000110 65207365 6E642061 6C6C2069 6E717569 ....>../%%..>... e send all inqui
@00000120 72657320 6F722073 75676765 7374696F ....?..........? res or suggestio
@00000130 6E732074 6F207468 65206865 6C706465 >...?.......%... ns to the helpde
@00000140 736B4073 696D6F74 696D652E 636F6D20 ., .._?.._...?_. sk@simotime.com
@00000150 50617274 2D312C20 20506172 742D3220 &/.......&/..... Part-1,  Part-2
@00000160 30303030 37393800 00123F00 00123F20 ................ 0000798...?...?
@00000170 30303730 30343030 34303136 30333220 ................ 007004004016032
@00000180 00000000 20202020 00010203 04050607 ................ ....    ........
@00000190 08090A0B 0C0D0E0F 30313233 34353637 ................ ........01234567
@000001A0 38394142 43444546 30302020 20202020 ................ 89ABCDEF00
@000001B0 30302020 20202020 20202020 20202020 ................ 00
@000001C0 20202020 20202020 20202020 20202020 ................
@000001D0 20202020 20202020 20202020 20202020 ................
@000001E0 20202020 20202020 5354534E 41502D43 ...........+.&..         STSNAP-C
@000001F0 45415345 2D544147 xxxxxxxx xxxxxxxx ................ EASE-TAG........
*

The preceding HEX-Dump is created by making a call to the SIMOSNAP program that is described in more detail in the "Ancillary Functions" section of this document.

Table of Contents Previous Section Next Section HEX-Dump of a Field

The following shows a HEX-Dump of a single field within the mainline program.

* Binary-Unsigned Numeric Field...
BNU-4-V-0 (DEC)----- 0000004671
BNU-4-V-0 (HEX)----- 0000123F
*
BNU-4-V-0 (DEC)----- 0000000010
BNU-4-V-0 (HEX)----- 0000000A

The preceding HEX-Dump is created by the "CONVERT-BYTE-TO-HEX-DISPLAY" segment of code that is included in the mainline program.

Table of Contents Previous Section Next Section Command File

The following (NBRTSTW2.cmd) is a Windows Command File that may be used to run this job on a Windows System with Micro Focus Enterprise Developer/Server.

@echo OFF
rem  * *******************************************************************
rem  *               NBRTSTW2.cmd - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2019 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text    - Content Analysis of Numeric Fields
rem  * Author  - SimoTime Technologies
rem  * Date    - November 11, 1989
rem  * Version - 03.12.15
rem  *
rem  * This program is used to show techniques for analyzing and
rem  * testing the content of numeric 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  * Step   1 of 2  Set the global environment variables...
rem  *
     set CmdName=NBRTSTW2
     call ..\Env1BASE %CmdName%
rem  *
     call SimoNOTE "*******************************************************%CmdName%.CMD"
     call SimoNOTE "Starting JobName %CmdName%.CMD"
rem  *
rem  * *******************************************************************
rem  * Step 1 of 1, Execute the Number Format Analysis Program...
rem  *
     run NBRTSTC2
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto :EojNOK
:EojAOK
     call SimoNOTE "SYSOUT=%SYSOUT%"
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNOK
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section JCL Member

The following (NBRTSTJ2.jcl) is the JCL Member needed to run this job with ZOS or Micro Focus Enterprise Developer/Server.

//NBRTSTJ2 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*          This job is provided by SimoTime Technologies            *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text    - Content Analysis of Numeric Fields
//* Author  - SimoTime Technologies
//* Date    - November 11, 1989
//* Version - 03.12.15
//*
//* This program is used to show techniques for analyzing and
//* testing the content of numeric fields.
//*
//* This technique provides a suite of COBOL programs that will run on
//* a Mainframe System with ZOS or a Linux, UNIX or Windows System
//* with Micro FOcus Enterprise Developer.
//*
//* *******************************************************************
//* Step 1 of 1, Execute the Number Format Analysis Program...
//*
//NBRTSTS1 EXEC PGM=NBRTSTC2
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section COBOL Mainline Program

The following (NBRTSTC2.cbl) is the COBOL program that shows the format and content of the numeric fields.

      *SET IBMCOMP NOTRUNC
       IDENTIFICATION DIVISION.
       PROGRAM-ID.    NBRTSTC2.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2019 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any non-commercial purpose and without fee is hereby      *
      * granted, provided the SimoTime copyright notice appear on all *
      * copies of the software. The SimoTime name or Logo may not be  *
      * used in any advertising or publicity pertaining to the use    *
      * of the software without the written permission of SimoTime    *
      * Technologies.                                                 *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software will be delivered and a    *
      * license will be granted for use within an enterprise,         *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used    *
      * in any advertising or publicity pertaining to the use of the  *
      * software without the written permission of SimoTime           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any expressed or implied warranty,   *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Technologies shall not be liable for any direct, indirect,    *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *****************************************************************
      * Source Member ... NBRTSTC2.cbl
      * Copy Files ...... STSNAPB1.cpy
      *                   STSNAPB2.cpy
      * Called Member ... SIMOSNAP.cbl
      *                   Copy Files ... HEXTABLE.cpy
      *****************************************************************
      *
      * NBRTSTC2 - Analyze a numeric field.
      *
      * DESCRIPTION
      * -----------
      * This program is used to show techniques for analyzing and
      * testing the content of numeric fields. Each byte within a
      * numeric field will be accessed using Reference Modification.
      *
      * The program shows the content of a field in HEX-Dump format.
      * Two techniques are used to produce HEX-Dump information.
      *   1. At the start and end of program execution a call is made
      *      to SIMOSNAP to dump the content of WORKING-STORAGE.
      *   2. A perform of the "CONVERT-BYTE-TO-HEX-DISPLAY" paragraph
      *      is used to dump the content of a single field.
      *
      * The COBOL programs are compiled with the ASSIGN(EXTERNAL)
      * directive. This provides for external file mapping of file
      * names.
      *
      * To run with Micro Focus the IBMCOMP and NOTRUNC directives
      * will be required to maintain compatability with the mainframe
      * format and field sizes for binary fields.
      *
      * This program will run on a  Windows System with Micro Focus
      * Enterprise Developer/Server.
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1996/03/15 Simmons, Created program.
      * 2016/09/01 Simmons, No changes to date.
      *
      *****************************************************************
      *
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       COPY STSNAPB1.
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05  T1 pic X(11) value '* NBRTSTC2 '.
           05  T2 pic X(34) value 'Content Analysis of Numeric Fields'.
           05  T3 pic X(10) value ' v11.12.04'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* NBRTSTC2 '.
           05  C2 pic X(20) value 'Copyright 1987-2019 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* NBRTSTC2 '.
           05  C2 pic X(32) value 'Thank you for using this program'.
           05  C3 pic X(32) value ' provided from SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* NBRTSTC2 '.
           05  C2 pic X(32) value 'Please send all inquires or sugg'.
           05  C3 pic X(32) value 'estions to the helpdesk@simotime'.
           05  C4 pic X(04) value '.com'.

      *****************************************************************
       01  STRINGS-01.
      *
      * ------------------------------------------------------------- *
      *    Alpha-Numeric Data, ENTCOBOL can use Reference Modification
      *                        The Data String may contain all text
      *                        characters or may contain embedded HEX
      *                        characters
      *                        When there is no explicit USAGE clause
      *                        the implied USAGE IS DISPLAY.
      *    Simple Text String
           05  TXT-X-016         pic X(16) value 'Part-1,  Part-2 '.

      *****************************************************************
       01  NUMBERS-01.
      *
      * ------------------------------------------------------------- *
      *    Numeric Data, With the ENTCOBOL dialect the use of Reference
      *                  Modification requires a field designated as
      *                  USAGE IS DISPLAY. Therefore, numeric fields
      *                  with a designation of USAGE IS COMPUTATIONAL
      *                  will require a redefinition of the field to
      *                  access individual bytes within the field.
      *
      * ------------------------------------------------------------- *
      *    Numeric Field, Zoned-Decimal-Unsigned (ZDU)
      *                   implied USAGE is DISPLAY
      *                   ENTCOBOL can use Reference Modification
           05  ZDU-5-V-2         pic 99999V99    value 7.98.
      *
      * ------------------------------------------------------------- *
      *    Numeric Field, BiNary-Unsigned (BNU)
      *                   explicit USAGE is COMP
      *                   ENTCOBOL cannot use Reference Modification
      *                   a REDEFINES is used to access individual
      *                   bytes via Reference Modification
           05  BNU-4-V-0         pic 9(7)        COMP    value 4671.
           05  BNU-4-V-0-R       redefines BNU-4-V-0
                                 pic X(4).
      *
      * ------------------------------------------------------------- *
      *    Numeric Field, PacKed-Unsigned (PKU)
      *                   explicit USAGE is COMP-3
      *                   ENTCOBOL cannot use Reference Modification
      *                   a REDEFINES is used to access individual
      *                   bytes via Reference Modification
           05  PKU-4-V-0         pic 9(7)        COMP-3  value 123.
           05  PKU-4-V-0-R       redefines PKU-4-V-0
                                 pic X(4).
      *
      * ------------------------------------------------------------- *
       01  LENGTHS-01.
           05  ZDU-5-V-2-L       pic 999         value 7.
           05  BNU-4-V-0-L       pic 999         value 4.
           05  PKU-4-V-0-L       pic 999         value 4.
           05  TXT-X-016-L       pic 999         value 16.
           05  DUMP-STRING-32-L  pic 999         value 32.
      *
      * ------------------------------------------------------------- *
      *    The following is used to convert a one-byte binary value
      *    to a two-byte text string of HEX-Dump information.
       01  BIN-4-G.
           05  FILLER          pic X     value LOW-VALUE.
           05  BIN-4-AXIS      pic 9(3)  comp  value 0.
           05  FILLER          pic X     value LOW-VALUE.
       01  BIN-4-G-R1          redefines BIN-4-G.
           05  BIN-4-WEST      pic 9(3)  comp.
           05  BIN-4-EAST      pic 9(3)  comp.

       01  TAB-BIN pic X(16) value x'000102030405060708090A0B0C0D0E0F'.
       01  TAB-TXT pic X(16) value  '0123456789ABCDEF'.

       01  IX-1                pic 99          value 0.
       01  IX-2                pic 99          value 0.
       01  ONE-BYTE            pic X           value SPACES.
       01  HEX-TEXT-2          pic XX          value SPACES.
       01  DUMP-STRING-32      pic X(32)       value SPACES.

        COPY STSNAPB2.

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

           perform Z-POST-COPYRIGHT-TO-SYSOUT
           display '*'
           call 'SIMOSNAP' using STSNAP-START STSNAP-CEASE

           perform ACTION-ZONED-DECIMAL-UNSIGNED

           perform ACTION-BINARY-UNSIGNED

           perform ACTION-PACKED-UNSIGNED

           perform ACTION-TEXT-STRING

           display '*'
           call 'SIMOSNAP' using STSNAP-START STSNAP-CEASE
           perform Z-THANK-YOU-TO-SYSOUT

           GOBACK.

      *****************************************************************
       ACTION-ZONED-DECIMAL-UNSIGNED.
           add length of ZDU-5-V-2 to ZERO giving ZDU-5-V-2-L
           perform DISPLAY-ZDU-TO-SYSOUT

           move 1 to ZDU-5-V-2(4:1)
           perform DISPLAY-ZDU-TO-SYSOUT

           move '2' to ZDU-5-V-2(3:1)
           perform DISPLAY-ZDU-TO-SYSOUT

           exit.

      *****************************************************************
       ACTION-BINARY-UNSIGNED.
      *    Calculate the length, Display the value in Decimal format
           add length of BNU-4-V-0 to ZERO giving BNU-4-V-0-L
           display '*'
           display '* Binary-Unsigned Numeric Field...'
           display 'BNU-4-V-0 (DEC)----- ' BNU-4-V-0

      *    Display the content in HEX-Dump format
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-2
           move SPACES to DUMP-STRING-32
           perform until IX-1 > BNU-4-V-0-L
                      or IX-2 > DUMP-STRING-32-L
             move BNU-4-V-0-R(IX-1:1) to ONE-BYTE
             perform CONVERT-BYTE-TO-HEX-DISPLAY
             move HEX-TEXT-2 to DUMP-STRING-32(IX-2:2)
             add 1 to IX-1
             add 2 to IX-2
           end-perform
           display 'BNU-4-V-0 (HEX)----- ' DUMP-STRING-32

      *    Change the value and display in Decimal format
           move x'00' to BNU-4-V-0-R(3:1)
           move x'0A' to BNU-4-V-0-R(4:1)
           display '*'
           display 'BNU-4-V-0 (DEC)----- ' BNU-4-V-0

      *    Display the changed content in HEX-Dump format
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-2
           move SPACES to DUMP-STRING-32
           perform until IX-1 > BNU-4-V-0-L
                      or IX-2 > DUMP-STRING-32-L
             move BNU-4-V-0-R(IX-1:1) to ONE-BYTE
             perform CONVERT-BYTE-TO-HEX-DISPLAY
             move HEX-TEXT-2 to DUMP-STRING-32(IX-2:2)
             add 1 to IX-1
             add 2 to IX-2
           end-perform
           display 'BNU-4-V-0 (HEX)----- ' DUMP-STRING-32
           exit.

      *****************************************************************
       ACTION-PACKED-UNSIGNED.
      *    Calculate the length, Display the value in Decimal format
           add length of PKU-4-V-0 to ZERO giving PKU-4-V-0-L
           display '*'
           display '* Packed-Unsigned Numeric Field...'
           display 'PKU-4-V-0 (DEC)----- ' PKU-4-V-0

      *    Display the content in HEX-Dump format
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-2
           move SPACES to DUMP-STRING-32
           perform until IX-1 > PKU-4-V-0-L
                      or IX-2 > DUMP-STRING-32-L
             move PKU-4-V-0-R(IX-1:1) to ONE-BYTE
             perform CONVERT-BYTE-TO-HEX-DISPLAY
             move HEX-TEXT-2 to DUMP-STRING-32(IX-2:2)
             add 1 to IX-1
             add 2 to IX-2
           end-perform
           display 'PKU-4-V-0 (HEX)----- ' DUMP-STRING-32

      *    Change the value and display in Decimal format
           move x'98' to PKU-4-V-0-R(1:1)
           move x'76' to PKU-4-V-0-R(2:1)
           display '*'
           display 'PKU-4-V-0 (DEC)----- ' PKU-4-V-0

      *    Display the changed content in HEX-Dump format
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-2
           move SPACES to DUMP-STRING-32
           perform until IX-1 > PKU-4-V-0-L
                      or IX-2 > DUMP-STRING-32-L
             move PKU-4-V-0-R(IX-1:1) to ONE-BYTE
             perform CONVERT-BYTE-TO-HEX-DISPLAY
             move HEX-TEXT-2 to DUMP-STRING-32(IX-2:2)
             add 1 to IX-1
             add 2 to IX-2
           end-perform
           display 'PKU-4-V-0 (HEX)----- ' DUMP-STRING-32

           exit.

      *****************************************************************
       ACTION-TEXT-STRING.
      *    Calculate the length, Display the content w/o embedded HEX
           add length of TXT-X-016 to ZERO giving TXT-X-016-L
           display '*'
           display '* Text String w/o HEX...'
           display 'TXT-X-016 (TXT)----- ' TXT-X-016

      *    Display the content in HEX-Dump format
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-2
           move SPACES to DUMP-STRING-32
           perform until IX-1 > TXT-X-016-L
                      or IX-2 > DUMP-STRING-32-L
             move TXT-X-016(IX-1:1) to ONE-BYTE
             perform CONVERT-BYTE-TO-HEX-DISPLAY
             move HEX-TEXT-2 to DUMP-STRING-32(IX-2:2)
             add 1 to IX-1
             add 2 to IX-2
           end-perform
           display 'TXT-X-016 (HEX)----- ' DUMP-STRING-32

      *    Change the content and display with embedded HEX
           move x'0509' to TXT-X-016(8:2)
           display '*'
           display 'TXT-X-016 (TXT)----- ' TXT-X-016

      *    Display the changed content in HEX-Dump format
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-2
           move SPACES to DUMP-STRING-32
           perform until IX-1 > TXT-X-016-L
                      or IX-2 > DUMP-STRING-32-L
             move TXT-X-016(IX-1:1) to ONE-BYTE
             perform CONVERT-BYTE-TO-HEX-DISPLAY
             move HEX-TEXT-2 to DUMP-STRING-32(IX-2:2)
             add 1 to IX-1
             add 2 to IX-2
           end-perform
           display 'TXT-X-016 (HEX)----- ' DUMP-STRING-32
           exit.

      *****************************************************************
       CONVERT-BYTE-TO-HEX-DISPLAY.
           move LOW-VALUES to BIN-4-G
           move ONE-BYTE to BIN-4-G(3:1)
           multiply 16 by BIN-4-AXIS giving BIN-4-AXIS
           divide BIN-4-EAST by 16 giving BIN-4-EAST
           inspect BIN-4-G(2:1) converting TAB-BIN to TAB-TXT
           inspect BIN-4-G(3:1) converting TAB-BIN to TAB-TXT
           move BIN-4-G(2:2) to HEX-TEXT-2
           exit.

      *****************************************************************
       DISPLAY-ZDU-TO-SYSOUT.
           display '*'
           display '* Zoned-Decimal-Unsigned Numeric Field...'
           display 'ZDU-5-V-2 ---------- ' ZDU-5-V-2
                   ' - Length=' ZDU-5-V-2-L
           display 'ZDU-5-V-2(1:1) ----- ' ZDU-5-V-2(1:1)
           display 'ZDU-5-V-2(2:1) ----- ' ZDU-5-V-2(2:1)
           display 'ZDU-5-V-2(3:1) ----- ' ZDU-5-V-2(3:1)
           display 'ZDU-5-V-2(4:1) ----- ' ZDU-5-V-2(4:1)
           display 'ZDU-5-V-2(5:1) ----- ' ZDU-5-V-2(5:1)
           display 'ZDU-5-V-2(6:1) ----- ' ZDU-5-V-2(6:1)
           display 'ZDU-5-V-2(7:1) ----- ' ZDU-5-V-2(7:1)
           exit.

      *****************************************************************
       Z-POST-COPYRIGHT-TO-SYSOUT.
           display SIM-TITLE
           display SIM-COPYRIGHT
           exit.

      *****************************************************************
       Z-THANK-YOU-TO-SYSOUT.
           display SIM-THANKS-01
           display SIM-THANKS-02
           exit.

      *****************************************************************
      *           This routine was generated by SimoREC1              *
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *  Generation Date: 2009/11/24  Generation Time: 12:08:01:28    *
      *****************************************************************

Table of Contents Previous Section Next Section Technical Details

This section provides additional details about the processing techniques and data structures used in this suite of programs.

Table of Contents Previous Section Next Section Convert One Byte to Two Bytes

The following describes the process for converting one-byte of possible binary data to a two-byte Hex-Dump text string. This example was executed in an ASCII-encoded environment. The following is dependent on the data structure definition for the BIN-4-G field.

1. move LOW-VALUES to BIN-4-G
1.1. This statement initializes BIN-4-G. This is a four (4) byte field defined as an 01 level group item.
1.2. X'00000000' - this is the content of BIN-4-G after the preceding statement is executed.
2. move ONE-BYTE to BIN-4-G(3:1)
2.1. This statement will move one-byte to the 3rd position in the BIN-4-G field. In this example the content of ONE-BYTE is X'3A'.
2.2. X'00003A00' - this is the content of BIN-4-G after the preceding statement is executed.
3. multiply 16 by BIN-4-AXIS giving BIN-4-AXIS
3.1. This statement will shift the content of BIN-4-AXIS to the left by 4 bits.
3.2. X'0003A000' - this is the content of BIN-4-G after the preceding statement is executed.
4. divide BIN-4-EAST by 16 giving BIN-4-EAST
4.1. This statement will shift the content of BIN-4-EAST to the right by 4 bits.
4.2. X'00030A00' - this is the content of BIN-4-G after the preceding statement is executed.
5. inspect BIN-4-G(2:1) converting TAB-BIN to TAB-TXT
5.1. This statement will convert a possible binary value located at the 2nd position of the BIN-4-G field to a display (or text) character.
5.2. X'00300A00' - this is the content of BIN-4-G after the preceding statement is executed.
6. inspect BIN-4-G(3:1) converting TAB-BIN to TAB-TXT
6.1. This statement will convert a possible binary value located at the 3rd position of the BIN-4-G field to a display (or text) character.
6.2. X'00304100' - this is the content of BIN-4-G after the preceding statement is executed.
7. move BIN-4-G(2:2) to HEX-TEXT-2
7.1. This statement will move the characters located at the 2nd and 3rd positions of the BIN-4-G field to the HEX-TEXT-2 field.
7.2. X'3041' - this is the content of HEX-TEXT-2 after the preceding statement is executed.

 

The preceding process is dependent on the following data structure definition.

      *
      * ------------------------------------------------------------- *
      *    The following is used to convert a one-byte binary value
      *    to a two-byte text string of HEX-Dump information.
       01  BIN-4-G.
           05  FILLER          pic X     value LOW-VALUE.
           05  BIN-4-AXIS      pic 9(3)  comp  value 0.
           05  FILLER          pic X     value LOW-VALUE.
       01  BIN-4-G-R1          redefines BIN-4-G.
           05  BIN-4-WEST      pic 9(3)  comp.
           05  BIN-4-EAST      pic 9(3)  comp.
      *

Table of Contents Previous Section Next Section Ancillary Functions

This section provides additional detail about the secondary CMD files and programs that are used in this set of sample programs.

Table of Contents Previous Section Next Section Set the Environment

A command file (ENV1BASE.cmd) located in the sub-directory named DEVL is called from other command files to set commonly used environment variables. This provides a single point of definition. The following is a listing of the contents of the command file.

@echo OFF
rem  * *******************************************************************
rem  *               ENV1BASE.cmd - a Windows Command File               *
rem  *        This program is provided by SimoTime Technologies          *
rem  *           (C) Copyright 1987-2021 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Provide a single point to set common environment variables.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * Set the commonly used environment variables. This is used to provide
rem  * a single point for managing the commonly used environment variables.
rem  *
     set SimoLIBR=c:\SimoLIBR
     set BASELIB1=c:\SIMOSAM1\DEVL
     set BASELIB8=c:\SimoSAM8
     set BaseWIP1=c:\SimoSAM1\WIP1
     set DATAZERO=c:\SIMODATA\DEVL\DATA\ZERO
     set BASEAPP=%BaseLib1%
     set BASESYS=%BaseLib1%\SYS1
     set BASECAT=%BaseLib1%\DATA
     set UMAPALIB=%BASECAT%\ASC1
     set UMAPELIB=%BASECAT%\EBC1
     set SYSLOG=%BASESYS%\LOGS\SYSLOG_USER.DAT
     set SYSOUT=%BASEAPP%\LOGS\SYSOUT_SIMSAM01.txt
     set SLZMSG=%BASEAPP%\LOGS\SLZMSG_USER.TXT
     set PostNOTE=%BASEAPP%\LOGS\JOBLOG_SIMONOTE.TXT
     set SIMONOTE=%BASEAPP%\LOGS\JOBLOG_SIMONOTE.txt
     set USERPOST=%BASEAPP%\LOGS\ASSIGNED_USER_POST_FILE.txt
     if [%1]==[] goto NO_POST
     set SYSOUT=%BaseLib1%\LOGS\SYSOUT_%1.txt
     call SIMONOTE "+ ENV1BASE *"
     call SIMONOTE "+ ENV1BASE ********************************************************************%1"
     call SIMONOTE "+ ENV1BASE is preparing the System Environment..."
     call SIMONOTE "+ SIMOLIBR is %SIMOLIBR%"
     call SIMONOTE "+ MIFOSYS1 is %MIFOSYS1%"
     call SIMONOTE "+ BASELIB1 is %BASELIB1%"
:NO_POST
     call SIMONOTE "+ SIMONOTE Job Log File is %SIMONOTE% "
rem  *
     set MQBASE=C:\Program Files\IBM\WebSphere MQ
rem  *
rem  * Set the location for the Apache-Tomcat Server...
     set CATALINA_HOME=C:\APACHETC\apache-tomcat-7.0.52
rem     set CATALINA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_112
rem  *
rem  * Set the Environment for the Java Environment...
rem     set JAVABASE=C:\APACHETC\apache-tomcat-7.0.52
     set JAVABASE=C:\Program Files (x86)\Java\jdk1.8.0_112
     set JAVASDK="%JAVABASE%\bin"
     set JAVA_HOME=%JAVABASE%
     set JRE_HOME=%JAVABASE%
     set SIMOTCAT=%CATALINA_HOME%\webapps\simotcat
     set SIMPACKS=%CATALINA_HOME%\webapps\simotcat\WEB-INF\classes\simpacks
rem  *
rem  * Set the environment for the Micro Focus technology...
     set MIFOEDEV=C:\Program Files (x86)\Micro Focus\Enterprise Developer
     set MIFOVCBL=C:\Program Files (x86)\Micro Focus\Visual COBOL Build Tools
     set MIFOESTU=C:\Program Files (x86)\Micro Focus\Studio Enterprise Edition 6.0
     set MIFOEMFE="C:\Program Files (x86)\Micro Focus\Mainframe Express"
rem  *
rem  * Large file support, performance tuning and record locking of the File Handler
     set EXTFH=%BASESYS%\CONFIG\EXTFHBIG.CFG
rem  *
rem  * For IMS Support
     set ES_IMSLIB=%BASEAPP%\IMSLIB
     set ES_ACBLIB=%BASEAPP%\IMSLIB
rem  *
rem  * EZASOKETS Check EZASOKETS Enabled box or set ES_EZASOKET_SUPPORT=YES
     set EZACONFG=BASESYS1\CONFIG\EZACONFG.dat
rem  *
rem  * Resource Allocation and Performance for SORT and non-Relational Data
rem  set MFJSENGINE=SYNCSORT
     set SORTSCHEME=1
     set SORTSPACE=750000000
     set TMP=C:\SORTWORK
rem  *
     set ES_ALLOC_OVERRIDE=%BASESYS%\CONFIG\CATMAPA1.cfg
rem  * For CORE_ON_ERROR function, ABEND Dump
rem  *     set COBCONFIG_=%BASESYS%\CONFIG\diagnose.cfg
rem  *
rem  * Consolidated Trace Facility (CTF)
rem  *     set MFTRACE_CONFIG=%BASESYS%\CONFIG\ctf.cfg
rem  *     set MFTRACE_LOGS=c:\ctflogs
rem  *
rem  * For Job Restart, ABEND Recovery
     set MF_UCC11=Y
     set ES_JES_RESTART=Y
rem  *
rem  * Set environment for MFBSI (Micro Focus Batch Scheduling Interface)
     set ES_EMP_EXIT_1=mfbsiemx
     set MFBSI_DIR=%BASESYS%\LOGS\%JESSERVERNAME%
     set MFBSIEOP_CMD=ENABLE
     set MFBSIEOP_CSV=ENABLE
     set MFBSIEOP_HTM=ENABLE
     set MFBSIEOP_XML=ENABLE
rem  *
rem  * Set Behavior and Trace Flags for GETJOBDD
rem  *   Position=12345678/12345678
     set JDDFLAGS=nnnWnnnn/YYnnnnnn
rem  *
rem  * If not already set then set the PATH for Micro Focus Directories
     if "%SIMOPATH%" == "Y" goto JUMPPATH
     if "%MIFOSYS1%" == "EDEV" goto JUMPEDEV
     if "%MIFOSYS1%" == "VCBL" goto JUMPVCBL
     if "%MIFOSYS1%" == "ESTU" goto JUMPESTU
     if "%MIFOSYS1%" == "EMFE" goto JUMPEMFE
:JUMPEDEV
     set path=%BASESYS%\LOADLIB;%MIFOEDEV%\bin;%JAVASDK%;%BASEAPP%\JAVA;%PATH%;
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOEDEV%\CPYLIB
     set MIFOBASE=%MIFOEDEV%
     goto JUMPPATH
:JUMPVCBL
     set path=%MIFOVCBL%\bin;%MIFOVCBL%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%;
     set MIFOBASE=%MIFOVCBL%
     goto JUMPPATH
:JUMPESTU
     set MIFOBASE=%MIFOESTU%\Base
     set MIFOBIN=%MIFOBASE%\bin
     set path=%BASESYS%\LOADLIB;%MIFOBASE%;%MIFOBIN%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%;
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE
     goto JUMPPATH
:JUMPEMFE
     set MIFOBASE=%MIFOEMFE%\Base
     set MIFOBIN=%MIFOBASE%\bin
     set path=%BASESYS%\LOADLIB;%MIFOBASE%;%MIFOBIN%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%;
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE
     goto JUMPPATH
rem  *
:JUMPPATH
     set SIMOPATH=Y
rem  *
     set MAINFRAME_FLOATING_POINT=true
     set COBIDY=%BASEAPP%\COBIDY
     set COBPATH=.;%BASEAPP%\LOADLIB;%BASEAPP%\LOADLIB\GNTS;%BASESYS%\LOADLIB;%SimoLIBR%
     set LIBPATH=.;%BASEAPP%\LOADLIB;%BASEAPP%\LOADLIB\GNTS;%BASESYS%\LOADLIB;%SimoLIBR%
     set TXDIR=%BASESYS%\LOADLIB;%MIFOBASE%
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%
rem  *
     set USERCLASS=%BASELIB1%\LOADLIB
     set CLASSPATH=.
     set CLASSPATH=%CLASSPATH%;%JAVABASE%
     set CLASSPATH=%CLASSPATH%;%JAVABASE%\lib
     set CLASSPATH=%CLASSPATH%;\%USERCLASS%\simpacks
     set CLASSPATH=%CLASSPATH%;C:\APACHETC\apache-tomcat-7.0.52\webapps\simotcat\WEB-INF\classes
     set CLASSPATH=%CLASSPATH%;C:\APACHETC\apache-tomcat-7.0.52\webapps\simotcat\WEB-INF\classes\simpacks
rem  *
     if "%MIFOSYS1%" == "ESTU" set CLASSPATH=%CLASSPATH%;%MIFOBIN%
     if "%MIFOSYS1%" == "EDEV" set CLASSPATH=%CLASSPATH%;%MIFOEDEV%
     if "%MIFOSYS1%" == "VCBL" set CLASSPATH=%CLASSPATH%;%MIFOVCBL%
     if "%MIFOSYS1%" == "VCBL" set CLASSPATH=%CLASSPATH%;%MIFOVCBL%\bin\mfcobol.jar
rem  *
     set JobStatus=0000
     call SIMONOTE "+ ENV1BASE is returning to caller"


Table of Contents Previous Section Next Section Display and Log Messages

The following is a listing of the contents of the (SIMONOTE.cmd) command file.

@echo OFF
rem  * *******************************************************************
rem  *               SIMONOTE.cmd - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *            (C) Copyright 1987-2019 All Rights Reserved            *
rem  *              Web Site URL:   http://www.simotime.com              *
rem  *                    e-mail:   helpdesk@simotime.com                *
rem  * *******************************************************************
rem  *
rem  * Text    - Display message on screen and write to a log file.
rem  * Author  - SimoTime Technologies
rem  *
rem  * This script may be called from other scripts and expects a single
rem  * parameter enclosed in double quotes. The double quotes will be
rem  * removed. Before writing to the log file a date and time stamp
rem  * will be inserted in front of the message text.
rem  *
rem  * Note: The tilde (~) removes leading/trailing double-quotes.
rem  *
if "%SimoNOTE%" == "" set SimoNOTE=c:\SimoLIBR\LOGS\SimoTime.LOG
echo %date% %time% %~1>> %SimoNOTE%
echo %~1

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

The following (SIMOSNAP.cbl) is the callable COBOL program that is used to dump the contents of memory and show the actual physical format of the numeric fields.

      *set dialect(MF) assign(external) nooptional-file
       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SIMOSNAP.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * SOURCE MODULE SIMOSNAP.CBL
      *****************************************************************
      * SIMOSNAP - Displays a message and does a GOBACK.
      *
      * DESCRIPTION
      * -----------
      * This program will display a message and force an ABEND with
      * a GOBACK or STOP RUN. The RETURN-CODE will be set to 16.
      *
      *****************************************************************
      * MAINTENANCE
      * -----------
      * 1999/03/89 Simmons, Created program.
      * 1999/03/89 Simmons, No changes to date.
      *
      *****************************************************************
       DATA DIVISION.
      *****************************************************************
       WORKING-STORAGE SECTION.
      *
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05  T1 pic X(11) value '* SIMOSNAP '.
           05  T2 pic X(34) value 'User callable memory dump routine' .
           05  T3 pic X(10) value ' v10.06.08'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* SIMOSNAP '.
           05  C2 pic X(20) value 'Copyright 1987-2019 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  FLAGS-FOR-SNAPCALL.
           05  FLAG-FOR-DISPLAY    pic X       value 'Y'.
           05  FLAG-FOR-JOURNAL    pic X       value 'Y'.
           05  FLAG-FOR-STACK      pic X       value 'N'.
           05  FLAG-FOR-KEEP-OPEN  pic X       value 'Y'.
      *                                        O=Offset
      *                                        F-Flip
      *                                        N=Native
           05  FLAG-FOR-ADDR-FMT   pic X       value 'O'.

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

      *    ------------------------------------------------------------
      *    Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* SIMOSNAP '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

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

       01  FIRST-TIME              pic X       value 'Y'.

       01  MESSAGE-LENGTH          pic 9(5)    value 1024.

       01  RMO-1                   pic 9(7)    value 0.

       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  PT-1           pic 9999 value 0.
       01  PT-2           pic 9999 value 0.

       01  MEM-ADDR-OFFSET         pic 9(7)    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  MEM-ADDRESS.
           05  MEM-ADDRESS-PTR usage POINTER.

       01  MEM-ADDR-G-OFFSET.
           05  MEM-ADDR-V-OFFSET   pic S9(9)   comp    value 0.

       01  SNAP-LINE.
           05  filler pic X(10)    value '@SimoSNAP '.
           05  filler pic X(24)    value 'by SimoTime Technologies'.
           05  filler pic X(45)    value all '*'.

       01  SNAP-LINE-02.
           05  filler pic X(10)    value '@SimoSNAP '.
           05  filler pic X(20)    value 'Dump Buffer Size is '.
           05  WS-MEMORY-LENGTH    pic 9(7)    value 0.

       01  DUMP-HEADER.
           05  filler pic X value '@'.
           05  H1 pic X(8)  value 'Hex-Addr'.
           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  D1 pic X(8)  value 'aaaaaaaa'.
           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  X1 pic X(8)  value 'aaaaaaaa'.
           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 '................'.

       COPY HEXTABLE.

      *    ------------------------------------------------------------
      *    Uses COMP-5 for "Little Endian" format.
       01  STSNAP-START-X.
           05  STSNAP-START-PTR   usage pointer.
       01  STSNAP-START-5         redefines STSNAP-START-X.
           05  STSNAP-START-CP5   pic S9(5)   COMP-5.

       01  STSNAP-CEASE-X.
           05  STSNAP-CEASE-PTR   usage pointer.
       01  STSNAP-CEASE-5         redefines STSNAP-CEASE-X.
           05  STSNAP-CEASE-CP5   pic S9(5)   COMP-5.

      *****************************************************************
       LINKAGE SECTION.
       01  STSNAP-START   pic X(16).
       01  STSNAP-CEASE   pic X(16).

      *****************************************************************
       PROCEDURE DIVISION using STSNAP-START STSNAP-CEASE.

           move SIM-TITLE to MESSAGE-BUFFER
           perform Z-DISPLAY-MESSAGE-BUFFER
           move SIM-COPYRIGHT to MESSAGE-BUFFER
           perform Z-DISPLAY-MESSAGE-BUFFER

           evaluate FLAG-FOR-ADDR-FMT
             when 'F'      move 'Hex-Addr' to H1
             when 'O'      move 'Hex-Disp' to H1
             when 'N'      move 'Hex-Addr' to H1
             when other    move 'Hex-Addr' to H1
           end-evaluate

           move SNAP-LINE to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT-79.

           if  STSNAP-START(1:16) not = 'STSNAP-START-TAG'
           or  STSNAP-CEASE(1:16) not = 'STSNAP-CEASE-TAG'
               move '@SimoSNAP has received an invalid request'
               to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT-79
               GOBACK
           end-if.

           set STSNAP-START-PTR to address of STSNAP-START
           set STSNAP-CEASE-PTR to address of STSNAP-CEASE

           subtract STSNAP-START-CP5 from STSNAP-CEASE-CP5
           giving WS-MEMORY-LENGTH
           add 16 to WS-MEMORY-LENGTH

           move SNAP-LINE-02 to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT-79.

           move DUMP-HEADER to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT-79

           perform DUMP-PROCESSING

           GOBACK.

      *****************************************************************
       DUMP-PROCESSING.
           add 1 to ZERO giving IX-0
           add 1 to ZERO giving IX-1
           add 1 to ZERO giving IX-5
           add WS-MEMORY-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
           set MEM-ADDRESS-PTR to address of STSNAP-START
           move ZERO to MEM-ADDR-V-OFFSET
           perform until BUFFER-LENGTH = 0
               add 1  to ZERO giving PT-1
               evaluate FLAG-FOR-ADDR-FMT
                 when 'F'      add 7 to ZERO giving PT-2
                 when 'O'      add 1 to ZERO giving PT-2
                 when 'N'      add 1 to ZERO giving PT-2
                 when other    add 1 to ZERO giving PT-2
               end-evaluate
               add 1  to ZERO giving IX-4
               move X-DUMP-LINE to DUMP-LINE
               perform 4 times
                 subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
                 evaluate FLAG-FOR-ADDR-FMT
                   when 'F'    move MEM-ADDRESS(PT-1:1) to TWO-BYTES-02
                   when 'O'    move MEM-ADDR-G-OFFSET(PT-1:1)
                                 to TWO-BYTES-02
                   when 'N'    move MEM-ADDRESS(PT-1:1) to TWO-BYTES-02
                   when other  move MEM-ADDRESS(PT-1:1) to TWO-BYTES-02
                 end-evaluate
                 add TWO-BYTES-BINARY to 1 giving IX-5
                 move TAB-X1(IX-5) to WA-5
                 move WA-5(1:2) to D1(PT-2:2)
                 add 1 to PT-1
                 evaluate FLAG-FOR-ADDR-FMT
                   when 'F'      subtract 2 from PT-2
                   when 'O'      add 2 to PT-2
                   when 'N'      add 2 to PT-2
                   when other    add 2 to PT-2
                 end-evaluate
               end-perform

               add 1  to ZERO giving IX-2
               add 1  to ZERO giving IX-3
               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
               set MEM-ADDRESS-PTR up by 16
                 evaluate FLAG-FOR-ADDR-FMT
                   when 'F'    set MEM-ADDRESS-PTR up by 16
                   when 'O'    add 16 to MEM-ADDR-V-OFFSET
                   when 'N'    set MEM-ADDRESS-PTR up by 16
                   when other  set MEM-ADDRESS-PTR up by 16
                 end-evaluate
           end-perform
           exit.

      *****************************************************************
       DUMP-SINGLE-LINE.
           perform until LINE-LENGTH = 0
      *        Get table element
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move STSNAP-START(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 MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT-79
           exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-BUFFER.
           if  MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.
      *---------------------------------------------------------------*
       Z-DISPLAY-MESSAGE-TEXT-79.
           display MESSAGE-TEXT(1:79)
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      *      This example is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Note: The SIMOSNAP routine is part of the SIMOMODS software package that is available from SimoTime.

Table of Contents Previous Section Next Section Summary

This document (with sample programs) describes the internal format of the COMP, COMP-3 and COMP-5 numeric fields. This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.

In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.

SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the  Contact or Feedback  section of this document.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.

SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

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

Link to Internet   Link to Server   Explore the Numbers Connection for additional information about the structure and processing of numeric data items (or numeric fields).

Link to Internet   Link to Server   Explore The Binary or COMP format for numeric data strings. This numeric structure is supported by COBOL and may be explicitly defined with the "USAGE IS COMP" or "USAGE IS BINARY" clause.

Link to Internet   Link to Server   Explore The Edited for Display format for numeric data strings. This numeric structure is supported by COBOL and may be used with an edit-mask to prepare the presentation for readability by human beings.

Link to Internet   Link to Server   Explore The Packed-Decimal or COMP-3 format for numeric data strings. This numeric structure is supported by COBOL and may be explicitly defined with the "USAGE IS COMP-3" clause.

Link to Internet   Link to Server   Explore The Zoned-Decimal format for numeric data strings. This numeric structure is the default numeric for COBOL and may be explicitly defined with the "USAGE IS DISPLAY" clause.

Link to Internet   Link to Server   Explore the Compiler Directives available for the Micro Focus COBOL technologies.

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

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

Link to Internet   Link to Server   Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe System were copied and deployed in a Microsoft Windows environment with Micro Focus Enterprise Server.

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

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

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

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

Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Contact or Feedback

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

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

 

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Content Analysis, Numeric Fields
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com