Numeric Totals & Record Counts Binary, Packed and Zoned Formats |
The SimoTime Home Page |
This suite of programs and documentation will describe and demonstrate an approach for reading a file, calculating record counts and producing summary totals for a set of pre-defined numeric fields that are defined as Binary, Packed Decimal or Zoned Decimal. This approach may be used to validate Data integrity of the numeric fields and is especially useful for currency amounts. The approach uses two COBOL programs that were generated using SimoTime technology. The programs are generated, compiled and executed on a Windows System and may be transferred, compiled and executed on an IBM Mainframe (ZOS or VSE) or a Linux, UNIX or Windows (LUW) System.
If data files are being transferred between systems (i.e. from Mainframe System to an LUW System) the programs may be executed on the Mainframe System and the output file may be used as a control or validation mechanism to ensure that all the records were transferred and the numeric totals match.
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
create a test file that contains text strings (ASCII or EBCDIC) and numeric values (Binary, Packed Decimal and Zoned Decimal) that are stored in a variety of physical formats.
This section provides a broader perspective of the test case that includes the accumulation of summary totals and the calculation of the number of records within a file.
A COBOL Copy File is used to define a record structure for a Record Sequential (RSEQ) file that contains fixed length, 80 byte records. Each record contains text strings that may be ASCII or EBCDIC encoded and numeric values that may use a Binary, Packed Decimal and Zoned Decimal format. The following shows a Windows SET command that is used to map the file name used by the programs to an actual physical file name.
set SYSUT1=d:\dirname\SIMOTIME.DATA.NBRN80D1.DAT
Note: The "d:\dirname" notation is used to define a user drive and directory name where the file is stored.
The following is an overview of the tasks involved to create and maintain the test files and validate the processes for data management functions. The functions include data conversion (file structure and record content), record presentation in hexadecimal format with possible ASCII and EBCDIC character translations and the accumulation of summary totals with record counts.
1. | Prepare the Test Data |
1.1. | Record structure for the Test Files, a COBOL Copy File |
1.2. | Create the Test files |
1.2.1. | The primary input data is created and maintained in a spread sheet and saved as a CSV Formatted File. |
1.2.2. | The 1st output test file is an ASCII encoded Record Sequential file with 80 byte, fixed length records. |
1.2.3. | The 2nd output test file is an EBCDIC encoded Record Sequential file with 80 byte, fixed length records. |
2. | Execute the Test Cases |
2.1. | EBC to ASC Convert |
2.2. | ASC to EBC Convert |
2.3. | Accumulate Summary Totals and Calculate a Record Count |
2.4. | Human Observation of Text (ASC or EBC) and Binary (Hex Dump) data |
2.4.1. | Explore how to create hexadecimal dump information of the records in a sequential file. |
2.4.2. | The records may contain text strings and numeric fields of various formats such as BINARY, PACKED-Decimal and ZONED-Decimal. |
2.4.3. | The Hex-Dump information will show the possible ASCII and EBCDIC characters. |
This section will describe and demonstrate how to execute the job scripts and programs in a mainframe-oriented environment or a Windows environment.
A JCL Member and a Windows Command File are provided to set the environment and execute the programs that do the accumulation of summary totals and record counts.
Note: The job scripts have been tested in a SimoTime Test Environment and may need to be modified in order to execute in a user environment.
This is a single step job. It will execute a program that will read a file and calculate record counts and summary totals for a set of pre-defined numeric fields. This JCL is provided to run the job in a mainframe-oriented environment such as an IBM Mainframe running ZOS or a LINUX, UNIX or Windows System running Micro Focus Enterprise Server.
The following (ASTN80J1.jcl) is the JCL Member that is used to read a file and calculate Record Counts and Summary Totals for the specified numeric fields within the records.
//ASTN80J1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* ASTN80J1.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 counts and summary totals. //* Author - SimoTime Technologies //* Date - January 24, 1996 //* //* This is a single step job. It will execute a program that will //* read a file and calculate record counts and summary totals for //* a set of pre-defined numeric fields. //* //* This set of programs will run on a mainframe under MVS or on a //* Personal Computer with Windows and Micro Focus Mainframe Express. //* //* ******************************************************************* //* Step 1 of 2, Delete any previously created file... //* //GETREADY EXEC PGM=IEFBR14 //WORKFILE DD DSN=SIMOTIME.SYSOUT.NBRN80J1,DISP=(MOD,DELETE,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=121,DSORG=PS) //* //* ******************************************************************* //* Step 2 of 2, Calculate record counts and summary totals... //* //NUMTOTAL EXEC PGM=ASTN80C1 //SYSUT1 DD DSN=SIMOTIME.DATA.NBRN80A2,DISP=SHR //SYSOUT DD DSN=SIMOTIME.SYSOUT.NBRN80J1,DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=121,DSORG=PS) //
This is a single step task. It will execute a program that will read a file and calculate record counts and summary totals for a set of pre-defined numeric fields. This command file is provided to run the task in a Windows environment with Micro Focus COBOL.
The following (ASTN80W1.cmd) is the CMD File that is used to read a file and calculate Record Counts and Summary Totals for the specified numeric fields within the records.
@echo OFF set CmdName=ASTN80W1 rem * ******************************************************************* rem * ASTN80W1.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 user-defined text fields and numeric fields. rem * The programs will calculate a record count and accumulate summary rem * totals for the numeric fields. rem * The physical format for the numeric fields are Binary, Packed rem * Decimal and Zoned Decimal and may be unsigned or signed. rem * rem * rem * ************ rem * * ASTN80W1 * rem * ********cmd* rem * * rem * ************ rem * * ENV1BASE * * Job Prepare rem * ********cmd* rem * * rem * ************ ************ ************ rem * * SYSUT1 *-----* ASTN80C1 *--*--* SYSOUT * * File I/O rem * *******rseq* ********cbl* * *******lseq* rem * * * rem * * * rem * * * ************ rem * * *--* ASTN80R1 * * Do Totals rem * * ********cbl* 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" set SYSUT1=%BaseLib1%\DATA\ASC1\SIMOTIME.DATA.NBRN80D1.DAT set SYSOUT=%BaseLib1%\DATA\SPOOL\SYSOUT_%CmdName%.TXT if exist %SYSOUT% erase %SYSOUT% call SimoNOTE "DataTake %SYSUT1%" call SimoNOTE "DataMake %SYSOUT%" run ASTN80C1 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
The results of the totals accumulation process are written to the SYSOUT device. The file structure for the SYSOUT device is typically configured as a sequential file with 121 byte records. The record content is text-oriented and may be viewed with a text editor of choice.
The following is the SYSOUT produced as a result of executing the job for record counts and summary totals.
* ASTN80C1 Numeric Totals for BN, PK and ZD v18.06.01 helpdesk@simotime.com * ASTN80C1 A Program to Calculate Totals was generated by SimoTime Technologies * ASTN80C1 * HEX20 parameter is DISABLE * ASTN80C1 * HEX40 parameter is DISABLE * ASTN80C1 * HEXTR parameter is DISABLE * ASTN80C1 * NUMCHK parameter is DISABLE * ASTN80C1 ************************************************************************************************************ * ASTN80C1 Field Name Summary.Total HEX40 HEX20 NUMCHK TYPE * ASTN80C1 NBRN80-FLD-ZDU-5-0 861 ZD * ASTN80C1 NBRN80-FLD-ZDS-5-0 615- ZDS * ASTN80C1 NBRN80-FLD-PKU-5-0 861 PK * ASTN80C1 NBRN80-FLD-PKS-5-0 615- PKS * ASTN80C1 NBRN80-FLD-BNU-5-0 861 BN * ASTN80C1 NBRN80-FLD-BNS-5-0 615- BNS * ASTN80C1 Record count for SYSUT1 000000004 * ASTN80C1 Field Name Summary.Total HEX40 HEX20 NUMCHK TYPE * ASTN80C1 ************************************************************************************************************ * ASTN80C1 Program to Calculate Totals generated by using SimoTime Technologies * ASTN80C1 Please send all comments or suggestions to the helpdesk@simotime.com
The section will describe and demonstrate the tasks that will create a test file and generate the COBOL programs. The generation process requires a Windows System (Windows/7 or later) and Micro Focus COBOL to generate the COBOL source code. The generated COBOL source code may then be compiled and executed on an IBM Mainframe or a Linux, UNIX or Windows system with Micro Focus.
The preparation of the test file is covered in a separate document.
Explore how to create a file that contains text and binary data. This document describes a model for creating a record sequential file that contains text strings that use EBCDIC or ASCII encoding and various numeric formats such as BINARY, PACKED-Decimal and ZONED-Decimal. This model has the capability of creating a test file for an ASCII or EBCDIC encoded environment. This document will address many of the challenges of doing a record content conversion of a file that will be transferred between an EBCDIC-encoded Mainframe System and an ASCII-encoded Linux, UNIX or Windows System.
This process will use a COBOL copy file and a Process Control File to generate the COBOL programs that will read a file and call a second program to calculate summary totals.
The COBOL programs in this example are generated using the SimoTime Enterprise Technologies for Application and Data Migrations. The generation technology uses a COBOL copy file for a definition of the record structure and a Process Control File to define and control the structure and behavior of the generated programs.
The following (ASTN80C1.cbl) is the COBOL program that does the file I/O and calls the routine that does the calculations for the summary totals.
IDENTIFICATION DIVISION. PROGRAM-ID. ASTN80C1. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * This program was generated by SimoZAPS * * A product of SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * * Generation Date: 2019-04-18 Generation Time: 13:24:40:96 * * * * Record Record Key * * Function Name Organization Format Max-Min Pos-Len * * PRIMARY SYSUT1 SEQUENTIAL FIXED 00080 * * * * * ***************************************************************** ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT SYSUT1-FILE ASSIGN TO SYSUT1 ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL FILE STATUS IS SYSUT1-STATUS. ***************************************************************** DATA DIVISION. FILE SECTION. FD SYSUT1-FILE DATA RECORD IS SYSUT1-REC . 01 SYSUT1-REC. 05 SYSUT1-DATA-01 PIC X(00080). ***************************************************************** * This set of programs will create summary totals for * * pre-defined user-fields. The SYSNTOT1.TXT template file was * * used to create this program. This program has the option to * * process packed fields with non-numeric values or all space * * characters. The fields with invalid characters or all spacces * * are set to a zero value prior to being used to calculate the * * summary totals. The input file is NOT updated. * * * * If Packed fields (i.e. COMP-3) are used and the packed fields * * contain SPACE characters this program may ABEND with a * * Mainframe S0C7 error or a Micro Foocus 163 Error. * * * * On the Mainframe System the NUMPROC(NOPFD) Compiler option * * may be used to avoid the S0C7 ABEND. * * * * In the Micro Focus environment the SIGNFIXUP Compiler * * directive may be used in conjunction with not using the * * CHECKNUM Compiler directive. * * * * Note: the process that causes the packed fields to contain * * SPACE characters should be addressed. The Compiler options * * only prevent the error message but may produce in incorrect * * results when used in arithmetic processing. * * * * The End-of-Job processing will post the summary totals and * * record count information to the SYSOUT device. * * * * For more information or questions please contact SimoTime * * Technologies. The version control number is 18.06.01 * * * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * ***************************************************************** WORKING-STORAGE SECTION. 01 SIM-TITLE. 05 T1 pic X(11) value '* ASTN80C1 '. 05 T2 pic X(34) value 'Numeric Totals for BN, PK and ZD '. 05 T3 pic X(10) value ' v18.06.01'. 05 T4 pic X(24) value ' helpdesk@simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* ASTN80C1 '. 05 C2 pic X(32) value 'A Program to Calculate Totals wa'. 05 C3 pic X(32) value 's generated by SimoTime Technolo'. 05 C4 pic X(04) value 'gies'. 01 SIM-THANKS-01. 05 C1 pic X(11) value '* ASTN80C1 '. 05 C2 pic X(32) value 'Program to Calculate Totals gene'. 05 C3 pic X(32) value 'rated by using SimoTime Technolo'. 05 C4 pic X(04) value 'gies'. 01 SIM-THANKS-02. 05 C1 pic X(11) value '* ASTN80C1 '. 05 C2 pic X(32) value 'Please send all comments or sugg'. 05 C3 pic X(32) value 'estions to the helpdesk@simotime'. 05 C4 pic X(04) value '.com'. 01 SYSUT1-STATUS. 05 SYSUT1-STATUS-L pic X. 05 SYSUT1-STATUS-R pic X. 01 SYSUT1-EOF pic X value 'N'. 01 SYSUT1-OPEN-FLAG pic X value 'C'. 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'. ***************************************************************** * The following buffers are used to create a four-byte status * * code that may be displayed. * ***************************************************************** 01 IO-STATUS. 05 IO-STAT1 pic X. 05 IO-STAT2 pic X. 01 IO-STATUS-04. 05 IO-STATUS-0401 pic 9 value 0. 05 IO-STATUS-0403 pic 999 value 0. 01 TWO-BYTES-BINARY pic 9(4) BINARY. 01 TWO-BYTES-ALPHA redefines TWO-BYTES-BINARY. 05 TWO-BYTES-LEFT pic X. 05 TWO-BYTES-RIGHT pic X. ***************************************************************** * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. * ***************************************************************** 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(011) value '* ASTN80C1 '. 05 MESSAGE-TEXT. 10 MESSAGE-TEXT-1 pic X(068) value SPACES. 10 MESSAGE-TEXT-2 pic X(188) value SPACES. 01 MSG-LSB pic 9(5) value 267. ***************************************************************** 01 APPL-RESULT pic S9(9) comp. 88 APPL-AOK value 0. 88 APPL-EOF value 16. 01 HEX20-PARM pic X(16) value 'DISABLE '. 01 HEX40-PARM pic X(16) value 'DISABLE '. 01 HEXPK-PARM pic X(16) value 'DISABLE '. 01 HEXTR-PARM pic X(16) value 'DISABLE '. 01 NUMCHK-PARM pic X(16) value 'DISABLE '. 01 SYSUT1-LRECL pic 9(5) value 00080. 01 LEN-1 pic 9(5) value 128. 01 POS-1 pic 9(5) value 1. 01 SYSUT1-TOTAL. 05 filler pic X(25) value 'Record count for SYSUT1 '. 05 filler pic X(20) value SPACES. 05 SYSUT1-RDR pic 9(9) value 0. 01 FORMAT-TYPE pic X value 'B'. 01 PT-1 pic 999 value 0. 01 PT-2 pic 999 value 0. 01 PT-3 pic 999 value 0. 01 WORK-32 pic X(32) value SPACES. 01 DECIMAL-CHR pic X value '.'. COPY PANTOTB1. COPY NBRN80B1. ***************************************************************** PROCEDURE DIVISION. perform JOB-STARTING perform until SYSUT1-STATUS not = '00' perform SYSUT1-READ move SYSUT1-REC to NBRN80-RECORD if SYSUT1-STATUS = '00' add SYSUT1-RDR to ZERO giving PA-NTOT-RRN call 'ASTN80R1' using PA-NTOT-GROUP NBRN80-RECORD end-if end-perform perform JOB-FINISHED GOBACK. ***************************************************************** JOB-FINISHED. perform SYSUT1-CLOSE move all '*' to MESSAGE-TEXT(1:108) perform Z-DISPLAY-MESSAGE-TEXT move 'Field Name' to MESSAGE-TEXT move 'Summary.Total' to MESSAGE-TEXT(48:13) move ' HEX40' to MESSAGE-TEXT(75:7) move ' HEX20' to MESSAGE-TEXT(85:7) move ' NUMCHK' to MESSAGE-TEXT(95:7) move 'TYPE' to MESSAGE-TEXT(103:4) perform Z-DISPLAY-MESSAGE-TEXT if PA-NTOT-HOT > ZERO add 1 to ZERO giving PA-NTOT-IDX perform until PA-NTOT-IDX > PA-NTOT-HOT move ZERO to PT-1 move ZERO to PT-2 move ZERO to PT-3 move PA-NTOT-NUMB(PA-NTOT-IDX) to WORK-32 perform varying PT-1 from 1 by 1 until PT-1 > 31 if WORK-32(PT-1:1) = DECIMAL-CHR add PT-1 to ZERO giving PT-2 end-if if WORK-32(PT-1:1) = 0 or WORK-32(PT-1:1) > 0 and WORK-32(PT-1:1) < 9 or WORK-32(PT-1:1) = 9 add PT-1 to ZERO giving PT-3 end-if end-perform if PT-2 > 0 and PT-3 > PT-2 compute PT-1 = 56 - PT-3 + (PT-3 - PT-2) else if PT-3 > 0 compute PT-1 = 55 - PT-3 else add 37 to ZERO giving PT-1 end-if end-if move PA-NTOT-DESC(PA-NTOT-IDX) to MESSAGE-TEXT move PA-NTOT-NUMB(PA-NTOT-IDX) to MESSAGE-TEXT(PT-1:32) if PA-HEX40-CTR(PA-NTOT-IDX) > 0 move PA-HEX40-CTR(PA-NTOT-IDX) to MESSAGE-TEXT(75:7) end-if if PA-HEX20-CTR(PA-NTOT-IDX) > 0 move PA-HEX20-CTR(PA-NTOT-IDX) to MESSAGE-TEXT(85:7) end-if if PA-NUMCHK-CTR(PA-NTOT-IDX) > 0 move PA-NUMCHK-CTR(PA-NTOT-IDX) to MESSAGE-TEXT(95:7) end-if if PA-NTOT-TYPE(PA-NTOT-IDX) not = SPACES move PA-NTOT-TYPE(PA-NTOT-IDX) to MESSAGE-TEXT(103:2) end-if move PA-NTOT-SIGN(PA-NTOT-IDX) to MESSAGE-TEXT(105:3) perform Z-DISPLAY-MESSAGE-TEXT add 1 to PA-NTOT-IDX end-perform end-if move SYSUT1-TOTAL to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move 'Field Name' to MESSAGE-TEXT move 'Summary.Total' to MESSAGE-TEXT(48:13) move ' HEX40' to MESSAGE-TEXT(75:7) move ' HEX20' to MESSAGE-TEXT(85:7) move ' NUMCHK' to MESSAGE-TEXT(95:7) move 'TYPE' to MESSAGE-TEXT(103:4) perform Z-DISPLAY-MESSAGE-TEXT move all '*' to MESSAGE-TEXT(1:108) perform Z-DISPLAY-MESSAGE-TEXT perform Z-THANK-YOU. exit. ***************************************************************** JOB-STARTING. perform Z-POST-COPYRIGHT perform Z-DETERMINE-ENVIRONMENT initialize PA-NTOT-GROUP add 256 to ZERO giving PA-NTOT-LTD perform SYSUT1-OPEN exit. ***************************************************************** * I/O Routines for the Primary File... * ***************************************************************** SYSUT1-CLOSE. add 8 to ZERO giving APPL-RESULT. close SYSUT1-FILE if SYSUT1-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'CLOSE Failure with SYSUT1 ' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move SYSUT1-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* SYSUT1-READ. read SYSUT1-FILE if SYSUT1-STATUS = '00' subtract APPL-RESULT from APPL-RESULT add 1 to SYSUT1-RDR else if SYSUT1-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 if APPL-EOF move 'Y' to SYSUT1-EOF else move 'READ Failure with SYSUT1 ' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move SYSUT1-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if exit. *---------------------------------------------------------------* SYSUT1-OPEN. add 8 to ZERO giving APPL-RESULT. open input SYSUT1-FILE if SYSUT1-STATUS = '00' subtract APPL-RESULT from APPL-RESULT move 'O' to SYSUT1-OPEN-FLAG else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'OPEN Failure with SYSUT1 ' to MESSAGE-TEXT perform Z-DISPLAY-TO-CONSOLE perform Z-DISPLAY-MESSAGE-TEXT move SYSUT1-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. ***************************************************************** * The following Z-ROUTINES provide administrative functions * * for this program. * ***************************************************************** * 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-MESSAGE-TEXT end-if move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT add 12 to ZERO giving RETURN-CODE STOP RUN. * exit. ***************************************************************** Z-DETERMINE-ENVIRONMENT. move '* HEX20 parameter is ' to MESSAGE-TEXT move HEX20-PARM to MESSAGE-TEXT(23:16) perform Z-DISPLAY-MESSAGE-TEXT move '* HEX40 parameter is ' to MESSAGE-TEXT move HEX40-PARM to MESSAGE-TEXT(23:16) perform Z-DISPLAY-MESSAGE-TEXT move '* HEXTR parameter is ' to MESSAGE-TEXT move HEXTR-PARM to MESSAGE-TEXT(23:16) perform Z-DISPLAY-MESSAGE-TEXT move '* NUMCHK parameter is ' to MESSAGE-TEXT move NUMCHK-PARM to MESSAGE-TEXT(23:16) perform Z-DISPLAY-MESSAGE-TEXT exit. ***************************************************************** Z-CALCULATE-MESSAGE-LSB. add 267 to ZERO giving MSG-LSB perform until MSG-LSB < 80 or MESSAGE-BUFFER(MSG-LSB:1) not = SPACE if MESSAGE-BUFFER(MSG-LSB:1) = SPACE subtract 1 from MSG-LSB end-if end-perform exit. ***************************************************************** * Display to SYSOUT Device... * ***************************************************************** Z-DISPLAY-MESSAGE-TEXT. perform Z-CALCULATE-MESSAGE-LSB display MESSAGE-BUFFER(1:MSG-LSB) move all SPACES to MESSAGE-TEXT exit. ***************************************************************** * Display CONSOLE messages... * ***************************************************************** Z-DISPLAY-TO-CONSOLE. perform Z-CALCULATE-MESSAGE-LSB display MESSAGE-BUFFER(1:MSG-LSB) upon console exit. ***************************************************************** * Display the file status bytes. This routine will display as * * four digits. If the full two byte file status is numeric it * * will display as 00nn. If the 1st byte is a numeric nine (9) * * the second byte will be treated as a binary number and will * * display as 9nnn. * ***************************************************************** Z-DISPLAY-IO-STATUS. if IO-STATUS not NUMERIC or IO-STAT1 = '9' move IO-STAT1 to IO-STATUS-04(1:1) subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY move IO-STAT2 to TWO-BYTES-RIGHT add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403 move 'File Status is: nnnn' to MESSAGE-TEXT move IO-STATUS-04 to MESSAGE-TEXT(17:4) perform Z-DISPLAY-TO-CONSOLE perform Z-DISPLAY-MESSAGE-TEXT else move '0000' to IO-STATUS-04 move IO-STATUS to IO-STATUS-04(3:2) move 'File Status is: nnnn' to MESSAGE-TEXT move IO-STATUS-04 to MESSAGE-TEXT(17:4) perform Z-DISPLAY-TO-CONSOLE perform Z-DISPLAY-MESSAGE-TEXT end-if exit. ***************************************************************** Z-POST-COPYRIGHT. move SIM-TITLE to MESSAGE-BUFFER perform Z-DISPLAY-MESSAGE-TEXT move SIM-COPYRIGHT to MESSAGE-BUFFER perform Z-DISPLAY-MESSAGE-TEXT exit. ***************************************************************** Z-THANK-YOU. move SIM-THANKS-01 to MESSAGE-BUFFER perform Z-DISPLAY-MESSAGE-TEXT move SIM-THANKS-02 to MESSAGE-BUFFER perform Z-DISPLAY-MESSAGE-TEXT exit. ***************************************************************** * This program was generated by SimoZAPS * * A product of SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * * Generation Date: 2019-04-18 Generation Time: 13:24:40:99 * *****************************************************************
The following (ASTN80R1.cbl) is the called COBOL program that does the calculations for the summary totals.
IDENTIFICATION DIVISION. PROGRAM-ID. ASTN80R1. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * This routine was generated by SimoREC1 * * A product of SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * Generation Date: 2019/04/18 Generation Time: 13:24:41:02 * ***************************************************************** DATA DIVISION. WORKING-STORAGE SECTION. 01 NTOT-FLD-00001 PIC 9(18) value 0. 01 NTOT-CHR-00001. 05 NTOT-EDT-00001 PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9-. 01 NTOT-FLD-00002 PIC S9(18) value 0. 01 NTOT-CHR-00002. 05 NTOT-EDT-00002 PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9-. 01 NTOT-FLD-00003 PIC 9(18) value 0. 01 NTOT-CHR-00003. 05 NTOT-EDT-00003 PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9-. 01 NTOT-FLD-00004 PIC S9(18) value 0. 01 NTOT-CHR-00004. 05 NTOT-EDT-00004 PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9-. 01 NTOT-FLD-00005 PIC 9(18) value 0. 01 NTOT-CHR-00005. 05 NTOT-EDT-00005 PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9-. 01 NTOT-FLD-00006 PIC S9(18) value 0. 01 NTOT-CHR-00006. 05 NTOT-EDT-00006 PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9-. 01 IX-P1 pic 9(9) value 0. 01 IX-P2 pic 9(9) value 0. 01 IX-NP pic 9(5) value 0. 01 IX-L1 pic 9(9) value 0. 01 RA-P1 pic 9(3) value 0. 01 RA-P2 pic 9(3) value 0. 01 FIRST-TIME pic X value 'Y'. 01 PERFORM-QUIT pic X value 'N'. * ***************************************************************** LINKAGE SECTION. COPY PANTOTB1. COPY NBRN80B1. * ***************************************************************** PROCEDURE DIVISION USING PA-NTOT-GROUP, NBRN80-RECORD. if FIRST-TIME = 'Y' or PA-NTOT-RESET = 'Y' perform FIRST-TIME-LOGIC end-if * HEX20 Parameter is DISABLE * HEX40 Parameter is DISABLE * HEXTR Parameter is DISABLE * NUMCHK Parameter is DISABLE add NBRN80-FLD-ZDU-5-0 to NTOT-FLD-00001 move NTOT-FLD-00001 to NTOT-EDT-00001 move NTOT-CHR-00001 to PA-NTOT-NUMB(00001) move 'ZD' to PA-NTOT-TYPE(00001) move ' ' to PA-NTOT-SIGN(00001) add NBRN80-FLD-ZDS-5-0 to NTOT-FLD-00002 move NTOT-FLD-00002 to NTOT-EDT-00002 move NTOT-CHR-00002 to PA-NTOT-NUMB(00002) move 'ZD' to PA-NTOT-TYPE(00002) move 'S ' to PA-NTOT-SIGN(00002) add NBRN80-FLD-PKU-5-0 to NTOT-FLD-00003 move NTOT-FLD-00003 to NTOT-EDT-00003 move NTOT-CHR-00003 to PA-NTOT-NUMB(00003) move 'PK' to PA-NTOT-TYPE(00003) move ' ' to PA-NTOT-SIGN(00003) add NBRN80-FLD-PKS-5-0 to NTOT-FLD-00004 move NTOT-FLD-00004 to NTOT-EDT-00004 move NTOT-CHR-00004 to PA-NTOT-NUMB(00004) move 'PK' to PA-NTOT-TYPE(00004) move 'S ' to PA-NTOT-SIGN(00004) add NBRN80-FLD-BNU-5-0 to NTOT-FLD-00005 move NTOT-FLD-00005 to NTOT-EDT-00005 move NTOT-CHR-00005 to PA-NTOT-NUMB(00005) move 'BN' to PA-NTOT-TYPE(00005) move ' ' to PA-NTOT-SIGN(00005) add NBRN80-FLD-BNS-5-0 to NTOT-FLD-00006 move NTOT-FLD-00006 to NTOT-EDT-00006 move NTOT-CHR-00006 to PA-NTOT-NUMB(00006) move 'BN' to PA-NTOT-TYPE(00006) move 'S ' to PA-NTOT-SIGN(00006) GOBACK. ***************************************************************** FIRST-TIME-LOGIC. add 1 to ZERO giving PA-NTOT-IDX move 'N' to FIRST-TIME move 'NBRN80-FLD-ZDU-5-0' to PA-NTOT-DESC(00001) move 'NBRN80-FLD-ZDS-5-0' to PA-NTOT-DESC(00002) move 'NBRN80-FLD-PKU-5-0' to PA-NTOT-DESC(00003) move 'NBRN80-FLD-PKS-5-0' to PA-NTOT-DESC(00004) move 'NBRN80-FLD-BNU-5-0' to PA-NTOT-DESC(00005) move 'NBRN80-FLD-BNS-5-0' to PA-NTOT-DESC(00006) add 00006 to ZERO giving PA-NTOT-HOT exit. ***************************************************************** * This routine was generated by SimoREC1 * * A product of SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * Generation Date: 2019/04/18 Generation Time: 13:24:41:02 * *****************************************************************
The following (NBRN80B1.cpy) is the COBOL copy file used to generate the COBOL programs that will calculate Summary Totals .
The file format for the test file is record sequential with a fixed record length of 256 bytes. The record content has text strings, numeric fields of various formats and a few filler items.
The following source member (NBRN80B1.cpy) is the COBOL Copy File that defines the record structure for the test file.
***************************************************************** * NBRN80B1.cpy - a COBOL Copy File * * A Variety of Numeric Formats * * 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 test cases that are used to create and maintain this * file may be reviewed at the following location. * http://www.simotime.com/crtn8008.htm * * The USAGE clause specifies the format of a data item in * computer memory or in a record within a file. * * If a USAGE clause is missing the default format is DISPLAY. * * An abbreviated form of the USAGE clause may be used. For * example, USAGE IS COMPUTATIONAL-3 may be specified as * COMP-3 without the USAGE IS verbage. * * USAGE Numeric Type Notes * -------- --------------- -------------------------------- * DISPLAY Zoned-Decimal Sensitive to ASC/EBC Encoding, * Logical Size is User Defined, * Physical Size = Logical Size. * COMP-3 Packed-Decimal Exempt from ASC/EBC Encoding, * Logical Size is User Defined, * Physical Size is Calculated * during program compilation. * COMP Binary Exempt from ASC/EBC Encoding, * Logical Size is User Defined, * Physical Size is Calculated * during program compilation and * may be determined by the System * Architecture or Compiler * Directives. * * The notation in columns 73-80 is for documentation purposes * only and identifies the column that would be used for the * field content if a spreadsheet software package were used * to create test data. * * .1....:....2....:....3....:....4....:....5....:....6....:....7....:....8 * 01 NBRN80-RECORD. 05 NBRN80-FLD-TXT-ZDU-5-0 pic X(8). COL-A 05 NBRN80-FLD-ZDU-5-0 pic 9(5) usage is DISPLAY. COL-B 05 NBRN80-FLD-TXT-ZDS-5-0 pic X(8). COL-C 05 NBRN80-FLD-ZDS-5-0 pic S9(5) usage is DISPLAY. COL-D 05 NBRN80-FLD-TXT-PKU-5-0 pic X(8). COL-E 05 NBRN80-FLD-PKU-5-0 pic 9(5) usage is COMP-3. COL-F 05 NBRN80-FLD-TXT-PKS-5-0 pic X(8). COL-G 05 NBRN80-FLD-PKS-5-0 pic S9(5) usage is COMP-3. COL-H 05 NBRN80-FLD-TXT-BNU-5-0 pic X(8). COL-I 05 NBRN80-FLD-BNU-5-0 pic 9(5) usage is COMP. COL-J 05 NBRN80-FLD-TXT-BNS-5-0 pic X(8). COL-K 05 NBRN80-FLD-BNS-5-0 pic S9(5) usage is COMP. COL-L 05 NBRN80-FLD-TEXT pic X(6). COL-M 05 NBRN80-FLD-FILLER pic X(2). * *** NBRN80B1 - End-of-Copy File - - - - - - - - - - - NBRN80B1 * ***************************************************************** *
The SimoTime Technologies have the ability to scan a COBOL copy file and create an HTML document of a record structure or record layout. The HTML documentation provides information that is not easy to obtain by viewing the COBOL copy file. For example, the physical position of a field within a record as calculated during the copy file scan and placed in the HTML document.
Explore a Data Structure that contains binary, numeric and text strings and is based on the field definitions within a User-Defined COBOL copy file. The copy file is used to define the record structure for a file that contains 80 byte, fixed length records. This HTML document is generated using SIMOTIME Technologies.
The following (ASTN8001.pcf) is the Process Control File used to generate the COBOL programs.
*********************************************************************** * ASTN8001.pcf - a Process Control File * * Accumulate Record Counts and Totals for Numeric Fields * * (C) Copyright 1987-2020 All Rights Reserved * * Web Site URL: http://www.simotime.com * * e-mail: helpdesk@simotime.com * *********************************************************************** * SYSUT1 is a Record Sequential File with 80-byte records. *********************************************************************** * This Process Control File will be used to generate a set of COBOL * programs that will Accumulate Summary 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 ©FILE NBRN80B1.cpy &HTMLFILE nbrn80b1.htm &USRMODEL SYSNTOT1.txt * * 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 Numeric Totals for BN, PK and ZD &PROGID ASTN80C1 &SYSUT1 org=Sequential recfm=FIXED rmax=80 * * The following two statements are used when the records in the data * file (input or output) are a Comma-Separated-Values (or CSV) format. * &DELIMITER , &FRAME " * * 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 ASTN80R1 &NUMREC NBRN80-RECORD * * The following group of statements will define the type of processing * and the name of the numeric fields. * &UT1TOTAL NBRN80-FLD-ZDU-5-0 &UT1TOTAL NBRN80-FLD-ZDS-5-0 &UT1TOTAL NBRN80-FLD-PKU-5-0 &UT1TOTAL NBRN80-FLD-PKS-5-0 &UT1TOTAL NBRN80-FLD-BNU-5-0 &UT1TOTAL NBRN80-FLD-BNS-5-0 * &END
The purpose of this document is to describe how to read a file and accumulate a group of user-defined summary totals based on the field names and field formats as specified in a COBOL copy file. 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
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.
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: 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.
The following group of links will describe the structure for a Record Sequential (RSEQ) file and demonstrate the processing techniques used to perform various data management tasks. The file contains fixed length, 80 byte records. Each record contains text strings that may be ASCII or EBCDIC encoded and numeric values that may use a Binary, Packed Decimal or Zoned Decimal format.
Explore a Data Structure that contains binary, numeric and text strings and is based on the field definitions within a User-Defined COBOL copy file. The copy file is used to define the record structure for a file that contains 80 byte, fixed length records. This HTML document is generated using SIMOTIME Technologies.
Explore how to create a file that contains text and binary data. This document describes a model for creating a record sequential file that contains text strings that use EBCDIC or ASCII encoding and various numeric formats such as BINARY, PACKED-Decimal and ZONED-Decimal. This model has the capability of creating a test file for an ASCII or EBCDIC encoded environment. This document will address many of the challenges of doing a record content conversion of a file that will be transferred between an EBCDIC-encoded Mainframe System and an ASCII-encoded Linux, UNIX or Windows System.
Explore How to do EBC to ASC Data Conversion of an 80 byte Data Structure. The data structure contains ASCII or EBCDIC Text Strings and Numeric Values that use a Binary, Packed Decimal or Zoned Decimal format. The binary strings will be bypassed, the numeric strings will be processed based on their numeric type and the text strings will be converted from EBC to ASC based on a user selected conversion table. This document will describe and demonstrate the conditional processing of individual string types within a data structure based on a COBOL copy file that defines the data structure.
Explore How to do ASC to EBC Data Conversion of an 80 byte Data Structure. The data structure contains ASCII or EBCDIC Text Strings and Numeric Values that use a Binary, Packed Decimal or Zoned Decimal format. The binary strings will be bypassed, the numeric strings will be processed based on their numeric type and the text strings will be converted from ASC to EBC based on a user selected conversion table. This document will describe and demonstrate the conditional processing of individual string types within a data structure based on a COBOL copy file that defines the data structure.
Explore How to Accumulate Summary Totals and Calculate a Record Count of an 80 byte Data Structure. The data structure contains ASCII or EBCDIC Text Strings and Numeric Values that use a Binary, Packed Decimal or Zoned Decimal format. The numeric strings within the data structure will be identified based on the field definitions within a COBOL copy file.
Explore How to create Hexadecimal Dump Information of the 80 byte records within a sequential file. The record structure may contain ASCII or EBCDIC Text Strings and Numeric Values that use a Binary, Packed Decimal or Zoned Decimal format. The intent is to provide for human observation of both text and binary data within a data structure. The hexadecimal dump information may be written to an ASCII/Text file and viewed using a text editor of choice.
The following links provide additional reference material.
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 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 File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.
The following links will require an internet connection.
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.
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
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.
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 |
Summary Totals and Record Counts, Binary, Packed and Zoned Formats |
Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |