Packed Field with Spaces
Usage is COMP-3 (Packed Decimal)
  Table of Contents  v-24.01.01 - nbrpk301.htm 
  Introduction
  Execute
  CMD File, Execute Program
  CMD, HEX20 & HEX40 is DISABLE
  CMD, HEX20 & HEX40 is ZERO_ADJ
  CMD, HEX20 & HEX40 is ZERO_FIX
  JCL Member, Execute Program
  JCL, HEX20 & HEX40 is DISABLE
  JCL, HEX20 & HEX40 is ZERO_ADJ
  JCL, HEX20 & HEX40 is ZERO_FIX
  Review the Results
  Results, HEX20 & HEX40 is DISABLE
  Results, HEX20 & HEX40 is ZERO_ADJ
  Results, HEX20 & HEX40 is ZERO_FIX
  Prepare
  Generate Programs
  Generate, HEX20 & HEX40 is DISABLE
  Generate, HEX20 & HEX40 is ZERO_ADJ
  Create Test Data
  CMD File, Create Test Data
  JCL Member, Create Test Data
  Technical Details
  USAGE IS COMP-3 Field
  Compiler Options or Directives
  Default Compiler Directives
  Alternate Compiler Directives for NBRPK3R1
  Record Structure for Test File
  Hex-Dump of Test File
  Programatic Creation of Test Data
  COBOL Program
  COBOL Copy File
  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 document (with sample programs) describes the anomalies of working with packed numeric fields that contain spaces. For the COBOL programming language these fields would be defined as COMPUTATIONAL-3 or COMP-3.

This suite of programs will build test data and discuss techniques for managing packed numeric fields and displaying a field in a hexadecimal dump format. Allowing a space character (or any non-numeric value) to exist in a packed-decimal field should be considered as a bad programming practice. The process that causes this to happen should be identified and corrected.


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 Execute

This suite of programs incudes a group of CMD files and a JCL members to map the file names and execute the programs that accumulate the Summary Totals and Record Counts. The output is posted to the SYSOUT device.

Table of Contents Previous Section Next Section CMD File, Execute Program

The following command files will process a test file that contains records with packed-decimal field that contain space characters. The records contain packed-decimal fields that have both EBCDIC and ASCII encoded space characters. Each job will read the records in the test file and accumulate summary totals for each of the packed-decimal fields in the record structure. Each job uses a different methodology for handling the spaces in the packed-decimal fields.

Table of Contents Previous Section Next Section CMD, HEX20 & HEX40 is DISABLE

The following (NBRPK3W1.cmd) is a sample of the Windows CMD needed to run this job with Windows and Micro Focus COBOL. The function to test for spaces in a packed-numeric and treat as a zero value is disabled for this job.

@echo OFF
     set CmdName=NBRPK3W1
rem  * *******************************************************************
rem  *               NBRPK3W1.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   - Read a file, Calculate record count and numeric totals.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1988
rem  *
rem  The job will read a record sequential file of 80-byte records that
rem  contains numeric fields within the records.
rem  The programs will read the file and calculate summary totals and a
rem  record count for the user-defined numeric fields. The information
rem  will then be posted to the SYSOUT device.
rem  *
rem  *                     ************
rem  *                     * NBRPK3W1 *
rem  *                     ********cmd*
rem  *                          *
rem  *                          *
rem  *    ************     ************     ************
rem  *    *  SYSUT1  ******* NBRPK3C1 *******  SYSOUT  *
rem  *    *******rseq*     ********cbl*     *******lseq*
rem  *                          *
rem  *                          *
rem  *                     ************
rem  *                     *   EOJ    *
rem  *                     ************
rem  *
rem  * *******************************************************************
rem  * Read a File, Calculate Record Counts and Summary Totals...
rem  *
     call ..\Env1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting CmdName %CmdName%"
     call SimoNOTE "StepInfo Execute the Program to Calculate Totals"
rem  *
rem  * The following set statements will map the file names used by the
rem  * program to the actual physical file names.
     set SYSUT1=%BaseLib1%\DATA\APPL\SIMOTIME.DATA.NBRPK3D1.DAT
     set SYSOUT=%BaseLib1%\LOGS\SYSOUT_%CmdName%.TXT
rem  *
     if exist %SYSOUT% erase %SYSOUT%
     call SimoNOTE "DataTake %SYSUT1%"
     call SimoNOTE "DataMake %SYSOUT%"
     run NBRPK3C1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     if exist %SYSOUT% type %SYSOUT%
     goto :EojAok
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section CMD, HEX20 & HEX40 is ZERO_ADJ

The following (NBRPK3W2.cmd) is a sample of the Windows CMD needed to run this job with Windows or Micro Focus COBOL. The NET20 and NET40 functions are set to ZERO_ADJ. This setting will test for all spaces in a packed-numeric field and if true the spaces will be converted to a zero value prior to adding to the summary total. The test file will not be updated.

@echo OFF
     set CmdName=NBRPK3W2
rem  * *******************************************************************
rem  *               NBRPK3W2.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   - Read a file, Calculate record count and numeric totals.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1988
rem  *
rem  The job will read a record sequential file of 80-byte records that
rem  contains numeric fields within the records.
rem  The programs will read the file and calculate summary totals and a
rem  record count for the user-defined numeric fields. The information
rem  will then be posted to the SYSOUT device.
rem  *
rem  *                     ************
rem  *                     * NBRPK3W2 *
rem  *                     ********cmd*
rem  *                          *
rem  *                          *
rem  *    ************     ************     ************
rem  *    * NBRPK3D1 ******* NBRPK3C2 *******  SYSOUT  *
rem  *    *******rseq*     ********cbl*     *******lseq*
rem  *                          *
rem  *                          *
rem  *                     ************
rem  *                     *   EOJ    *
rem  *                     ************
rem  *
rem  * *******************************************************************
rem  * Read a File, Calculate Record Counts and Summary Totals...
rem  *
     call ..\ENV1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting CmdName %CmdName%"
     call SimoNOTE "StepInfo Execute the Program to Calculate Totals"
rem  *
rem  * The following set statements will map the file names used by the
rem  * program to the actual physical file names.
     set SYSUT1=%BaseLib1%\DATA\APPL\SIMOTIME.DATA.NBRPK3D1.DAT
     set SYSOUT=%BaseLib1%\LOGS\SYSOUT_%CmdName%.TXT
rem  *
     if exist %SYSOUT% erase %SYSOUT%
     call SimoNOTE "DataTake %SYSUT1%"
     call SimoNOTE "DataMake %SYSOUT%"
     run NBRPK3C2
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     if exist %SYSOUT% type %SYSOUT%
     goto :EojAok
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section CMD, HEX20 & HEX40 is ZERO_FIX

The following (NBRPK3W32.cmd) is a sample of the Windows CMD needed to run this job with Windows or Micro Focus COBOL. The NET20 and NET40 functions are set to ZERO_FIX. This setting will test for all spaces in a packed-numeric field and if true the spaces will be converted to a zero value prior to adding to the summary total and the test file will be updated.

@echo OFF
     set CmdName=NBRPK3W3
rem  * *******************************************************************
rem  *               NBRPK3W3.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   - Read a file, Calculate record count and numeric totals.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1988
rem  *
rem  The job will read a record sequential file of 80-byte records that
rem  contains numeric fields within the records.
rem  The programs will read the file and calculate summary totals and a
rem  record count for the user-defined numeric fields. The information
rem  will then be posted to the SYSOUT device.
rem  If a numeric fields contains an ASCII or EBCDIC space characters then
rem  the value is set to zero before the calculation of the summary total.
rem  Also, the record in the file is updated.
rem  *
rem  *                     ************
rem  *                     * NBRPK3W3 *
rem  *                     ********cmd*
rem  *                          *
rem  *                          *
rem  *    ************     ************     ************
rem  *    * NBRPK3D1 ******* NBRPK3C3 *******  SYSOUT  *
rem  *    *******rseq*     ********cbl*  *  *******lseq*
rem  *                          *        *
rem  *                          *        *  ************
rem  *                          *        **** NBRPK3D1 *
rem  *                          *           *******rseq*
rem  *                          *
rem  *                     ************
rem  *                     *   EOJ    *
rem  *                     ************
rem  *
rem  * *******************************************************************
rem  * Read a File, Calculate Record Counts and Summary Totals...
rem  *
     call ..\ENV1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting CmdName %CmdName%"
     call SimoNOTE "StepInfo Execute the Program to Calculate Totals"
rem  *
rem  * The following set statements will map the file names used by the
rem  * program to the actual physical file names.
     set SYSUT1=%BaseLib1%\DATA\APPL\SIMOTIME.DATA.NBRPK3D1.DAT
     set SYSOUT=%BaseLib1%\LOGS\SYSOUT_%CmdName%.txt
rem  *
     if exist %SYSOUT% erase %SYSOUT%
     call SimoNOTE "DataTake %SYSUT1%"
     call SimoNOTE "DataMake %SYSOUT%"
     run NBRPK3C3
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not %JobStatus% == 0000 goto :EojNok
     if exist %SYSOUT% type %SYSOUT%
     goto :EojAok
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section JCL Member, Execute Program

The following jobs will process a test file that contains records with packed-decimal field that contain space characters. The records contain packed-decimal fields that have both EBCDIC and ASCII encoded space characters. Each job will read the records in the test file and accumulate summary totals for each of the packed-decimal fields in the record structure. Each job uses a different methodology for handling the spaces in the packed-decimal fields.

Table of Contents Previous Section Next Section JCL, HEX20 & HEX40 is DISABLE

The following (NBRPK3J1.jcl) is a sample of the JCL Member needed to run this job with ZOS or Micro Focus Enterprise Server. The function to test for spaces in a packed-numeric and treat as a zero value is disabled for this job.

//NBRPK3J1 JOB (SIMOTIME),'PACKED WITH SPACES',CLASS=1,MSGCLASS=0,
//             NOTIFY=CSIP1
//* *******************************************************************
//*       NBRPK3J1.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member 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   - Read a file, Calculate record count and numeric totals.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The job will read a record sequential file of 80-byte records that
//* contains numeric fields within the records.
//* The programs will read the file and calculate summary totals and a
//* record count for the user-defined numeric fields. The information
//* will then be posted to the SYSOUT device.
//*
//* This set of programs may be compiled and executed on a Mainframe
//* System with ZOS or a Linux, UNIX or Windows System with Micro Focus
//* Enterprise Developer.
//*
//*                     ************
//*                     * NBRPK3J1 *
//*                     ********jcl*
//*                          *
//*    ************     ************     ************
//*    *  SYSUT1  *-----* NBRPK3C1 *-----*  SYSOUT  *
//*    ********dat*     ********cbl*     ********spl*
//*                          *   *
//*                          *   *       ************
//*                          *   *-call--* NBRPK3R1 *
//*                          *           ********cbl*
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step 1 of 1, Write Summary Total and record counts to SYSOUT
//*
//VALIDATE EXEC PGM=NBRPK3C1
//SYSUT1   DD  DSN=SIMOTIME.DATA.NBRPK3D1,DISP=SHR
//SYSOUT   DD  SYSOUT=*
//

Table of Contents Previous Section Next Section JCL, HEX20 & HEX40 is ZERO_ADJ

The following (NBRPK3J2.jcl) is a sample of the JCL Member needed to run this job with ZOS or Micro Focus Enterprise Server. The NET20 and NET40 functions are set to ZERO_ADJ. This setting will test for all spaces in a packed-numeric field and if true the spaces will be converted to a zero value prior to adding to the summary total. The test file will not be updated.

//NBRPK3J2 JOB (SIMOTIME),'PACKED WITH SPACES',CLASS=1,MSGCLASS=0,
//             NOTIFY=CSIP1
//* *******************************************************************
//*       NBRPK3J2.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member 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   - Read a file, Calculate record count and numeric totals.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The job will read a record sequential file of 80-byte records that
//* contains numeric fields within the records.
//* The programs will read the file and calculate summary totals and a
//* record count for the user-defined numeric fields. The information
//* will then be posted to the SYSOUT device.
//*
//* This set of programs may be compiled and executed on a Mainframe
//* System with ZOS or a Linux, UNIX or Windows System with Micro Focus
//* Enterprise Developer.
//*
//*                     ************
//*                     * NBRPK3J2 *
//*                     ********jcl*
//*                          *
//*    ************     ************     ************
//*    *  SYSUT1  *-----* NBRPK3C2 *-----*  SYSOUT  *
//*    ********dat*     ********cbl*     ********spl*
//*                          *   *
//*                          *   *       ************
//*                          *   *-call--* NBRPK3R2 *
//*                          *           ********cbl*
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step 1 of 1, Write Summary Total and record counts to SYSOUT
//*
//VALIDATE EXEC PGM=NBRPK3C2
//SYSUT1   DD  DSN=SIMOTIME.DATA.NBRPK3D1,DISP=SHR
//SYSOUT   DD  SYSOUT=*
//

Table of Contents Previous Section Next Section JCL, HEX20 & HEX40 is ZERO_FIX

The following (NBRPK3J3.jcl) is a sample of the JCL Member needed to run this job with ZOS or Micro Focus Enterprise Server. The NET20 and NET40 functions are set to ZERO_FIX. This setting will test for all spaces in a packed-numeric field and if true the spaces will be converted to a zero value prior to adding to the summary total and the test file will be updated.

//NBRPK3J3 JOB (SIMOTIME),'PACKED WITH SPACES',CLASS=1,MSGCLASS=0,
//             NOTIFY=CSIP1
//* *******************************************************************
//*       NBRPK3J3.JCL - a JCL Member for Batch Job Processing        *
//*       This JCL Member 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   - Read a file, Calculate record count and numeric totals.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The job will read a record sequential file of 80-byte records that
//* contains numeric fields within the records.
//* The programs will read the file and calculate summary totals and a
//* record count for the user-defined numeric fields. The information
//* will then be posted to the SYSOUT device.
//*
//* This set of programs may be compiled and executed on a Mainframe
//* System with ZOS or a Linux, UNIX or Windows System with Micro Focus
//* Enterprise Developer.
//*
//*                     ************
//*                     * NBRPK3J3 *
//*                     ********jcl*
//*                          *
//*    ************     ************     ************
//*    *  SYSUT1  *-----* NBRPK3C3 *-----*  SYSOUT  *
//*    ********dat*     ********cbl*     ********spl*
//*                          *   *
//*                          *   *       ************
//*                          *   *-call--* NBRPK3R3 *
//*                          *           ********cbl*
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step 1 of 1, Write Summary Total and record counts to SYSOUT
//*
//VALIDATE EXEC PGM=NBRPK3C3
//SYSUT1   DD  DSN=SIMOTIME.DATA.NBRPK3D1,DISP=SHR
//SYSOUT   DD  SYSOUT=*
//

Table of Contents Previous Section Next Section Review the Results

The output created by the programs are summary totals for each of the packed-decimal fields in the test data file. At End-of-Job (EOJ) the programs will write the summary totals to the SYSOUT device. For the Micro Focus environment the programs were compiled using the OUTDD directive with SYSOUT specified as a line sequential (or ASCII-Text) file with a record length of 121 bytes. Therefore, the output may be easily viewed using a text editor of choice.

This section will describe the outputs based on various settings of the HEX20 and HEX40 functions.

Table of Contents Previous Section Next Section Results, HEX20 & HEX40 is DISABLE

The following shows the results when a packed-decimal field contains space characters. The test data for the following report contained three (3) records. The records contain packed-decimal fields that have both EBCDIC and ASCII encoded space characters.

The programs that are used to produce the following report simply attempt to use the values in the packed fields to accumulate summary totals. The programs were first compiled with the default compiler options/directives for a mainframe environment. Refer to the Default Compiler Directives section of this document for the Micro Focus Compiler directives. When an attempt was made to process one of the fields that contained all space characters an ABEND or Program Check resulted with an error message that indicated the field contained a non-numeric value (for the ZOS environment this would be a S0C7 error, for Micro Focus it would be an RTS 163 error).

Next, the programs were compiled with compiler options/directives that would prevent the ABEND. Refer to the Alternate Compiler Directives for NBRPK3R1 section of this document for the Micro Focus Compiler directives. When an attempt is made to process one of the packed-decimal fields that contained all space characters the sign position is corrected and the program check does not occur. However, since an ASCII space (x'20') or an EBCDIC space (x'40') are valid numbers this will result in the summary totals being incorrect.

The following shows a report that was created with HEX20 and HEX40 set to DISABLE. The test file contained three (3) records with both EBCDIC and ASCII spaces in some of the packed-decimal fields. For example, in the 1st record NBRPK3B1-FIELD-01 contains a valid numeric value of 123. In the 2nd and 3rd records NBRPK3B1-FIELD-01 contains ASCII space characters.

Typically, a business user would expect the spaces to be treated as zeroes and the summary total to be 123. However, this is not the case with packed-decimal fields. Using the SIGN-FIXUP directive avoids the S0C7 or RTS 163 error but the ASCII space characters are treated as valid numbers and result in a value of 20202. When reading the three records and accumulating the summary total the result for NBRPK3B1-FIELD-01 is as follows.
123 + 20202 + 20202 = 40,527

* NBRPK3C1 Packed Numeric Field with SPACES   v15.05.18   helpdesk@simotime.com
* NBRPK3C1 A Program to Calculate Totals was generated by SimoTime Technologies
* NBRPK3C1 * Compiled for an ASCII environment...
* NBRPK3C1 * HEX20 parameter is DISABLE
* NBRPK3C1 * HEX40 parameter is DISABLE
* NBRPK3C1 ************************************************************************************************************
* NBRPK3C1 Field Name                                     Summary.Total                HEX40     HEX20    NUMCHK TYPE
* NBRPK3C1 NBRPK3B1-FIELD-01                               40,527                                                 PK
* NBRPK3C1 NBRPK3B1-FIELD-02                                1,368-                                                PK
* NBRPK3C1 NBRPK3B1-FIELD-03                               41,634                                                 PK
* NBRPK3C1 NBRPK3B1-FIELD-04                              220,200                                                 PK
* NBRPK3C1 Record count for SYSUT1                      000000003
* NBRPK3C1 Field Name                                     Summary.Total                HEX40     HEX20    NUMCHK TYPE
* NBRPK3C1 ************************************************************************************************************
* NBRPK3C1 Program to Calculate Totals generated by using SimoTime Technologies
* NBRPK3C1 Please send all comments or suggestions to the helpdesk@simotime.com

Table of Contents Previous Section Next Section Results, HEX20 & HEX40 is ZERO_ADJ

The following shows the results when a packed-decimal field contains space characters and the program recognizes the condition.

The following shows a report that was created with HEX20 and HEX40 set to ZERO_ADJ. The test file contained three (3) records with both EBCDIC and ASCII spaces in some of the packed-decimal fields. The program that accumulates the summary totals will first test the packed-decimal field for all spaces (EBCDIC or ASCII) and if true set the value to zero prior to adding to the summary total. This will produce a summary total that a business user would expect.

Note: The packed-decimal value is only altered for the purpose of calculating the summary total. The data file will not be updated.

* NBRPK3C2 Packed Numeric Field with SPACES   v15.05.18   helpdesk@simotime.com
* NBRPK3C2 A Program to Calculate Totals was generated by SimoTime Technologies
* NBRPK3C2 * Compiled for an ASCII environment...
* NBRPK3C2 * HEX20 parameter is ZERO_ADJ
* NBRPK3C2 * HEX40 parameter is ZERO_ADJ
* NBRPK3C2 ************************************************************************************************************
* NBRPK3C2 Field Name                                     Summary.Total                HEX40     HEX20    NUMCHK TYPE
* NBRPK3C2 NBRPK3B1-FIELD-01                                  123                              0000002            PK
* NBRPK3C2 NBRPK3B1-FIELD-02                                1,368-                                                PK
* NBRPK3C2 NBRPK3B1-FIELD-03                                1,230                    0000001                      PK
* NBRPK3C2 NBRPK3B1-FIELD-04                              199,998                              0000001            PK
* NBRPK3C2 Record count for SYSUT1                      000000003
* NBRPK3C2 Field Name                                     Summary.Total                HEX40     HEX20    NUMCHK TYPE
* NBRPK3C2 ************************************************************************************************************
* NBRPK3C2 Program to Calculate Totals generated by using SimoTime Technologies
* NBRPK3C2 Please send all comments or suggestions to the helpdesk@simotime.com

Table of Contents Previous Section Next Section Results, HEX20 & HEX40 is ZERO_FIX

The following shows the results when a packed-decimal field contains space characters and the program recognizes the condition.

The following shows a report that was created with HEX20 and HEX40 set to ZERO_FIX. The test file contained three (3) records with both EBCDIC and ASCII spaces in some of the packed-decimal fields. The program that accumulates the summary totals will first test the packed-decimal field for all spaces (EBCDIC or ASCII) and if true set the value to zero prior to adding to the summary total. This will produce a summary total that a business user would expect.

Note: The packed-decimal value is altered for the purpose of calculating the summary total and the data file will be updated accordingly.

* NBRPK3C3 Spaces in Packed Fields, ZERO_FIX  v15.05.18   helpdesk@simotime.com
* NBRPK3C3 A Program to Calculate Totals was generated by SimoTime Technologies
* NBRPK3C3 * Compiled for an ASCII environment...
* NBRPK3C3 * HEX20 parameter is ZERO_FIX
* NBRPK3C3 * HEX40 parameter is ZERO_FIX
* NBRPK3C3 ************************************************************************************************************
* NBRPK3C3 Field Name                                     Summary.Total                HEX40     HEX20    NUMCHK TYPE
* NBRPK3C3 NBRPK3B1-FIELD-01                                  123                              0000002            PK
* NBRPK3C3 NBRPK3B1-FIELD-02                                1,368-                                                PK
* NBRPK3C3 NBRPK3B1-FIELD-03                                1,230                    0000001                      PK
* NBRPK3C3 NBRPK3B1-FIELD-04                              199,998                              0000001            PK
* NBRPK3C3 Record count for SYSUT1                      000000003
* NBRPK3C3 Field Name                                     Summary.Total                HEX40     HEX20    NUMCHK TYPE
* NBRPK3C3 ************************************************************************************************************
* NBRPK3C3 Program to Calculate Totals generated by using SimoTime Technologies
* NBRPK3C3 Please send all comments or suggestions to the helpdesk@simotime.com

