| Numbers and Formats Numeric Structures for a Mainframe |  | 
| The SimoTime Home Page | 
 
           
           Introduction
          Introduction
  This document is an introduction to the various numeric formats used by COBOL and the IBM mainframe systems. The session will describe three of the popular numeric formats used with COBOL and IBM Mainframe systems. The discussions include further detail about the issues and concerns of unsigned (or implied positive) numbers, signed (positive or negative) numbers and decimal or whole numbers. A sample of how to convert non-print formats to display or print formats is included along with a sample COBOL program.
The sample COBOL source code that is used in this session may be compiled and executed using Micro Focus COBOL (this includes Mainframe Express or Net Express). Since the sample COBOL source code is COBOL/2 compliant it may be compiled and executed on a mainframe (either z/OS or VSE). For this exercise only the Windows operating system with Micro Focus COBOL will be used. A JCL member is included for ease of execution for the Mainframe or with Micro Focus Mainframe Express. A Windows command file (.CMD) is included for ease of execution for the Micro Focus Net Express sub-system running under Windows.
To perform this exercise requires a basic knowledge of the Windows environment and Micro Focus Net Express (the COBOL sample program will also work with Mainframe Express and may be compiled and executed on an IBM Mainframe). Additional help is provided for individuals that may not be proficient in the use of Micro Focus or have forgotten how to perform a particular function.
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
 
           
           Program Objectives
          Program Objectives
  The objective of this session is to assist the user in developing a basic understanding of the most common numeric encoding formats used on an IBM Mainframe and how to migrate or export this information to a Windows platform.
| 
 | ||||||||||
| Program Objectives for Discussion of Numeric Data Strings | 
 
           
           Requirements
          Requirements
  If this session is being performed through self-study then it will be necessary to install the following software on a Windows system. Windows/XP, Windows/7 or Windows Server is preferred.
| 
 | ||||||||
| Requirements for Operating System and Other Software | 
Note: This example uses two of the shared modules that are included in the SimoMODS package of programs. The SimoDUMP and SIMOLOGS programs may be compiled with a Micro Focus dialect and the SYSLOG references in the JCL member will be ignored. The mapping of the SYSLOG will be dependent on a SYSLOG environment variable setting.
 
           
           Materials Provided
          Materials Provided
  The NUMBER01.ZIP file and the c:\SimoLIBR directory are provided and contain the following information.
| 
 | ||||||
| Materials Available from SimoTime | 
 
           
           Expected Results
          Expected Results
  The following items must be completed to meet the minimum requirements for successfully completing this session.
| 
 | ||||||||
| Expected Results of Executing the Sample Programs | 
 
           
           Numeric Field Formats
          Numeric Field Formats
  This session will describe three popular numeric formats used with COBOL and/or the IBM Mainframe. Included is a sample COBOL program describing how to convert non-print formats to display or print formats.
| Numeric Field Type | Coding Syntax | Normally Coded (Minimum) | 
| Binary (alternate coding technique) | USAGE IS COMPUTATIONAL USAGE IS BINARY | COMP BINARY | 
| Packed Decimal | USAGE IS COMPUTATIONAL-3 | COMP-3 | 
| Zoned Decimal | USAGE IS DISPLAY | Left blank, this is the default | 
The following is an example of actual COBOL source code.
      *    The following two lines show the syntax for a binary field,
      *    1st line is full syntax, 2nd line is normally coded syntax.
       01  NUMERIC-BINARY-FULL  PIC S9(5)V99 USAGE IS COMPUTATIONAL.
       01  NUMERIC-BINARY-NORM  PIC S9(5)V99 COMP.
      *    The following two lines show the syntax for a packed field,
      *    1st line is full syntax, 2nd line is normally coded syntax.
       01  NUMERIC-PACKED-FULL  PIC S9(5)V99 USAGE IS COMPUTATIONAL-3.
       01  NUMERIC-PACKED-NORM  PIC S9(5)V99 COMP-3.
      *    The following two lines show the syntax for a zoned field,
      *    1st line is full syntax, 2nd line is normally coded syntax.
       01  NUMERIC-ZONED-FULL   PIC S9(5)V99 USAGE IS DISPLAY.
       01  NUMERIC-ZONED-NORM   PIC S9(5)V99.
  
   
           
           Zoned Decimal Format
          Zoned Decimal Format
  The unsigned, zone decimal fields are text fields and are assumed to be a simple, no risk conversion. However, during an EBCDIC to ASCII conversion it is a good practice to treat unsigned fields as signed since it is possible for a signed, zone-decimal value to end up in an unsigned field. As long as it is a positive value the mainframe will process the field.
 
           
           Unsigned
          Unsigned
  If we take a five digit number (00123) and look at how it is stored in memory as an UNSIGNED, ZONED-DECIMAL number. It will be different for EBCDIC-encoding and ASCII-encoding.
For EBCDIC-encoding the five digit number (00123) is represented as x'F0F0F1F2F3'. If this number is printed or displayed it will appear as "00123". The following is the memory dump of the EBCDIC-encoded number.
* ZONED... ******************************************************************** * ZONED... Zoned-Decimal, Unsign, USAGE IS DISPLAY * ZONED... Starting... Length = 0005 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 F0F0F1F2 F3xxxxxx xxxxxxxx xxxxxxxx 00123........... ................ * ZONED... Complete... Length = 0005
For ASCII-encoding the five digit number (00123) is represented as x'3030313233'. If this number is printed or displayed it will appear as "00123". The following is the memory dump of the ASCII-encoded number.
* ZONED... ******************************************************************** * ZONED... Zoned-Decimal, Unsign, USAGE IS DISPLAY * ZONED... Starting... Length = 0005 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 30303132 33xxxxxx xxxxxxxx xxxxxxxx ................ 00123........... * ZONED... Complete... Length = 0005
 
           
           Signed, Positive
          Signed, Positive
  If we take a five digit positive number (+00123) and look at how it is stored in memory as a SIGNED, ZONED-DECIMAL number. It will be different for EBCDIC-encoding and ASCII-encoding.
For EBCDIC-encoding the five digit positive number (+00123) is represented as x'F0F0F1F2C3'. If the number is printed or displayed it will appear as "0012C" and the editing effort to properly display or print has caused headaches for programmers for years. The following is the memory dump of the EBCDIC-encoded positive number.
* ZONED... Zoned-Decimal, Signed, Positive, USAGE IS DISPLAY * ZONED... Starting... Length = 0005 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 F0F0F1F2 C3xxxxxx xxxxxxxx xxxxxxxx 0012C........... ................ * ZONED... Complete... Length = 0005
For ASCII-encoding the five digit positive number (+00123) is represented as x'3030313233'. If this number is printed or displayed it will appear as "00123". The following is the memory dump of the ASCII-encoded positive number.
* ZONED... Zoned-Decimal, Signed, Positive, USAGE IS DISPLAY * ZONED... Starting... Length = 0005 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 30303132 33xxxxxx xxxxxxxx xxxxxxxx ................ 00123........... * ZONED... Complete... Length = 0005
 
           
           Signed, Negative
          Signed, Negative
  If we take a five digit negative number (-00123) and look at how it is stored in memory as a SIGNED, ZONED-DECIMAL number.
For EBCDIC-encoding the five digit negative number (-00123) is represented as x'F0F0F1F2D3'. If the number is printed or displayed it will appear as "0012L" and this has caused headaches for programmer to correct. The following is the memory dump of the EBCDIC-encoded negative number.
* ZONED... Zoned-Decimal, Signed, Negative, USAGE IS DISPLAY * ZONED... Starting... Length = 0005 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 F0F0F1F2 D3xxxxxx xxxxxxxx xxxxxxxx 0012L........... ................ * ZONED... Complete... Length = 0005
For ASCII-encoding (using Micro Focus) the five digit negative number (-00123) is represented as x'3030313273'. If this number is printed or displayed it will appear as "0012s". The following is the memory dump of the ASCII-encoded negative number.
* ZONED... Zoned-Decimal, Signed, Negative, USAGE IS DISPLAY * ZONED... Starting... Length = 0005 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 30303132 73xxxxxx xxxxxxxx xxxxxxxx ................ 0012s........... * ZONED... Complete... Length = 0005
 
           
           Advantages and Disadvantages
          Advantages and Disadvantages
  The advantages of the Zoned Decimal numeric format are as follows.
| 
 | ||||||||
| Advantages of Zoned Decimal Numeric Structure | 
The disadvantages of the Zoned Decimal numeric format are as follows.
| 
 | ||||||||
| Disadvantages of Zoned Decimal Numeric Structure | 
The Zoned-Decimal format is supported on the mainframe and with Micro Focus COBOL.
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.
 
           
           Packed Decimal (or COMP-3)
          Packed Decimal (or COMP-3)
  Packed-decimal fields provided a way to store numeric fields or data strings using less memory or machine readable storage. For Example, a five digit value can be stored in three bytes.
 
           
           Unsigned
          Unsigned
  If we take a five digit implied, positive number (00123) and look at how it is stored in memory as an UNSIGNED, PACKED-DECIMAL number. It will be the same for EBCDIC-encoding and ASCII-encoding (using Micro Focus). The three bytes in memory will be x'00123F'. A numeric value stored in this format will need to be converted (or edited) prior to printing or displaying.
* PACKED.. ******************************************************************** * PACKED.. Packed-Decimal, Unsign, USAGE IS COMP-3 * PACKED.. Starting... Length = 0003 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 00123Fxx xxxxxxxx xxxxxxxx xxxxxxxx ................ ..?............. * PACKED.. Complete... Length = 0003
 
           
           Signed, Positive
          Signed, Positive
  If we take a five digit positive number (00123) and look at how it is stored in memory as an SIGNED, PACKED-DECIMAL number. It will be the same for EBCDIC-encoding and ASCII-encoding. The three bytes in memory will be x'00123C'. A numeric value stored in this format will need to be converted (or edited) prior to printing or displaying.
* PACKED.. Packed-Decimal, Signed, Positive, USAGE IS COMP-3 * PACKED.. Starting... Length = 0003 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 00123Cxx xxxxxxxx xxxxxxxx xxxxxxxx ................ ..<............. * PACKED.. Complete... Length = 0003
 
           
           Signed, Negative
          Signed, Negative
  If we take a five digit negative number (00123) and look at how it is stored in memory as an SIGNED, PACKED-DECIMAL number. It will be the same for EBCDIC-encoding and ASCII-encoding. The three bytes in memory will be x'00123D'. A numeric value stored in this format will need to be converted (or edited) prior to printing or displaying.
* PACKED.. Packed-Decimal, Signed, Negative, USAGE IS COMP-3 * PACKED.. Starting... Length = 0003 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 00123Dxx xxxxxxxx xxxxxxxx xxxxxxxx ................ ..=............. * PACKED.. Complete... Length = 0003
 
           
           Advantages and Disadvantages
          Advantages and Disadvantages
  The advantages of the Packed Decimal numeric format are as follows.
| 
 | ||||||||
| Advantages of Packed Decimal Numeric Structure | 
The disadvantages of the Packed Decimal numeric format are as follows.
| 
 | ||||||
| Disadvantages of Packed Decimal Numeric Structure | 
The Packed-Decimal format is supported on the mainframe and with Micro Focus COBOL.
Explore The Packed-Decimal format for numeric data strings. This numeric structure is supported by COBOL and may be explicitly defined with the "USAGE IS COMP-3" clause.
 
           
           Binary (or COMP)
          Binary (or COMP)
  Binary fields provide a very efficient way to store numeric fields or data strings in memory or on machine readable storage. On a mainframe this is one of the most efficient ways to do arithmetic calculations and are maintained as 2, 4 or 8 byte fields or data strings (2 bytes is a half-word, 4 bytes is a word or full-word and 8 bytes is a double-word).
