Totals & Record Counts
Data Validation or Regression Testing
  Table of Contents  v-16.01.01 - rtntot01.htm 
  Introduction
  Execute & Review, Totals & Counts
  JCL, compute Totals & Record Count
  CMD, compute Totals & Record Count
  SYSOUT, view Totals & Record Count
  Preparation and Support
  JCL, Prepare a Test File
  Generate the Programs
  The Generated COBOL Programs
  The Primary I/O Program
  The Called Calculation Routine
  The COBOL Copy File
  COBOL Copy File for Test File
  HTML Document for Test File
  The Process Control File
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

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 currency or numeric fields. This may be used to validate Data integrity for all currency or numeric fields but is especially useful for currency amounts. The approach uses two COBOL programs that were generated using SimoTime technology. The programs are generated on a Windows System with Micro Focus COBOL and may be compiled and executed on an IBM Mainframe (ZOS or VSE) or a Linux, UNIX or Windows (LUW) System with Micro Focus COBOL.

If data files are being transferred between systems (i.e. from Mainframe System to an LUW System with Micro Focus) 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

Table of Contents Previous Section Next Section Execute & Review, Totals & Counts

This section will describe and demonstrate how to execute the job scripts and programs in a mainframe-oriented environment or a Windows environment.

Table of Contents Previous Section Next Section JCL, compute Totals & Record Count

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

//RTNTOTJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       RTNTOTJ1.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.WRK1.RTNTOTD2,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=RTNTOTV1
//RTNTOTD1 DD  DSN=SIMOTIME.DATA.RTNTOTD1,DISP=SHR
//SYSOUT   DD  DSN=SIMOTIME.WRK1.RTNTOTD2,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=121,DSORG=PS)
//

Table of Contents Previous Section Next Section CMD, compute Totals & Record Count

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 (RTNTOTW1.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
rem  * *******************************************************************
rem  *               RTNTOTW1.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 file of 80-byte records that contains numeric
rem  * fields within the records.
rem  * The programs will read the file and calculate a record count and
rem  * summary totals for user-defined numeric fields.
rem  *
rem  *                     ************
rem  *                     * RTNTOTW1 *
rem  *                     ********cmd*
rem  *                          *
rem  *                          *
rem  *    ************     ************     ************
rem  *    * RTNTOTD1 ******* RTNTOTC1 *******  SYSOUT  *
rem  *    *******rseq*     ********cbl*     *******lseq*
rem  *                          *
rem  *                          *
rem  *                     ************
rem  *                     *   EOJ    *
rem  *                     ************
rem  *
rem  * *******************************************************************
rem  * Read a File, Calculate Record Counts and Summary Totals...
rem  *
     set CmdName=RTNTOTW1
     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 RTNTOTD1=%BaseLib1%\DATA\ASC1\RTNTOTD1.dat
     set SYSOUT=%BaseLib1%\DATA\SPOOL\SYSOUT_%CmdName%.TXT
     if exist %SYSOUT% erase %SYSOUT%
     call SimoNOTE "DataTake %RTNTOTD1%"
     call SimoNOTE "DataMake %SYSOUT%"
     run RTNTOTC1
     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 SYSOUT, view Totals & Record Count

The following is the SYSOUT produced as a result of executing the job for record counts and summary totals.

* RTNTOTV1 Accumulate Totals for Numeric Data v12.01.11   helpdesk@simotime.com
* RTNTOTV1 A Program to Calculate Totals was generated by SimoTime Technologies
* RTNTOTV1 * Compiled for an ASCII environment...
* RTNTOTV1 RTNTOT01-VALUE-01                        1,235,802,647.09
* RTNTOTV1 RTNTOT01-VALUE-02                                  141.666
* RTNTOTV1 RTNTOT01-VALUE-03                                  570
* RTNTOTV1 Record count for RTNTOTD1                    000000008
* RTNTOTV1 Program to Calculate Totals generated by using SimoTime Technologies
* RTNTOTV1 Please send all inquires or suggestions to the helpdesk@simotime.com

Table of Contents Previous Section Next Section Preparation and Support

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

Table of Contents Previous Section Next Section JCL, Prepare a Test File

The following (RTNTOTJ8.jcl) is the JCL Member used to create the test file used in this example.

//RTNTOTJ8 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       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 file with numeric values for Numeric Testing.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The first job step (GETREADY) will delete any previously created
//* file. The second job step (BUILDNEW) will create a new file.
//*
//* 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
//RTNTOTD1 DD  DSN=SIMOTIME.DATA.RTNTOTD1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create and populate a new QSAM file...
//*
//BUILDNEW EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7. ..:....8
//SYSUT1   DD  *
This is Record-001              =000000000123=00000001333=00765+
This is Record-002              =000000000456=00000012222=00021-
This is Record-003              =000000000789=00000123111=00044-
This is Record-004              =123456789012=00000001000=00145+
This is Record-005              =000000001200=00000001000=00100+
This is Record-006              =000123456789=00000001000=00200+
This is Record-007              =000000003995=00000001000=00300+
This is Record-008              =000000012345=00000001000=00875-
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.RTNTOTD1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//

Table of Contents Previous Section Next Section Generate the Programs

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.

Table of Contents Previous Section Next Section The Generated COBOL Programs

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.

Table of Contents Previous Section Next Section The Primary I/O Program

The following (RTNTOTC1.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.    RTNTOTV1.
       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: 2018-07-09  Generation Time: 15:40:19:95    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   RTNTOTD1 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT RTNTOTD1-FILE  ASSIGN TO       RTNTOTD1
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS RTNTOTD1-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  RTNTOTD1-FILE
           DATA RECORD    IS RTNTOTD1-REC
           .
       01  RTNTOTD1-REC.
           05  RTNTOTD1-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 '* RTNTOTV1 '.
           05  T2 pic X(34) value 'Accumulate Totals for Numeric Data'.
           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 '* RTNTOTV1 '.
           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 '* RTNTOTV1 '.
           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 '* RTNTOTV1 '.
           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  RTNTOTD1-STATUS.
           05  RTNTOTD1-STATUS-L     pic X.
           05  RTNTOTD1-STATUS-R     pic X.
       01  RTNTOTD1-EOF              pic X       value 'N'.
       01  RTNTOTD1-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 '* RTNTOTV1 '.
           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  RTNTOTD1-LRECL    pic 9(5)    value 00080.
       01  LEN-1           pic 9(5)    value 128.
       01  POS-1           pic 9(5)    value 1.

       01  RTNTOTD1-TOTAL.
           05  filler      pic X(25) value 'Record count for RTNTOTD1'.
           05  filler      pic X(20) value SPACES.
           05  RTNTOTD1-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 RTNTOTB1.

      *****************************************************************
       PROCEDURE DIVISION.
           perform JOB-STARTING

           perform until RTNTOTD1-STATUS not = '00'
             perform RTNTOTD1-READ
             move RTNTOTD1-REC to RTNTOTD1-RECORD
             if  RTNTOTD1-STATUS = '00'
                 add RTNTOTD1-RDR to ZERO giving PA-NTOT-RRN
                 call 'RTNTOTR1' using PA-NTOT-GROUP
                                       RTNTOTD1-RECORD
             end-if
           end-perform

           perform JOB-FINISHED
           GOBACK.

      *****************************************************************
       JOB-FINISHED.
           perform RTNTOTD1-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(104:2)
                end-if
                perform Z-DISPLAY-MESSAGE-TEXT
                add 1 to PA-NTOT-IDX
              end-perform
           end-if

           move RTNTOTD1-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 RTNTOTD1-OPEN
           exit.

      *****************************************************************
      * I/O Routines for the Primary File...                          *
      *****************************************************************
       RTNTOTD1-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close RTNTOTD1-FILE
           if  RTNTOTD1-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 RTNTOTD1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move RTNTOTD1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       RTNTOTD1-READ.
           read RTNTOTD1-FILE
           if  RTNTOTD1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               add 1 to RTNTOTD1-RDR
           else
               if  RTNTOTD1-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 RTNTOTD1-EOF
               else
                   move 'READ Failure with RTNTOTD1' to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TEXT
                   move RTNTOTD1-STATUS to IO-STATUS
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       RTNTOTD1-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input RTNTOTD1-FILE
           if  RTNTOTD1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to RTNTOTD1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with RTNTOTD1' to MESSAGE-TEXT
               perform Z-DISPLAY-TO-CONSOLE
               perform Z-DISPLAY-MESSAGE-TEXT
               move RTNTOTD1-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: 2018-07-09  Generation Time: 15:40:19:97    *
      *****************************************************************

Table of Contents Previous Section Next Section The Called Calculation Routine

The following (RTNTOTR1.cbl) is the called COBOL program that does the calculations for the summary totals.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    RTNTOTR1.
       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: 2018/10/25  Generation Time: 23:33:14:68    *
      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  NTOT-FLD-00001      PIC 9(16)V9(02)   value 0.
       01  NTOT-CHR-00001.
           05  NTOT-EDT-00001  PIC Z,ZZZ,ZZZ,ZZZ,ZZZ,ZZ9.99-.

       01  NTOT-FLD-00002      PIC 9(15)V9(03)   value 0.
       01  NTOT-CHR-00002.
           05  NTOT-EDT-00002  PIC ZZZ,ZZZ,ZZZ,ZZZ,ZZ9.999-.

       01  NTOT-FLD-00003      PIC S9(18)        value 0.
       01  NTOT-CHR-00003.
           05  NTOT-EDT-00003  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 RTNTOTB1.
      *
      *****************************************************************
       PROCEDURE DIVISION USING PA-NTOT-GROUP,
                                RTNTOTD1-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 RTNTOT01-VALUE-01                  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 RTNTOT01-VALUE-02                  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 '   ' to PA-NTOT-SIGN(00002)
           add RTNTOT01-VALUE-03                  to NTOT-FLD-00003
           move NTOT-FLD-00003 to NTOT-EDT-00003
           move NTOT-CHR-00003 to PA-NTOT-NUMB(00003)
           move 'ZD' to PA-NTOT-TYPE(00003)
           move 'STS' to PA-NTOT-SIGN(00003)

           GOBACK.

      *****************************************************************
       FIRST-TIME-LOGIC.
           add 1 to ZERO giving PA-NTOT-IDX
           move 'N' to FIRST-TIME
           move 'RTNTOT01-VALUE-01'              to PA-NTOT-DESC(00001)
           move 'RTNTOT01-VALUE-02'              to PA-NTOT-DESC(00002)
           move 'RTNTOT01-VALUE-03'              to PA-NTOT-DESC(00003)
           add 00003 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: 2018/10/25  Generation Time: 23:33:14:68    *
      *****************************************************************

Table of Contents Previous Section Next Section The COBOL Copy File

The following (RTNTOTB1.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 eighty (80) bytes. The record content has one text string, three (3) numeric fields and a few filler items.

Table of Contents Previous Section Next Section COBOL Copy File for Test File

The following source member (RTNTOTB1.cpy) is the COBOL Copy File that defines the record structure for the test file.

      *****************************************************************
      *               RTNTOTB1.CPY - a COBOL Copy File                *
      *         A Record Structure Containing Numeric Fields          *
      *       Used for Calculating and Testing CheckSum Totals        *
      *         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       *
      *****************************************************************
      *
       01  RTNTOTD1-RECORD.                                             01-80
           05  RTNTOT01-ALPHA-01 PIC X(32).                             01-32
           05  FILLER            PIC X.                                 33-33
           05  RTNTOT01-VALUE-01 PIC 9(10)V99.                          34-45
           05  FILLER            PIC X.                                 46-46
           05  RTNTOT01-VALUE-02 PIC 9(8)V999.                          47-57
           05  FILLER            PIC X.                                 58-58
           05  RTNTOT01-VALUE-03 PIC S9(5) SIGN TRAILING SEPARATE.      59-64
           05  FILLER            PIC X.                                 65-65
           05  FILLER            PIC X(15).                             66-80
      *
      ***  RTNTOTB1 - End-of-Copy File - - - - - - - - - - - RTNTOTB1 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section HTML Document for Test File

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.

Link to Internet   Link to Server   Explore an HTML document that describes the Record Structure of the Test File used by the job that accumulates Summary Totals and calculates a record count. The record structure and generated HTML document for this file are based on a User-Supplied COBOL copyfile.

Table of Contents Previous Section Next Section The Process Control File

The following (RTNTOT01.pcf) is the Process Control File used to generate the COBOL programs.

***********************************************************************
*                RTNTOT02.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 a Line 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  RTNTOTB1.cpy
&HTMLFILE  rtntotb1.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    Accumulate Totals for Numeric Data
&PROGID    RTNTOTC2
&SYSUT1    name=RTNTOTD1 org=ASCII/Text recfm=FIXED    rmax=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   RTNTOTR2
&NUMREC    RTNTOTD1-RECORD
*
* The following group of statements will define the type of processing
* and the name of the numeric fields.
*
&UT1TOTAL  RTNTOT01-VALUE-01
&UT1TOTAL  RTNTOT01-VALUE-02
&UT1TOTAL  RTNTOT01-VALUE-03
*
&END

Table of Contents Previous Section Next Section Summary

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 currency or numeric fields. This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.

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

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

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

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

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

Table of Contents Previous Section Next Section Downloads and Links

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

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

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

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

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

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

Link to Internet   Link to Server   Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.

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.

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 Comments 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
Summary Totals and Record Counts, Data Validation or Regression Testing
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com