Table of Contents Previous Section Next Section Prepare

Prior to executing the jobs it will be necessary to create (or generate) the programs that will read a test file and accumulate totals for the packed-decimal fields. The following is an overview of the programs that will be generated.

1. NBRPK301.pcf - this set of programs will process the packed-decimal fields with the NET20 and NET40 functions disabled.
2. NBRPK302.pcf - this set of programs will process the packed-decimal fields with the NET20 and NET40 functions set to ZERO_ADJ. The program that accumulates the summary totals will first test the packed-decimal field for all spaces (EBCDIC or ASCII) and if true set the value to zero prior to adding to the summary total. This will produce a summary total that a business user would expect.
3. NBRPK303.pcf - this set of programs will process the packed-decimal fields with the NET20 and NET40 functions set to ZERO_FIX. The program that accumulates the summary totals will first test the packed-decimal field for all spaces (EBCDIC or ASCII) and if true set the value to zero prior to adding to the summary total and the data file will be updated to reflect the changes. Also, this will produce a summary total that a business user would expect.

 

Table of Contents Previous Section Next Section Generate Programs

This section describes how to generate the COBOL programs used to accumulate summary totals and do a hex-dump of the test file. The purpose of this example is to process packed-decimal fields that contain space characters.

Table of Contents Previous Section Next Section Generate, HEX20 & HEX40 is DISABLE

The following (NBRPK301.pcf) is the Process Control File that is used to generate the programs that will produce summary totals. The testing of the packed-decimal fields is disabled.

***********************************************************************
*                NBRPK301.pcf - a Process Control File                *
*               SimoTime Program Generation Technologies              *
*             (C) Copyright 1987-2019 All Rights Reserved             *
*               Web Site URL:   http://www.simotime.com               *
*                     e-mail:   helpdesk@simotime.com                 *
***********************************************************************
* SYSUT1 is the Sequential File with 80-byte records.
***********************************************************************
* This Process Control File will be used to generate a set of COBOL
* programs that will accumulate totals for user-defined numeric fields
* and provide a record count.
*
* Refer to http://www.simotime.com/utcomp01.htm for additional detail
* about the PCF statements for Data Validate, Dump and Compare.
*
* The following group of statements will define the high level
* functions and processes to be performed.
*
&SIMOPREP  call ..\Env1BASE
&USERPREP  call UserCOGI
&CONFORM   IBM
&COPYFILE  NBRPK3B1.cpy
&HTMLFILE  nbrpk3b1.htm
*
* The following group of statements will define the behavioral
* characteristics and environment variable for the file I/O Program
* to be generated.
*
*HEAD34    ....:....1....:....2....:....3....
&HEAD34    Packed Numeric Field with SPACES
&PROGID    NBRPK3C1
&SYSUT1    org=Sequential recfm=FIXED rlen=80
*
* The following group of statements will define the behavioral
* characteristics and environment variables for the record content
* conversion program to be generated.
* The following defines the name of the callable routine for special
* numeric processing.
*
&NUMCALL   NBRPK3R1
&NUMREC    NBRPK3B1-RECORD-01
*
* The following group of statements will look at the user-defined
* numeric fields and compensate when the field contains all space
* characters.
*
&HEX40     DISABLE
&HEX20     DISABLE
&NUMCHK    ENABLE
*
* The following group of statements will define the type of processing
* and the name of the numeric fields.
*
&UT1TOTAL  NBRPK3B1-FIELD-01
&UT1TOTAL  NBRPK3B1-FIELD-02
&UT1TOTAL  NBRPK3B1-FIELD-03
&UT1TOTAL  NBRPK3B1-FIELD-04
*
&END

Table of Contents Previous Section Next Section Generate, HEX20 & HEX40 is ZERO_ADJ

The following (NBRPK302.pcf) is the Process Control File that is used to generate the programs that will produce summary totals. The NET20 and NET40 functions are set to ZERO_ADJ. The program that accumulates the summary totals will first test the packed-decimal field for all spaces (EBCDIC or ASCII) and if true set the value to zero prior to adding to the summary total. This will produce a summary total that a business user would expect.

***********************************************************************
*                NBRPK302.pcf - a Process Control File                *
*               SimoTime Program Generation Technologies              *
*             (C) Copyright 1987-2019 All Rights Reserved             *
*               Web Site URL:   http://www.simotime.com               *
*                     e-mail:   helpdesk@simotime.com                 *
***********************************************************************
* SYSUT1 is the Sequential File with 80-byte records.
***********************************************************************
* This Process Control File will be used to generate a set of COBOL
* programs that will accumulate totals for user-defined numeric fields
* and provide a record count.
*
* Refer to http://www.simotime.com/utcomp01.htm for additional detail
* about the PCF statements for Data Validate, Dump and Compare.
*
* The following group of statements will define the high level
* functions and processes to be performed.
*
&SIMOPREP  call ..\Env1BASE
&USERPREP  call UserCOGI
&CONFORM   IBM
&COPYFILE  NBRPK3B1.cpy
&HTMLFILE  nbrpk3b1.htm
*
* The following group of statements will define the behavioral
* characteristics and environment variable for the file I/O Program
* to be generated.
*
*HEAD34    ....:....1....:....2....:....3....
&HEAD34    Packed Numeric Field with SPACES
&PROGID    NBRPK3C2
&SYSUT1    org=Sequential recfm=FIXED rlen=80
*
* The following group of statements will define the behavioral
* characteristics and environment variables for the record content
* conversion program to be generated.
* The following defines the name of the callable routine for special
* numeric processing.
*
&NUMCALL   NBRPK3R2
&NUMREC    NBRPK3B1-RECORD-01
*
* The following group of statements will look at the user-defined
* numeric fields and compensate when the field contains all space
* characters.
*
&HEX40     ZERO_ADJ
&HEX20     ZERO_ADJ
*
* The following group of statements will define the type of processing
* and the name of the numeric fields.
*
&UT1TOTAL  NBRPK3B1-FIELD-01
&UT1TOTAL  NBRPK3B1-FIELD-02
&UT1TOTAL  NBRPK3B1-FIELD-03
&UT1TOTAL  NBRPK3B1-FIELD-04
*
&END

Table of Contents Previous Section Next Section Create Test Data

This section describes the COBOL program that is used to create the test data. The test data is a record sequential file of 80-byte fixed-length records. Each record contains a record ID field and four (4) numeric fields in packed-decimal (COMP-3) format. Some of the packed fields will contain space characters that are invalid and will cause a SOC7 error (non-numeric in numeric field) message. The purpose of this example is to process packed-decimal fields that contain space characters or invalid values.

Table of Contents Previous Section Next Section CMD File, Create Test Data

The following (NBRPK3W8.cmd) is the Windows CMD that is used to create the test data.

@echo OFF
     set CmdName=NBRPK3W8
rem  * *******************************************************************
rem  *               NBRPK3W8.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   - Create a Record Sequential Data Set
rem  * Author - SimoTime Technologies
rem  * Date   = January 24, 1996
rem  *
rem  * The 1ST step will map the logical file name used by the program
rem  * to the fully-qualified physical file name.
rem  * The 2ND step will create a new test file.
rem  * The 3RD step will read the test file and create a HEX-Dump file.
rem  *
rem  * This set of programs will run on a Windows System with Micro Focus
rem  * Enterprise Developer.
rem  *
     call ..\Env1BASE %CmdName%
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
rem  * *******************************************************************
rem  * Step 1 of 3, Prepare the environment...
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting CmdName %CmdName%, User is %USERNAME%"
     call SimoNOTE "StepInfo Delete previously created files"
rem  *
rem  * The following set statement will map the file name used by the
rem  * program to the actual physical file name.
     set SYSUT2=%BaseLib1%\DATA\APPL\SIMOTIME.DATA.NBRPK3D1.DAT
rem  *
     if exist %SYSUT2% del %SYSUT2%
     set JobStatus=0000
rem  *
rem  * *******************************************************************
rem  * Step 2 of 3, Create and populate a new RSEQ file...
rem  *
     call SimoNOTE "StepInfo Create the Record Sequential File"
     run NBRPK3C8
     if not "%ERRORLEVEL%" == "0" set JobStatus=0010
     if not "%JobStatus%" == "0000" goto :EojNOK
     call SimoNOTE "DataMake %SYSUT2%"
rem  *
rem  * *******************************************************************
rem  * Step 3 of 3, Hex Dump of the RSEQ file...
rem  *
     call SimoNOTE "StepInfo HEX-Dump of the Record Sequential File"
rem  *
rem  * The following set statements will map the file names used by the
rem  * program to the actual physical file names.
     set SYSUT1=%BaseLib1%\DATA\APPL\SIMOTIME.DATA.NBRPK3D1.DAT
     set SYSUT2=%BaseLib1%\LOGS\SYSUT2_NBRPK3W8.txt
rem  *
     run HX80RSC1
     if not "%ERRORLEVEL%" == "0" set JobStatus=0020
     if not "%JobStatus%" == "0000" goto :EojNOK
     call SimoNOTE "DataTake %SYSUT1%"
     call SimoNOTE "DataMake %SYSUT2%"
rem  *
rem  * *******************************************************************
:EojAok
     call SimoNOTE "Finished CmdName %CmdName%, Job Status is %JobStatus% "
     goto :End
:EojNok
     call SimoNOTE "NOTE ABENDING CmdName %CmdName%, Job Status is %JobStatus% "
:End
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section JCL Member, Create Test Data

The following (NBRPK3J8.jcl) is a sample of the JCL Member that is used to create the test data.

//NBRPK3J8 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       NBRPK3J8.jcl - a JCL Member for Batch Job Processing        *
//*       This JCL Member 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   - Create a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The 1st job step (JOBSETUP) will delete any previously created
//* file.
//* The 2nd job step (BUILDNEW) will create a new file of
//* packed-decimal, numeric fields within the records.
//* The 3rd job step (DUMPINFO) will create a new file of Hex-Dump
//* information.
//*
//* This set of programs may be compiled and executed on a Mainframe
//* System with ZOS or a Linux, UNIX or Windows System with Micro Focus
//* Enterprise Developer.
//*
//* *******************************************************************
//* Step 1 of 3, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//SYSUT1   DD  DSN=SIMOTIME.DATA.NBRPK3D1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSUT2   DD  DSN=SIMOTIME.DATA.NBRPK3D2,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 3, Create and populate a new QSAM file...
//*
//BUILDNEW EXEC PGM=NBRPK3C8
//SYSUT2   DD  DSN=SIMOTIME.DATA.NBRPK3D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*
//* *******************************************************************
//* Step 3 of 3, Create a HEX-Dump File...
//*
//DUMPINFO EXEC PGM=HX80DUMP
//SYSUT1   DD  DSN=SIMOTIME.DATA.NBRPK3D1,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATA.NBRPK3D2,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//