It is important to note that many non-mainframe systems allow a binary field to have any length. This will cause a problem when the information is stored in files. Micro Focus provides directives to support the mainframe format for binary fields. Refer to the Micro Focus documentation for more information about the IBMCOMP and NOTRUNC directives.
For Binary fields (or numeric data strings) the byte-order of the high and low order digits must be considered. The terms used to refer to the byte order are "Big Endian" and "Little Endian". The term "Big Endian" is used when the high-order byte of the number is stored in memory at the lowest address, and the low-order byte at the highest address. The term "Little Endian" is used when the low-order byte of the number is stored in memory at the lowest address, and the high-order byte at the highest address. The Mainframe and Micro Focus COBOL uses "Big Endian" for COMP fields. The byte order may become a concern when exporting files with binary fields to a non-mainframe and non-COBOL environment.
 
           
           Unsigned
          Unsigned
  If we take a five digit implied, positive number (00123) and look at how it is stored in memory as an UNSIGNED, BINARY number. It will be the same for EBCDIC-encoding and ASCII-encoding if the IBMCOMP and NOTRUNC directives are used with the Micro Focus COBOL compiler. The four bytes in memory will be x'0000007B'. A numeric value stored in this format will need to be converted (or edited) prior to printing or displaying.
 * BINARY.. ********************************************************************
 * BINARY.. Binary Format, No Sign, USAGE IS COMP
 * BINARY.. Starting... Length = 0004
 *  Offset Hex..... ........ ........ ........ ebcdic.......... ascii...........
 *   1-016 0000007B xxxxxxxx xxxxxxxx xxxxxxxx ...#............ ...{............
 * BINARY.. Complete... Length = 0004
  
   
           
           Signed, Positive
          Signed, Positive
  If we take a five digit positive number (+00123) and look at how it is stored in memory as a SIGNED, BINARY number. It will be the same for EBCDIC-encoding and ASCII-encoding. The four bytes in memory will be x'0000007B'. A numeric value stored in this format will need to be converted (or edited) prior to printing or displaying.
 * BINARY.. Binary Format, Positive, USAGE IS COMP
 * BINARY.. Starting... Length = 0004
 *  Offset Hex..... ........ ........ ........ ebcdic.......... ascii...........
 *   1-016 0000007B xxxxxxxx xxxxxxxx xxxxxxxx ...#............ ...{............
 * BINARY.. Complete... Length = 0004
  
   
           
           Signed, Negative
          Signed, Negative
  If we take a five digit negative number (-00123) and look at how it is stored in memory as a SIGNED, BINARY number. It will be the same for EBCDIC-encoding and ASCII-encoding. The four bytes in memory will be x'FFFFFF85'. A numeric value stored in this format will need to be converted (or edited) prior to printing or displaying.
* BINARY.. Binary Format, Negative, USAGE IS COMP * BINARY.. Starting... Length = 0004 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 FFFFFF85 xxxxxxxx xxxxxxxx xxxxxxxx ...e............ ................ * BINARY.. Complete... Length = 0004
 
           
           Advantages and Disadvantages
          Advantages and Disadvantages
  The advantages of the Binary or COMP numeric format are as follows.
| 
 | ||||||
| Advantages of Binary or COMP Numeric Structure | 
The disadvantages of the Binary or COMP numeric format are as follows.
| 
 | ||||||||
| Disadvantages of Binary or COMP Numeric Structure | 
The binary format is supported on the mainframe and with Micro Focus COBOL using the IBMCOMP and NOTRUNC compiler directives. It is important to note that an unsigned (or implied positive) field may contain a larger positive number than a signed field. For example, a 2-byte, unsigned binary field could contain values from 0 to 65535. If a 2-byte field were defined as a signed binary field it could contain values from -32767 to +32767 since the high-order bit is used as the sign.
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.
 
           
           Convert Packed-Decimal Format
          Convert Packed-Decimal Format
  This section describes how to convert the previously discussed packed-decimal formats into text strings to print or display the information in a human readable form. Before converting the packed-decimal fields it should be determined if a conversion is necessary. The following list provides some basic guidelines.
| 
 | ||||||||||
| Basic Guidelines for Converting Numeric Structures | 
 
           
           Convert to Display Format
          Convert to Display Format
  This section describes how to convert a packed-decimal field (i.e. PIC S9(5) USAGE IS COMPUTATIONAL) to a zoned-decimal field (i.e. PIC S9(5) USAGE IS DISPLAY SIGN LEADING SEPARATE). The resulting field will have a separate leading sign but will still have an implied decimal based on the field definition from the COBOL picture clause.
       WORKING-STORAGE SECTION.
       01  TEXT-PACKED-DECIMAL-SIGN.
           05  SIGN-PACKED-DECIMAL pic S9(5) COMP-3 value 123.
...
       01  TEXT-SIGN-LEAD-SEPARATE.
           05  SIGN-LEAD-SEPARATE  pic S9(5) SIGN LEADING SEPARATE
                                   value 0.
...
...
       PROCEDURE DIVISION.
           add SIGN-PACKED-DECIMAL to ZERO giving SIGN-LEAD-SEPARATE
...
With the preceding example the contents of all the fields will contain the arithmetic value of +00123 after the conversion. The SIGN-PACKED-DECIMAL contains x'00123F'. After the conversion the contents of SIGN-LEAD-SEPARATE will contain x'4EF0F0F1F2F3' for EBCDIC or x'2B3030313233' for ASCII.
 
           
           Convert to Display with Explicit Decimal
          Convert to Display with Explicit Decimal
  This section describes how to convert a packed-decimal field (i.e. PIC S9(5) USAGE IS COMPUTATIONAL-3) to a zoned-decimal field (i.e. PIC Z ). The resulting field will have a separate leading sign and an explicit decimal point embedded in text string. This field (or data string) may easily be exported to a non-COBOL environment.
       WORKING-STORAGE SECTION.
      *    The following defines a signed, packed-decimal field.
      *    The length of this field is 5 bytes.
       01  PACK-DECIMAL-S3V2-TEXT.
           05  PACK-DECIMAL-S3V2   pic S9(3)V99 COMP-3 value 0.
      *    The following defines an edited field for numeric
      *    values and will contain an explicit decimal point. This
      *    is standard COBOL coding and is ANSI/85 compliant.
      *    The length of this field is 6 bytes.
       01  PRINT-LINE.
           05  FILLER              pic X(8) value 'Edited: '.
           05  PRINT-NUMBER        pic +ZZZ.99.
...
...
       PROCEDURE DIVISION.
      *    The following statement will place a value into the
      *    packed-decimal field. The actual value will be x'00123C'.
           add 1.23 to ZERO giving PACK-DECIMAL-S3V2
      *    The following statement will place the arithmetic value of
      *    the packed-decimal field into the edited print field. The
      *    actual value will be x'4E4040F14BF2F3'. This results in
      *    converting the packed-decimal field but has leading spaces.
           move PACK-DECIMAL-S3V2 to PRINT-NUMBER
      *    The following statement will replace the leading spaces
      *    with zeroes. The resulting value will be x'4EF0F0F14BF2F3'.
           inspect PRINT-NUMBER replacing all SPACE by ZERO
  
   
           
           Impact of EBCDIC & ASCII Encoding
          Impact of EBCDIC & ASCII Encoding
  The packed-decimal format is supported by Micro Focus COBOL for the Windows, UNIX and Linux environments. Micro Focus supports both the EBCDIC-encoding and ASCII-encoding (referred to as CHARSET"EBCDIC" and CHARSET"ASCII" compiler directives). The packed decimal format in the Micro Focus environment is the same for both EBCDIC and ASCII. However, it is possible to initialize a Packed Decimal field with space characters. This is considered a bad programming practice and should be avoided. Since a space character is a x'40' for EBCDIC and an x'20' for ASCII this could be problematic when converting between the two encoding schemas.
 
           
           A Sample JCL Member
          A Sample JCL Member
  The following (NUMBERJ1.jcl) is the source listing for the sample JCL member used in this exercise. The JCL member may be used to execute the sample program on an IBM Mainframe or a Windows Systems using Micro Focus Mainframe Express or Enterprise Server with the Mainframe Transaction Option (ES/MTO). and the Batch Facility.
//NUMBERJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program 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 - COBOL and Commonly User Numeric Formats //* Author - SimoTime Technologies //* Date - November 11, 2003 //* Version - 06.03.22 //* //* This set of programs illustrates the use of some of the commonly //* used numeric formats. It will show actual hex-dump content of //* the fields along with the field length for the display format //* (actual digits), the packed format (COMP-3) and the binary (COMP) //* formats. //* //* When running with Net Express the IBMCOMP an NOTRUNC directives //* will be required to maintain compatability with the mainframe //* format and field sizes for binary fields. //* //* This technique provides for the use of a single set of COBOL //* source programs that will run on OS/390, Windows or UNIX. //* //* This set of programs will run on a Personal Computer with Windows //* and Micro Focus Mainframe Express or a Mainframe with OS/390. //* //* Note: if all three COBOL programs are compiled with a mainframe //* dialect then the following JCL will work as expected. //* //* In some non-mainframe environments it may be a requirement to //* call the SIMODUMP and SIMOLOGS programs from programs that may //* be compiled in a mainframe or non-mainframe dialect. //* //* The SimoDUMP and SIMOLOGS programs may be compiled with a //* Micro Focus dialect and the SYSLOG references in this JCL member //* will be ignored. The mapping of the SYSLOG will be dependent on //* a SYSLOG environment variable setting. //* //* ************ //* * NUMBERJ1 * //* ********jcl* //* * //* ************ //* * SIMOEXEC * //* ********exe* //* * //* * //* * //* ************ ************ //* * NUMBERC1 ******* SIMODUMP * //* ********cbl* ********cbl* //* * * //* * ************ ************ //* * * SIMOLOGS ******* CONSOLE * //* * ********cbl* * ************ //* * * //* ************ * ************ //* * EOJ * **** SYSLOG * //* ************ *******data* //* //* ******************************************************************* //* Step-1 This job step will delete a previously created //* hex-dump file. //* //SYSLOGDT EXEC PGM=IEFBR14 //SYSLOG DD DSN=SIMOTIME.DATA.SYSLOG,DISP=(MOD,DELETE,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=V,LRECL=1055,DSORG=PS) //* //* ******************************************************************* //* STEP-2 Allocate a new SYSLOG file. //* Note: The LRECL is four (4) bytes bigger than the logical record //* that is defined in the program that writes to SYSLOG. This //* allows for the four (4) byte Record Descriptor Word (RDW) //* that is appended to the front of each record. The program //* defines the records as varying in size from 64 to 1,051. //* Note: It is necessary to pre-allocate the SYSLOG file. The program //* that does the actual file compare will do an "OPEN EXTEND". //* If the file is not pre-allocated, an open error will be //* posted and the program will execute but will only display //* truncated information to SYSOUT. //SYSLOGCT EXEC PGM=IEFBR14 //SYSLOG DD DSN=SIMOTIME.DATA.SYSLOG,DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=V,LRECL=1055,DSORG=PS) //* //* ******************************************************************* //* Step-3 Execute the program. //* //NUMBERX1 EXEC PGM=NUMBERC1,PARM='SYSOUT(BOTH)' //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //* The following DD statement is for the logging file. //SYSLOG DD DSN=SIMOTIME.DATA.SYSLOG,DISP=SHR //SYSOUT DD SYSOUT=* //*
 
           
           A Sample CMD (or Command) File
          A Sample CMD (or Command) File
  The following (NUMBERE1.cmd) is the source member for the sample command file. The command file may be used to execute the sample program on a Windows system using Micro Focus Net Express.