Table of Contents Previous Section Next Section Technical Details

This section provides additional details about the programs and control files that are used in this suite of programs.

Table of Contents Previous Section Next Section USAGE IS COMP-3 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.

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.

Table of Contents Previous Section Next Section Compiler Options or Directives

The following is an overview of the Micro Focus Compiler Options the are used for batch jobs or transaction processing that uses CICS.

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

Table of Contents Previous Section Next Section Default Compiler Directives

The following are the Micro Focus compiler directives that are used for batch processing.

DIALECT"ENTCOBOL"
CHARSET"ASCII"
ASSIGN"EXTERNAL"
IDXFORMAT"8"
IBMCOMP
NOTRUNC
HOSTNUMMOVE
HOSTNUMCOMPARE
NOSIGNFIXUP
HOSTARITHMETIC
NOHOSTFD
CHECKNUM
ANIM
COBIDY
NOOPTIONAL-FILE
outdd"SYSOUT 121 L"
SHARE-OUTDD
DATE
TIME
DATAMAP
settings
list()
noform

Table of Contents Previous Section Next Section Alternate Compiler Directives for NBRPK3R1

The following are the Micro Focus compiler directives that are used to manage the special processing requirements of packed-decimal fields that contain non-numeric values.

DIALECT"ENTCOBOL"
CHARSET"ASCII"
ASSIGN"EXTERNAL"
IBMCOMP
NOTRUNC
HOST-NUMMOVE
HOST-NUMCOMPARE
SIGN-FIXUP
HOST-ARITHMETIC
defaultbyte"20"
ANIM
COBIDY
NOOPTIONAL-FILE
outdd"SYSOUT 121 L"
SHARE-OUTDD
DATAMAP
settings
list()
noform

Table of Contents Previous Section Next Section Record Structure for Test File

The following (NBRPK3B1.cpy) is the COBOL copy file that defines the record structure for the data file used by this suite of programs.

      *****************************************************************
      *               NBRPK3B1.CPY - a COBOL Copy File                *
      *       A Record Sequential File with Packed Numeric Fields     *
      *         Copyright (C) 1987-2019 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *    The length of this data structure is 80 bytes.
      *
       01  NBRPK3B1-RECORD-01.
           05  NBRPK3B1-RECORD-ID      PIC 9(2).
           05  FILLER                  PIC X(5).
           05  NBRPK3B1-GROUP-01.
               10  NBRPK3B1-FIELD-01   PIC 9(5)  comp-3.
           05  FILLER                  PIC X(5).
           05  NBRPK3B1-FIELD-02       PIC S9(5) comp-3.
           05  FILLER                  PIC X(5).
           05  NBRPK3B1-FIELD-03       PIC S9(5) comp-3.
           05  FILLER                  PIC X(5).
           05  NBRPK3B1-GROUP-04.
               10  NBRPK3B1-FIELD-04   PIC S9(5) comp-3.
           05  NBRPK3B8-CATCH-01       PIC X(12).
           05  FILLER                  PIC X(34).
      *
      ***  NBRPK3B1 - End-of-Copy File - - - - - - - - - - - NBRPK3B1 *
      *****************************************************************
      *

For additional information about the fields within the record structure refer to the following link.

Link to Internet   Link to Server   Explore an HTML document of the COBOL Copy File for NBRPK3B1. This document will provide additional information about each of the fields in the record structure that is used for the packed-decimal regression testing.

Table of Contents Previous Section Next Section Hex-Dump of Test File

The following is a Hex-Dump of a test file that contains two record.

The 1st line is the position indicator.
The 2nd line is the possible ASCII character or symbol.
The 3rd line is the high-order nibble of the byte for the Hex-dump.
The 4th line is the low-order nibble of the byte for the Hex-dump.
The 5th line is the possible EBCDIC character or symbol.

....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
01FLD1=..?FLD2=.EmFLD3=.a\FLD4=   Eye-Catcher
33444330134443304644433065444332224762467666722222222222222222222222222222222222
016C41D02F6C42D05D6C43D01C6C44D000595D314385200000000000000000000000000000000000
...<.......<....._.<..../*.<.......`.../........................................
*
01FLD1=   FLD2=.EmFLD3=.a\FLD4=...Eye-Catcher
33444332224443304644433065444339994762467666722222222222222222222222222222222222
016C41D0006C42D05D6C43D01C6C44D99C595D314385200000000000000000000000000000000000
...<.......<....._.<..../*.<...rr..`.../........................................
*
01FLD1=   FLD2=.EmFLD3=@@@FLD4=...Eye-Catcher
33444332224443304644433444444339994762467666722222222222222222222222222222222222
016C41D0006C42D05D6C43D0006C44D99C595D314385200000000000000000000000000000000000
...<.......<....._.<...   .<...rr..`.../........................................
*

Note: NBRPK3B1-FIELD-04 (positions 32-34) of the first record contains all ASCII-encoded space characters.

Note: NBRPK3B1-FIELD-01 (positions 8-10) of the second record contains all ASCII-encoded space characters.

Note: NBRPK3B1-FIELD-01 (positions 8-10) of the third record contains all ASCII-encoded space characters and NBRPK3B1-FIELD-03 (positions 24-26) of the third record contains all EBCDIC-encoded space characters.

A generated program was used to produce this hexadecimal dump information. The following provides additional detail about the hexadecimal dump program.

Link to Internet   Link to Server   Explore How to Create and Execute a Hexadecimal Dump Program for a record sequential file with eighty (80) byte records.

Table of Contents Previous Section Next Section Programatic Creation of Test Data

The test data is created by executing a COBOL program that references a COBOL Copy File.

Table of Contents Previous Section Next Section COBOL Program

The following (NBRPK3C8.cbl) is the COBOL source code for the program that is used to create the test data.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    NBRPK3C8.
       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: NBRPK3C8.CBL
      * Copy Files:    PASSJUST.CPY
      * Calls to:      SIMOJUST
      *****************************************************************
      *
      *                ************
      *                * NBRPK3J1 *
      *                ********jcl*
      *                     *
      *                ************
      *                * IEFBR14  *
      *                ********utl*
      *                     *
      *                ************     ************
      *                * NBRPK3C8 *-----*  SYSUT2  *
      *                ********cbl*     ********dat*
      *                     *
      *                ************
      *                *   EOJ    *
      *                ************
      *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SYSUT2-FILE  ASSIGN to     SYSUT2
                  ORGANIZATION is SEQUENTIAL
                  ACCESS MODE  is SEQUENTIAL
                  FILE STATUS  is SYSUT2-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  SYSUT2-FILE
           DATA RECORD    is SYSUT2-RECORD.
       01  SYSUT2-RECORD.
           05  SYSUT2-DATA-01  pic X(80).

      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* NBRPK3C8 '.
           05  T2 pic X(34) value 'Packed Numeric Field with Spaces  '.
           05  T3 pic X(10) value ' v08.06.04'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* NBRPK3C8 '.
           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 '* NBRPK3C8 '.
           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 '* NBRPK3C8 '.
           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  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* NBRPK3C8 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

       01  SYSUT2-STATUS.
           05  SYSUT2-STATUS-L     pic X.
           05  SYSUT2-STATUS-R     pic X.
       01  SYSUT2-EOF              pic X       value 'N'.
       01  SYSUT2-OPEN-FLAG        pic X       value 'C'.

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

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

       COPY NBRPK3B8.
      *
      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT
           perform SYSUT2-OPEN

           move SPACES to NBRPK3B8-GROUP-04
           move NBRPK3B8-RECORD-01 to SYSUT2-RECORD
           perform SYSUT2-WRITE

           move SPACES to NBRPK3B8-GROUP-01
           add 99999   to ZERO giving NBRPK3B8-FIELD-04
           move NBRPK3B8-RECORD-01 to SYSUT2-RECORD
           perform SYSUT2-WRITE

           move all x'40' to NBRPK3B8-GROUP-03
           add 99999   to ZERO giving NBRPK3B8-FIELD-04
           move NBRPK3B8-RECORD-01 to SYSUT2-RECORD
           perform SYSUT2-WRITE

           perform SYSUT2-CLOSE
           perform Z-THANK-YOU.
           GOBACK.

      *****************************************************************
      * I/O ROUTINES FOR SYSUT2...                                    *
      *****************************************************************
       SYSUT2-WRITE.
           if  SYSUT2-OPEN-FLAG = 'C'
               perform SYSUT2-OPEN
           end-if
           write SYSUT2-RECORD
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SYSUT2-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT2-Failure-WRITE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSUT2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT2-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open output SYSUT2-FILE
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SYSUT2-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT2-Failure-OPEN...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSUT2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT2-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SYSUT2-FILE
           if  SYSUT2-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to SYSUT2-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT2-Failure-CLOSE...' to MESSAGE-TEXT
               perform Z-DISPLAY-CONSOLE-MESSAGE
               move SYSUT2-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-CONSOLE-MESSAGE
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.
      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-CONSOLE-MESSAGE.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.
      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * two digits if the full two byte file status is numeric. If    *
      * second byte is non-numeric then it will be treated as a       *
      * binary number.                                                *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1    = '9'
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               display '* NBRPK3C8 File-Status-' IO-STAT1 '/'
                       TWO-BYTES-BINARY upon console
               display '* NBRPK3C8 File-Status-' IO-STAT1 '/'
                       TWO-BYTES-BINARY
           else
               display '* NBRPK3C8 File-Status-' IO-STATUS upon console
               display '* NBRPK3C8 File-Status-' IO-STATUS
           end-if
           exit.
      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE
           display SIM-COPYRIGHT
           exit.
      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01
           display SIM-THANKS-02
           exit.
      *****************************************************************
      *      This example is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section COBOL Copy File

The following (NBRPK3B8.cpy) is the COBOL copy file that defines the record structure that is used to create the test data.

Link to Internet   Link to Server   Explore an HTML document of the COBOL Copy File for NBRPK3B8. This document will provide additional information about each of the fields in the record structure that is used to create test data for testing the integrity of packed-decimal numeric fields.

Table of Contents Previous Section Next Section Summary

This document (with sample programs) describes the anomalies of working with packed numeric fields that contain spaces. 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 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 how to Calculate a Record Count and Accumulate Summary Totals by reading a Record Sequential Data File. Each record contains numeric fields with a packed-decimal (COMP-3) format. The count and totals will be posted to the SYSOUT device.

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

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.

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
Packed Numeric Fields with Space Characters
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com