@echo OFF
rem  * *******************************************************************
rem  *               NUMBERE1.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    - Driver for COBOL and Commonly User Numeric Formats
rem  * Author  - SimoTime Technologies
rem  * Date    - November 11, 2003
rem  * Version - 03.12.15
rem  *
rem  * *******************************************************************
rem  * Step   1 of 2  Set the environment variables...
rem  *
     call ..\Env1BASE
     set CmdName=NUMBERE1
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%"
rem  * *******************************************************************
rem  * Step   2 of 2  Execute the Number Format Analysis Program...
rem  *
     run NUMBERC1
rem  *
     call SimoNOTE "Finished JobName %CmdName%"
:End
     call SimoNOTE "Conclude SysLog is %SYSLOG%"
     if not "%1" == "nopause" pause
  
   
           
           A Sample COBOL Program
          A Sample COBOL Program
  The following (NUMBERC1.cbl) is the source member for the sample COBOL program.
       IDENTIFICATION DIVISION.
       PROGRAM-ID.    NUMBERC1.
       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  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: NUMBERC1.CBL
      *****************************************************************
      *
      * NUMBERC1 - Numeric formats for COBOL.
      *
      * DESCRIPTION
      * -----------
      * This set of programs is used to show the various numeric
      * format used by the COBOL Program Language.
      *
      * This program illustrates the use of some of the commonly
      * used numeric formats. It will show actual hex-dump content of
      * the fields along with the field length for the display format
      * (actual digits), the packed format (COMP-3) and the binary
      * (COMP)
      * formats.
      *
      * The COBOL programs are compiled with the ASSIGN(EXTERNAL)
      * directive. This provides for external file mapping of file
      * names.
      *
      * When running with Net Express the IBMCOMP an NOTRUNC directives
      * will be required to maintain compatability with the mainframe
      * format and field sizes for binary fields.
      *
      * This technique provides for the use of a single COBOL source
      * program that will run on OS/390, Windows or Unix.
      *
      * This program will run on a Personal Computer with Windows
      * and Micro Focus Net Express or Mainframe Express.
      *
      * This program will also run on an IBM Mainframe.
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1996/03/15 Simmons, Created program.
      * 1996/03/15 Simmons, No changes to date.
      *
      *****************************************************************
      *
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05  T1 pic X(11) value '* NUMBERC1 '.
           05  T2 pic X(34) value 'Self Study, Numeric Formats COBOL '.
           05  T3 pic X(10) value ' v06.03.31'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* NUMBERC1 '.
           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 '* NUMBERC1 '.
           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 '* NUMBERC1 '.
           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'.
      *****************************************************************
      *    Buffer used for posting messages to the console.
      *    ------------------------------------------------------------
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* NUMBERC1 '.
           05  MESSAGE-TEXT        pic X(68).
      *****************************************************************
      *    Coding techniques for various numeric formats...
      *    ------------------------------------------------------------
      *    The following shows the full syntax for ZONED-DECIMAL
      *
       01  ZONE-DECIMAL-UNSIGN     pic 9(5)  USAGE IS DISPLAY.
      *
      *    The preceding is normally coded as follows. Since there is
      *    no USAGE clause the default is DISPLAY or ZONED-DECIMAL.
      *
       01  ZONE-DECIMAL-UNSIGN-N   PIC 9(5).
      *
      *    For Working Storage fields a value clause may be added to
      *    minimize or avoid the occurence of a "S0C7" or an error
      *    message of "Invalid value in numeric field" followed
      *    by a program ABEND. The value clause will cause the field
      *    to contain all ZEROES when the program is loaded. If the
      *    value clause is not used as follows the numeric field may
      *    contain spaces.
      *
       01  ZONE-DECIMAL-UNSIGN-NV  PIC 9(5) VALUE 0.
      *    ------------------------------------------------------------
      *    The following is the full syntax for PACKED-DECIMAL.
      *
       01  PACK-DECIMAL-UNSIGN     pic 9(5)  USAGE IS COMPUTATIONAL-3.
      *
      *    The preceding is normally coded as follows.
      *    For the USAGE clause the syntax may be abbreviated. The
      *    "USAGE IS" part of the clause is not neccessary and the
      *    COMPUTATIONAL-3 may be abbreviated as COMP-3.
      *    The VALUE clause is optional and will initialize the
      *    field to ZEROES when the program is started.
      *
       01  PACK-DECIMAL-UNSIGN-N   pic 9(5)  COMP-3 VALUE 0.
      *    ------------------------------------------------------------
      *    The following is the full syntax for BINARY or COMP field.
       01  BINARY-UNSIGN           pic 9(5)  USAGE IS COMPUTATIONAL.
      *
      *    The preceding is normally coded as follows.
      *    The VALUE clause is optional and will initialize the
      *    field to ZEROES when the program is started.
      *
       01  BINARY-UNSIGN-2         pic 9(5)  COMP VALUE 0.
      *****************************************************************
      *    Various numeric formats used by COBOL...
      *    ------------------------------------------------------------
       01  TEXT-ZONED-DECIMAL.
           05  NUMB-ZONED-DECIMAL pic 9(5)  value 123.
       01  TEXT-ZONED-DECIMAL-SIGN.
           05  SIGN-ZONED-DECIMAL pic S9(5) value 123.
       01  TEXT-PACKED-DECIMAL.
           05  NUMB-PACKED-DECIMAL pic 9(5)  COMP-3 value 123.
       01  TEXT-PACKED-DECIMAL-SIGN.
           05  SIGN-PACKED-DECIMAL pic S9(5) COMP-3 value 123.
       01  TEXT-BINARY.
           05  NUMB-BINARY         pic 9(5)  COMP   value 123.
       01  TEXT-BINARY-SIGN.
           05  SIGN-BINARY         pic S9(5) COMP   value 123.
       01  PACK-DECIMAL-S3V2-TEXT.
           05  PACK-DECIMAL-S3V2   pic S9(3)V99 COMP-3 value 6.15.
       01  SLS-S3V2-TEXT.
           05  SLS-S3V2-NUMB       pic S9(3)V99 SIGN LEADING SEPARATE
                                   value 0.
       01  TEXT-SIGN-LEAD-SEPARATE.
           05  SIGN-LEAD-SEPARATE  pic S9(5) SIGN LEADING SEPARATE
                                   value 0.
       01  PRINT-LINE.
           05  FILLER              pic X(8) value 'Edited: '.
           05  PRINT-NUMBER        pic +ZZZ.99.
       01  W-SIGN-06.
           05  W-SIGN              pic X       value SPACE.
           05  W-SIGN-VALUE        pic X(3)    value SPACES.
           05  W-SIGN-POINT        pic X       value '.'.
           05  W-SIGN-DECIMAL      pic X(2)    value SPACES.
       01  FIELD-LENGTH            pic 9(3)    value 0.
       01  FIELD-LENGTH-X          REDEFINES   FIELD-LENGTH
                                   pic X(3).
       COPY PASSDUMP.
      *****************************************************************
       PROCEDURE DIVISION.
           perform FIRST-TIME-LOGIC
      *    ------------------------------------------------------------
      *    Example-01, Show the Hex format for an unsigned, positive
      *    and negative Zoned-Decimal field or USAGE IS DISPLAY...
           perform ZONED-FIELD
      *    ------------------------------------------------------------
      *    Example-02, Show the Hex format for an unsigned, positive
      *    and negative Packed-Decimal field or USAGE IS COMP-3...
           perform PACKED-FIELD
      *    ------------------------------------------------------------
      *    Example-03, Show the Hex format for an unsigned, positive
      *    and negative Binary field or USAGE IS COMP...
           perform BINARY-FIELD
      *    ------------------------------------------------------------
      *    Example-04, Show how to convert a packed-decimal number to a
      *    display number with a separate leading sign character.
      *    Convert from... PIC S9(5) USAGE IS COMPUTATIONAL-3
      *    Convert to..... PIC S9(5) USAGE IS DISPLAY
      *    The resulting field will still be implied decimal. The field
      *    length will be 6-bytes, a single (1-byte) leading sign
      *    and five (5-bytes) digits.
      *
           perform CONVERT-TO-DISPLAY
      *    ------------------------------------------------------------
      *    Example-05, Show how to convert a packed number
      *    with two decimal position and an implied decimal point to a
      *    text string with a separate leading sign character and an
      *    explicit decimal point.
      *    Convert from... PIC S9(5) USAGE IS COMPUTATIONAL-3
      *    Convert to..... PIC X(7)
      *    The resulting field will have an explicit decimal point.
      *    The field length will be 7-bytes, a single (1-byte) leading
      *    sign, three (3-bytes) digits to the left of the decimal, a
      *    single (1-byte) decimal point and two (2-bytes) digits to
      *    the right of the decimal point.
      *
           perform CONVERT-TO-DISPLAY-PIC-X
      *    ------------------------------------------------------------
      *    Example-06, Show how to convert a packed number
      *    with two decimal position and an implied decimal point to a
      *    text string with a separate leading sign character and an
      *    explicit decimal point.
      *    Convert from... PIC S9(3)V99 USAGE IS COMPUTATIONAL-3
      *    Convert to..... PIC +ZZZ.99
      *    The resulting field will have an explicit decimal point.
      *    The field length will be 7-bytes, a single (1-byte) leading
      *    sign, three (3-bytes) digits to the left of the decimal, a
      *    single (1-byte) decimal point and two (2-bytes) digits to
      *    the right of the decimal point.
      *
           perform CONVERT-TO-DISPLAY-PIC-Z
           GOBACK.
      *****************************************************************
       DUMP-ASTERISK-ROW.
           move 'NOTE' to SIMODUMP-REQUEST
           move all '*' to SIMODUMP-BUFFER
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           exit.
      *****************************************************************
       DUMP-ASTERISK-ROW-2X.
           perform DUMP-ASTERISK-SINGLE
           perform DUMP-ASTERISK-ROW
           exit.
      *****************************************************************
       DUMP-ASTERISK-SINGLE.
           move 'NOTE' to SIMODUMP-REQUEST
           move SPACES to SIMODUMP-BUFFER
           move '*'    to SIMODUMP-BUFFER(1:1)
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           exit.
      *****************************************************************
      * Descirbe the format for a zoned-decimal field...
      *****************************************************************
       ZONED-FIELD.
      *    Prepare to show the Number...
           move 'ZONED...' to SIMODUMP-DUMP-ID
           perform DUMP-ASTERISK-ROW-2X
           move 'Zoned-Decimal, Unsign, USAGE IS DISPLAY'
             to SIMODUMP-BUFFER
           move 'NOTE'         to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    Show the hexadecimal content of the field...
           add length of TEXT-ZONED-DECIMAL
               to ZERO giving SIMODUMP-LENGTH
           move SPACES         to SIMODUMP-BUFFER
           move TEXT-ZONED-DECIMAL to SIMODUMP-BUFFER
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'Zoned-Decimal, Signed, Positive, USAGE IS DISPLAY'
             to SIMODUMP-BUFFER
           move 'NOTE' to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    Show the hexadecimal content of the positive value...
           move SPACES         to SIMODUMP-BUFFER
           move TEXT-ZONED-DECIMAL-SIGN to SIMODUMP-BUFFER
           add length of TEXT-ZONED-DECIMAL-SIGN
               to ZERO giving SIMODUMP-LENGTH
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'Zoned-Decimal, Signed, Negative, USAGE IS DISPLAY'
             to SIMODUMP-BUFFER
           move 'NOTE' to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move SPACES         to SIMODUMP-BUFFER
           subtract SIGN-ZONED-DECIMAL from ZERO
             giving SIGN-ZONED-DECIMAL
           move TEXT-ZONED-DECIMAL-SIGN to SIMODUMP-BUFFER
           add length of TEXT-ZONED-DECIMAL-SIGN
               to ZERO giving SIMODUMP-LENGTH
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           exit.
      *****************************************************************
      * How to convert to a display field from packed or binary...
      *****************************************************************
       CONVERT-TO-DISPLAY.
           move 'CONVERT1' to SIMODUMP-DUMP-ID
           perform DUMP-ASTERISK-ROW-2X
           move 'Convert from Packed to Display'
             to SIMODUMP-BUFFER
           move 'NOTE'         to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'The PACKED-DECIMAL field to be converted'
             to SIMODUMP-BUFFER
           move 'NOTE'         to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           add length of TEXT-PACKED-DECIMAL-SIGN
               to ZERO giving SIMODUMP-LENGTH
           move SPACES         to SIMODUMP-BUFFER
           move TEXT-PACKED-DECIMAL-SIGN to SIMODUMP-BUFFER
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'The DISPLAY field created by the conversion routine'
             to SIMODUMP-BUFFER
           move 'NOTE'         to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    Convert the PACKED-DECIMAL field to a ZONE-DECIMAL field
      *    with a separate, leading sign. This filed has zero decimal
      *    positions.
      *              Text    Hexadecimal      Length
      *    INPUT:     123-   x'00123D'             3
      *    OUTPUT: -00123    x'60F0F0F1F2F3'       6
      *    Show the hexadecimal content of the unsigned value...
      *
           add SIGN-PACKED-DECIMAL to ZERO giving SIGN-LEAD-SEPARATE
      *    The preceding statement is the only statement required to do
      *    the conversion from packed-decimal to zone-decimal.
      *    The additional code in this section is used to display the
      *    input and result field values in hexadecimal dump format.
      *
           add length of SIGN-LEAD-SEPARATE
               to ZERO giving SIMODUMP-LENGTH
           move SPACES         to SIMODUMP-BUFFER
           move TEXT-SIGN-LEAD-SEPARATE to SIMODUMP-BUFFER
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           exit.
      *****************************************************************
      * How to convert to a display field from packed or binary...
      *****************************************************************
       CONVERT-TO-DISPLAY-PIC-X.
           move 'CONVERT2' to SIMODUMP-DUMP-ID
           perform DUMP-ASTERISK-ROW-2X
           move 'Convert from Packed to Text, Decimal Point Value'
             to SIMODUMP-BUFFER
           move 'NOTE'         to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    Show the hexadecimal content of the unsigned value...
           add PACK-DECIMAL-S3V2 to ZERO giving SLS-S3V2-NUMB
           move SLS-S3V2-TEXT(1:1) to W-SIGN
           move SLS-S3V2-TEXT(2:3) to W-SIGN-VALUE
           move SLS-S3V2-TEXT(5:2) to W-SIGN-DECIMAL
           add length of W-SIGN-06
               to ZERO giving SIMODUMP-LENGTH
           move SPACES         to SIMODUMP-BUFFER
           move W-SIGN-06      to SIMODUMP-BUFFER
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           exit.
      *****************************************************************
      * How to convert to a display field from packed or binary...
      *****************************************************************
       CONVERT-TO-DISPLAY-PIC-Z.
           move 'CONVERT3' to SIMODUMP-DUMP-ID
           perform DUMP-ASTERISK-ROW-2X
           move 'Positive Packed to Edited Text with Decimal Point'
             to SIMODUMP-BUFFER
           move 'NOTE'         to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    The following statement will place a value into the
      *    packed-decimal field. The actual value will be x'00123C'.
           add 1.23 to ZERO giving PACK-DECIMAL-S3V2
      *    The following statement will place the arithmetic value of
      *    the packed-decimal field into the edited print field. The
      *    actual value will be x'4E4040F14BF2F3'. This will result in
      *    converting the packed-decimal field but has leading spaces.
           move PACK-DECIMAL-S3V2 to PRINT-NUMBER
      *    The following statement will replace the leading spaces
      *    with zeroes. The resulting value will be x'4EF0F0F14BF2F3'.
           inspect PRINT-NUMBER replacing all SPACE by ZERO
      *    The preceding 2 statements are the only statements required
      *    to do the conversion from packed-decimal to zone-decimal.
      *    The additional code in this section is used to display the
      *    input and result field values in hexadecimal dump format.
      *
           add length of PRINT-LINE
               to ZERO giving SIMODUMP-LENGTH
           move SPACES      to SIMODUMP-BUFFER
           move PRINT-LINE  to SIMODUMP-BUFFER
           move 'DUMP'      to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'Negative Packed to Edited Text with Decimal Point'
             to SIMODUMP-BUFFER
           move 'NOTE'         to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           add -4.56 to ZERO giving PACK-DECIMAL-S3V2
           move PACK-DECIMAL-S3V2 to PRINT-NUMBER
           inspect PRINT-NUMBER replacing all SPACE by ZERO
           move PRINT-LINE  to SIMODUMP-BUFFER
           move 'DUMP'      to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           exit.
      *****************************************************************
      * Descirbe the format for a packed-decimal field...
      *****************************************************************
       PACKED-FIELD.
      *    Prepare to show the Number...
           move 'PACKED..' to SIMODUMP-DUMP-ID
           perform DUMP-ASTERISK-ROW-2X
           move 'Packed-Decimal, Unsign, USAGE IS COMP-3'
             to SIMODUMP-BUFFER
           move 'NOTE'         to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    Show the hexadecimal content of the unsigned value...
           add length of TEXT-PACKED-DECIMAL
               to ZERO giving SIMODUMP-LENGTH
           move SPACES         to SIMODUMP-BUFFER
           move TEXT-PACKED-DECIMAL to SIMODUMP-BUFFER
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'Packed-Decimal, Signed, Positive, USAGE IS COMP-3'
             to SIMODUMP-BUFFER
           move 'NOTE' to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    Show the hexadecimal content of the positive value...
           move SPACES         to SIMODUMP-BUFFER
           move TEXT-PACKED-DECIMAL-SIGN to SIMODUMP-BUFFER
           add length of TEXT-PACKED-DECIMAL-SIGN
               to ZERO giving SIMODUMP-LENGTH
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'Packed-Decimal, Signed, Negative, USAGE IS COMP-3'
             to SIMODUMP-BUFFER
           move 'NOTE' to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move SPACES         to SIMODUMP-BUFFER
           subtract SIGN-PACKED-DECIMAL from ZERO
             giving SIGN-PACKED-DECIMAL
           move TEXT-PACKED-DECIMAL-SIGN to SIMODUMP-BUFFER
           add length of TEXT-PACKED-DECIMAL-SIGN
               to ZERO giving SIMODUMP-LENGTH
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           exit.
      *****************************************************************
      * Descirbe the format for a binary field...
      *****************************************************************
       BINARY-FIELD.
      *    Prepare to show the Number...
           move 'BINARY..' to SIMODUMP-DUMP-ID
           perform DUMP-ASTERISK-ROW-2X
           move 'Binary Format, No Sign, USAGE IS COMP'
             to SIMODUMP-BUFFER
           move 'NOTE' to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    Show the hexadecimal content of the field...
           add length of TEXT-BINARY
               to ZERO giving SIMODUMP-LENGTH
           move SPACES         to SIMODUMP-BUFFER
           move TEXT-BINARY to SIMODUMP-BUFFER
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'Binary Format, Positive, USAGE IS COMP'
             to SIMODUMP-BUFFER
           move 'NOTE' to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
      *    Show the hexadecimal content of the positive value...
           move SPACES         to SIMODUMP-BUFFER
           move TEXT-BINARY-SIGN to SIMODUMP-BUFFER
           add length of TEXT-BINARY-SIGN
               to ZERO giving SIMODUMP-LENGTH
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move 'Binary Format, Negative, USAGE IS COMP'
             to SIMODUMP-BUFFER
           move 'NOTE' to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move SPACES         to SIMODUMP-BUFFER
           subtract SIGN-BINARY from ZERO
             giving SIGN-BINARY
           move TEXT-BINARY-SIGN to SIMODUMP-BUFFER
           add length of TEXT-BINARY-SIGN
               to ZERO giving SIMODUMP-LENGTH
           move 'DUMP'         to SIMODUMP-REQUEST
           call 'SIMODUMP'  using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           exit.
      *****************************************************************
       FIRST-TIME-LOGIC.
           perform Z-POST-COPYRIGHT.
           move 'OUT2' to SIMODUMP-OUTPUT
           move 'HIDE' to SIMODUMP-COPYRIGHT
           exit.
      *****************************************************************
      * The following Z-Routines perform administrative tasks         *
      * for this program.                                             *
      *****************************************************************
       Z-POST-CONSOLE-MESSAGE.
           display MESSAGE-BUFFER upon console
           move SPACES to MESSAGE-TEXT
           exit.
      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE     upon console
           display SIM-COPYRIGHT upon console
           exit.
      *****************************************************************
       Z-POST-NOTE-AND-CLEAR.
           move 'NOTE' to SIMODUMP-REQUEST
           call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER
           move SPACES to SIMODUMP-BUFFER
           exit.
      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01 upon console
           display SIM-THANKS-02 upon console
           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       *
      *****************************************************************
  
   
           
           Summary
          Summary
  This document is an introduction to the various numeric formats used by COBOL and the IBM mainframe systems. This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.
In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the  Contact or Feedback  section of this document.
  
  
          
  
 
           
           Software Agreement and Disclaimer
          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.
 
           
           Downloads and Links
          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.
 
           
           Current Server or Internet Access
          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  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
 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  icon.
 icon.
 
 
 Explore the Numbers Connection for additional information about the structure and processing of numeric data items (or numeric fields).
 
Explore the Numbers Connection for additional information about the structure and processing of numeric data items (or numeric fields).
 
 
 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.
 
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.
 
 
 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.
 
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.
 
 
 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.
 
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.
 
 
 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.
 
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.
 
 
 Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample code.
 
Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample code.
 
 
 Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
 
Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
 
 
 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.
 
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.
 
 
 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.
 
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.
 
 
 Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.
 
Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.
 
           
           Internet Access Required
          Internet Access Required
  The following links will require an internet connect.
This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection
Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.
Explore the GnuCOBOL Technologies available from SourceForge. SourceForge is an Open Source community resource dedicated to helping open source projects be as successful as possible. GnuCOBOL (formerly OpenCOBOL) is a COBOL compiler with run time support. The compiler (cobc) translates COBOL source to executable using intermediate C, designated C compiler and linker. This link will require an Internet Connection.
 
           
           Glossary of Terms
          Glossary of Terms
   
 
 Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
 
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
 
           
           Contact or Feedback
          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.
 
           
           Company Overview
          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 | 
| Numbers and Formats, Internal Numeric Structures for a Mainframe | 
| Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved | 
| When technology complements business | 
| http://www.simotime.com |