table of contentsiseries.realdolmen.com/iddos/pdf/cbl04 - batchprogram - detail... · table of...

45
TABLE OF CONTENTS CBL04: BATCH PROGRAM : DETAIL DESCRIPTION ..................................................................................... 1 4.1 THE EXAMPLE PROGRAM : DESCRIPTION. ....................................................................................................... 2 4.2 THE EXAMPLE PROGRAM : TECHNICAL ANALYSIS. ........................................................................................ 3 4.3 THE EXAMPLE PROGRAM : PRINTER FILE. ...................................................................................................... 4 4.4 IDENTIFICATION DIVISION ..................................................................................................................... 5 4.5 ENVIRONMENT DIVISION ....................................................................................................................... 6 4.5.1 CONFIGURATION SECTION .............................................................................................................. 6 4.5.2 INPUT-OUTPUT SECTION .................................................................................................................. 7 4.5.2.1 The Printer Files. ................................................................................................................................................. 7 4.5.2.2 Files used in the program. ................................................................................................................................... 8 4.6 DATA DIVISION.......................................................................................................................................... 9 4.6.1 FILE SECTION...................................................................................................................................... 9 4.6.2 WORKING-STORAGE SECTION ....................................................................................................... 10 4.6.3 Default Parameter lists in the program. .............................................................................................. 11 4.6.3.1 PARM-IPC : IDDOS parameter data structure. ................................................................................................ 12 4.6.3.2 Checking values and ranges. ............................................................................................................................. 13 4.6.3.3 Date Validity check. .......................................................................................................................................... 13 4.6.3.4 Error Handling. ................................................................................................................................................. 14 4.6.4 Separate indicator area. ...................................................................................................................... 15 4.6.5 Printer files : Record Formats. ............................................................................................................ 16 4.6.6 Additional data structures. .................................................................................................................. 16 4.6.7 Level Break processing data structures. .............................................................................................. 17 4.6.8 WORK and TOTAL fields. ................................................................................................................... 18 4.6.9 File-keys section. ................................................................................................................................. 19 4.6.10 Working-storage user. ......................................................................................................................... 20 4.6.11 LINKAGE SECTION. .......................................................................................................................... 20 4.7 PROCEDURE DIVISION ........................................................................................................................... 21 4.7.1 DECLARATIVES ................................................................................................................................. 21 4.7.2 MAIN SECTION .................................................................................................................................. 22 4.7.3 DRIVER SECTION : Super-level program driver. .............................................................................. 23 4.7.4 INPUT SECTION : Based-on primary file. ......................................................................................... 24 4.7.5 The Record control routine. ................................................................................................................. 26 4.7.6 LEVEL BREAK SECTION. .................................................................................................................. 27 4.7.7 Level 00 Processing. ............................................................................................................................ 28 4.7.8 Level nn Processing. ............................................................................................................................ 29 4.7.9 Total Processing : level 35. ................................................................................................................. 31 4.7.10 Header formats. ................................................................................................................................... 32 4.8 FILE ROUTINES ........................................................................................................................................ 33 4.8.1 File Handling : Read ........................................................................................................................... 33 4.8.2 User Written subroutines. .................................................................................................................... 34 4.8.3 Program Initialisation routine. ............................................................................................................ 34 4.8.4 OPEN routine. ..................................................................................................................................... 35 4.8.5 CLOSE routine. ................................................................................................................................... 35 4.9 PROGRAM ROUTINES. ................................................................................................................................... 36 4.10 PROGRAM FIELDS. ........................................................................................................................................ 38

Upload: others

Post on 25-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

TABLE OF CONTENTS

CBL04: BATCH PROGRAM : DETAIL DESCRIPTION ..................................................................................... 1

4.1 THE EXAMPLE PROGRAM : DESCRIPTION. ....................................................................................................... 2 4.2 THE EXAMPLE PROGRAM : TECHNICAL ANALYSIS. ........................................................................................ 3 4.3 THE EXAMPLE PROGRAM : PRINTER FILE. ...................................................................................................... 4 4.4 IDENTIFICATION DIVISION ..................................................................................................................... 5 4.5 ENVIRONMENT DIVISION ....................................................................................................................... 6

4.5.1 CONFIGURATION SECTION .............................................................................................................. 6

4.5.2 INPUT-OUTPUT SECTION .................................................................................................................. 7 4.5.2.1 The Printer Files. ................................................................................................................................................. 7 4.5.2.2 Files used in the program. ................................................................................................................................... 8

4.6 DATA DIVISION.......................................................................................................................................... 9 4.6.1 FILE SECTION...................................................................................................................................... 9

4.6.2 WORKING-STORAGE SECTION ....................................................................................................... 10

4.6.3 Default Parameter lists in the program. .............................................................................................. 11 4.6.3.1 PARM-IPC : IDDOS parameter data structure. ................................................................................................ 12 4.6.3.2 Checking values and ranges. ............................................................................................................................. 13 4.6.3.3 Date Validity check. .......................................................................................................................................... 13 4.6.3.4 Error Handling. ................................................................................................................................................. 14

4.6.4 Separate indicator area. ...................................................................................................................... 15

4.6.5 Printer files : Record Formats. ............................................................................................................ 16

4.6.6 Additional data structures. .................................................................................................................. 16

4.6.7 Level Break processing data structures. .............................................................................................. 17

4.6.8 WORK and TOTAL fields. ................................................................................................................... 18

4.6.9 File-keys section. ................................................................................................................................. 19

4.6.10 Working-storage user. ......................................................................................................................... 20

4.6.11 LINKAGE SECTION. .......................................................................................................................... 20

4.7 PROCEDURE DIVISION ........................................................................................................................... 21 4.7.1 DECLARATIVES ................................................................................................................................. 21

4.7.2 MAIN SECTION .................................................................................................................................. 22

4.7.3 DRIVER SECTION : Super-level program driver. .............................................................................. 23

4.7.4 INPUT SECTION : Based-on primary file. ......................................................................................... 24

4.7.5 The Record control routine. ................................................................................................................. 26

4.7.6 LEVEL BREAK SECTION. .................................................................................................................. 27

4.7.7 Level 00 Processing. ............................................................................................................................ 28

4.7.8 Level nn Processing. ............................................................................................................................ 29

4.7.9 Total Processing : level 35. ................................................................................................................. 31

4.7.10 Header formats. ................................................................................................................................... 32

4.8 FILE ROUTINES ........................................................................................................................................ 33 4.8.1 File Handling : Read ........................................................................................................................... 33

4.8.2 User Written subroutines. .................................................................................................................... 34

4.8.3 Program Initialisation routine. ............................................................................................................ 34

4.8.4 OPEN routine. ..................................................................................................................................... 35

4.8.5 CLOSE routine. ................................................................................................................................... 35

4.9 PROGRAM ROUTINES. ................................................................................................................................... 36 4.10 PROGRAM FIELDS. ........................................................................................................................................ 38

Page 2: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 1 Batch Program: Detail Discription

CBL04: Batch program : Detail description

This chapter describes the source of a batch program, generated by IDDOS. This is done by means of an example program.

Page 3: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 2 Batch Program: Detail Discription

4.1 The Example program : description.

MN010CBB : List of Customers.

The list of customers provides a list of customers, ordered by city and name.

Totals are provided to count the number of customers in one city. Grand totals will also be printed.

Files to be used in the program.

Customer Master by City/Name : Input

Printer layout.

List Customers Date : 99/99/99 Time : 99:99:99 Page : 9999

Code Name City

************************************************************************ ***********

Customer city : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Customer Name : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX

XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX

Total for name XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 9999999

Total for city XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 9999999

GRAND TOTALS 9999999

Page 4: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 3 Batch Program: Detail Discription

4.2 The Example program : Technical Analysis.

This is the technical analysis for the program, generated by IDDOS. The detail code, needed to complete the program, is described.

This technical analysis was automatically created by IDDOS. To complete this technical analysis, a few lines were added by the analyst. In this example, these lines are highlighted.

A technical analysis of a program can be re-generated with IDDOS. User added text will remain unchanged.

To complete such a program, additional code can be added in user process points. This code can also be described in this technical document.

The source of the analysis for the batch example program is included in the IDDOS toolbook library IDDOSTLB.

Page 5: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 4 Batch Program: Detail Discription

4.3 The Example program : Printer File.

This is the source of the printer file, generated by IDDOS for the example program.

This printer file is built, entirely according to the entries made through the Forms Design Aid function.

Sources of the printer file and the batch example program are included in Appendix B.

Page 6: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 5 Batch Program: Detail Discription

4.4 IDENTIFICATION DIVISION

PROCESS APOST DATETIME.

IDENTIFICATION DIVISION.

*#######################*

PROGRAM-ID. RV001CBB .

AUTHOR. RVA .

INSTALLATION. AS/400.

DATE-WRITTEN. 20.05.99.

DATE-COMPILED.

SECURITY.

*****************************************************************

* *

* Description : List Customers *

* *

*****************************************************************

* GENERATED BY THE PROGRAM GENERATOR *

* *

* IIIII DDDD DDDD OOOO SSSSS *

* I D D D D O O S *

* I D D D D O O SSSSS *

* I D D D D O O S *

* IIIII DDDD DDDD OOOO SSSSS *

* *

* (C) COPYRIGHT Real Software N.V. 1999 *

*****************************************************************

The following information is contained in the IDENTIFICATION DIVISION

Process APOST :

Specifies that the delimiter ' is used for non-numeric literals and Boolean literals. This also specifies that the value of the figurative constant QUOTE has the EBCDIC value of an apostrophe.

Program-id :

This is the program name, entered on the program definition screen.

Author :

The user name of the user, who generated the program source.

Date-written :

This is the program description, entered on the program definition screen.

Page 7: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 6 Batch Program: Detail Discription

4.5 ENVIRONMENT DIVISION

4.5.1 CONFIGURATION SECTION

ENVIRONMENT DIVISION.

*#####################*

CONFIGURATION SECTION.

SOURCE-COMPUTER. AS400.

OBJECT-COMPUTER. AS400.

SPECIAL-NAMES. DECIMAL-POINT IS COMMA

OPEN-FEEDBACK IS FEEDBACK-OPEN

I-O-FEEDBACK IS FEEDBACK-I-O

ATTRIBUTE-DATA IS ATTRB-DATA

LOCAL-DATA IS LOCAL-DATA-AREA

REQUESTOR IS WORK-STATION

SYSTEM-CONSOLE IS SYSTEM

SYSTEM-SHUTDOWN IS SHUTDOWN-SWITCH

ON STATUS IS SHUTDOWN-PENDING

UPSI-0 IS UPSI-SWITCH-0

ON STATUS IS U0-ON

OFF STATUS IS U0-OFF

UPSI-1 IS UPSI-SWITCH-1

ON STATUS IS U1-ON

OFF STATUS IS U1-OFF

UPSI-2 IS UPSI-SWITCH-2

ON STATUS IS U2-ON

OFF STATUS IS U2-OFF

UPSI-3 IS UPSI-SWITCH-3

ON STATUS IS U3-ON

OFF STATUS IS U3-OFF

UPSI-4 IS UPSI-SWITCH-4

ON STATUS IS U4-ON

OFF STATUS IS U4-OFF

UPSI-5 IS UPSI-SWITCH-5

ON STATUS IS U5-ON

OFF STATUS IS U5-OFF

UPSI-6 IS UPSI-SWITCH-6

ON STATUS IS U6-ON

OFF STATUS IS U6-OFF

UPSI-7 IS UPSI-SWITCH-7

ON STATUS IS U7-ON

OFF STATUS IS U7-OFF.

Page 8: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 7 Batch Program: Detail Discription

4.5.2 INPUT-OUTPUT SECTION

INPUT-OUTPUT SECTION.

FILE-CONTROL.

4.5.2.1 The Printer Files.

SELECT MN020CBP

ASSIGN TO FORMATFILE-MN020CBP-SI

ORGANIZATION IS SEQUENTIAL

ACCESS IS SEQUENTIAL

FILE STATUS IS FILE-STAT.

For each batch program, a maximum of 8 printer files can be used.

The number of this printer file on the printer file definition screen decides the order in which these printer files will be generated in the program.

That number will also be used to generate individual fields, dealing with information, belonging to that particular printer file.

The SELECT's for the printer files are always the first SELECT statements generated in the program.

SI indicates that a separate indicator area has been specified in the DDS for a FORMATFILE (printer file).

Page 9: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 8 Batch Program: Detail Discription

4.5.2.2 Files used in the program.

SELECT MNCUMAL3

ASSIGN TO DATABASE-MNCUMAL3

ORGANIZATION IS INDEXED

ACCESS IS DYNAMIC

RECORD KEY IS EXTERNALLY-DESCRIBED-KEY

WITH DUPLICATES

FILE STATUS IS FILE-STAT.

The files used in the program are generated in the order they were entered on the 'Files used in program' entry screen.

This has already been discussed when the interactive program was described. The same rules are applied to generate the data base files used for a batch program.

When maintaining the files for a Batch Program, the system will display a warning message when the Primary File (sequence 01) is not found , e.g. after a program distribution.

Page 10: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 9 Batch Program: Detail Discription

4.6 DATA DIVISION

4.6.1 FILE SECTION

DATA DIVISION.

*##############*

FILE SECTION.

FD MN020CBP

LABEL RECORDS ARE STANDARD.

01 REC-MN020CBP PIC X(132).

FD MNCUMAL3

LABEL RECORDS ARE STANDARD.

01 REC-MNCUMAL3 .

COPY DDS-ALL-FORMATS OF MNCUMAL3 .

The file section describes externally stored data for all files used in the program.

IDDOS uses the 'COPY DDS-ALL-FORMATS OF filename ' statement to create COBOL Data Division statements to describe a file that exists in the system. These descriptions are based on the version of the file in existence at compile time. They do not make use of the DDS source statements for the file.

For the printer files, IDDOS always generates a data structure of xxx bytes, depending on 'positions per line' entered on the detail screen in the 'Files used in program' function.

Page 11: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 10 Batch Program: Detail Discription

4.6.2 WORKING-STORAGE SECTION

The working-storage section describes internal data.

WORKING-STORAGE SECTION.

* GENERATOR : GENERAL FIELDS *

77 FILE-STAT PIC XX VALUE '00'.

77 SW-EXIT PIC XX.

88 SW-EXIT-ON VALUE 'ON'.

88 SW-EXIT-OF VALUE 'OF'.

77 SW-FIRST-TIME PIC XX.

88 SW-FIRST-TIME-ON VALUE 'ON'.

88 SW-FIRST-TIME-OF VALUE 'OF'.

77 SW-SKIP-REC PIC XX.

88 SW-SKIP-REC-ON VALUE 'ON'.

88 SW-SKIP-REC-OF VALUE 'OF'.

77 SW-END-OF-LIST PIC XX.

88 SW-END-OF-LIST-ON VALUE 'ON'.

88 SW-END-OF-LIST-OF VALUE 'OF'.

77 SW-INVALID PIC XX.

88 SW-INVALID-ON VALUE 'ON'.

88 SW-INVALID-OF VALUE 'OF'.

These program-switches and data structure are used by the generated program.

Page 12: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 11 Batch Program: Detail Discription

4.6.3 Default Parameter lists in the program.

*CALL IP001RGB-IP002RGB *

01 PARM-IPC.

02 FILLER PIC X(175).

02 PARM-TLCD PIC X.

02 PARM-TLCU PIC X.

02 PARM-CMDC PIC XX.

02 FILLER PIC X(141).

02 PARM-USER PIC X(10).

02 FILLER PIC X(6).

02 PARM-DTSV PIC X.

02 FILLER PIC X(30).

02 PARM-MLTU PIC X(6).

02 FILLER PIC X(395).

02 PARM-UPRM PIC X(256).

*CALL IP020RGB (VALUES & RANGES) *

01 PARM-PLVR.

02 PARM-DDCD PIC X(10) VALUE SPACES.

02 PARM-CVAL PIC X(15) VALUE SPACES.

02 PARM-OMSC PIC X(30) VALUE SPACES.

02 PARM-DBVL PIC X(15) VALUE SPACES.

02 PARM-SWVR PIC X(01) VALUE SPACES.

*CALL IP030RGB (DATE -TEST/-CONVERSION) *

01 PARM-PLDT.

02 PARM-DATI PIC X(06) VALUE SPACES.

02 PARM-FMTI PIC X(01) VALUE SPACES.

02 PARM-FMTO PIC X(01) VALUE SPACES.

02 PARM-DATO PIC X(06) VALUE SPACES.

*CALL IP095CLB (PROGRAM ERROR) *

01 PARM-PLER.

02 PARM-FLNM PIC X(10) VALUE SPACES.

02 PARM-OPCD PIC X(10) VALUE SPACES.

02 PARM-FRMT PIC X(10) VALUE SPACES.

02 PARM-STAT PIC X(2) VALUE SPACES.

02 PARM-LOCN PIC X(15) VALUE SPACES.

Each IDDOS program uses a set of parameter lists to communicate with programs in the execution environment.

For test purposes, this execution environment can also be simulated in the development environment through option 40 on the IDDOS programmer menu.

Page 13: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 12 Batch Program: Detail Discription

4.6.3.1 PARM-IPC : IDDOS parameter data structure.

IDDOS uses the data structure PARM-IPC as a means of communication from one program to another. When a program is started, the contents of the data area IDPARM are retrieved and placed in the data structure PARM-IPC by program IP001RGB. The data area IDPARM is locked by the program.

Before a program is ended, the contents of the data structure PARM-IPC are written to the data area IDPARM and the data area IDPARM is unlocked by program IP002RGB. Therefore, if information in PARM-IPC was changed by the program, the new information becomes available to the new program.

Consequently, before a call to another program can be issued by the current program, the data area IDPARM must be updated and unlocked by the calling program IP002RGB.

The following information is available inb the data structure PARM-IPC :

− PARM-TLCD :the language code of the application system

− PARM-TLCU :the language code of the user

− PARM-CMDC :command key used this will be filled automatically in future releases ('KA' for command key 1, 'KB' for command key 2,...)

− PARM-USER : the name of the user

− PARM-DTSV :contains the date format, found in the QDATFMT system value: 'D' = DMY 'M' = MDY 'Y' = YMD

− PARM-MLTU :the language code of the user. This field will be moved to indicators 61-66.

− PARM-UPRM :this is available for the programmers to provide inter program communication, removing the need to define external parameters to the program.

Page 14: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 13 Batch Program: Detail Discription

4.6.3.2 Checking values and ranges.

The parameters used by the Execution Environment program IP020RGB (Value/Range check) are :

− PARM-DDCD :the attribute field name

− PARM-CVAL :the value found on the display for the field

− PARM-OMSC :the description of the value is returned in this field, if a correct value was found

− PARM-DBVL :reserved for future use

− PARM-SWVR :the control switch 'N' : incorrect value 'Y' : correct value

A value or range test can be performed. If a value was tested, and a correct value was entered in the program IP020RGB, IDDOS returns the description for this value (language-dependent) in the PARM-OMSC field. This description is then available to be used in the batch program.

4.6.3.3 Date Validity check.

The parameters used by the Execution Environment program IP030RGB (Date Validity check) are :

− PARM-DATI : the date to be tested

− PARM-FMTI : the format of the date to be tested (the date format in the program)

− PARM-FMTO :the format for this date in the database

− PARM-DATO :the date in output format if the value '999999' is returned in this parameter, the date was invalid

The program IP030RGB can be used to

− perform a validity check on a date

− reformat the date

Page 15: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 14 Batch Program: Detail Discription

4.6.3.4 Error Handling.

The parameters used by the Execution Environment program IP095CLB (Error Handling) are :

− PARM-FLNM :the name of the printer file or database file

− PARM-OPCD :the operation code

− PARM-FRMT :the record format of the file

− PARM-STAT : the file-status returned on the input-outputoperation

− PARM-LOCN :the location in the program where the error occured

The program IP095CLB is the route to the error handling circuit. An abnormal end of the calling program will be evoked because IP095CLB can't be ended otherwise. Only in the case of record lock, can the control be returned to the calling program without cancelling.

Page 16: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 15 Batch Program: Detail Discription

4.6.4 Separate indicator area.

01 INDIC-AREA.

02 INDIC-AREA-1.

03 INDIC-TABEL OCCURS 99 TIMES PIC 1 INDICATOR 1.

88 IND-OF VALUE B'0'.

88 IND-ON VALUE B'1'.

02 FILLER REDEFINES INDIC-AREA-1.

03 FILLER PIC X(60).

03 INDIC-AREA-MLTU PIC X(6).

03 FILLER PIC X(33).

IDDOS defines a table of 99 Boolean data items in WORKING- STORAGE. The INDICATOR clause for this data description entry causes these data items to be associated with indicators 1 through 99 respectively.

When the INDICATORS phrase is used in READ, REWRITE and WRITE statements, it specifies which indicators are to be read, rewritten, and written. The identifier specified in the INDICATORS phrase can be either of the following :

− an elementary Boolean data item

− a group item with elementary Boolean data items subordinate to it.

IDDOS specifies INDARA in the DDS for the printer file. The use of the indicators referenced in the INDICATORS phrase is based on the indicator number.

− In a read statement, only the response indicator numbers referenced by the INDICATORS phrase are updated. Indicators specified in the DDS for the format but not referenced by the INDICATORS phrase are ignored. Indicators referenced by the INDICATORS phrase but not specified in the DDS are not modified.

− In a WRITE or REWRITE statement, only the option indicators referenced by the INDICATORS phrase are used. Indicators specified in the DDS for the format but not referenced by the INDICATORS phrase are assumed to be OFF. Indicators referenced by the INDICATORS phrase but not used in the DDS for the format are ignored.

Page 17: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 16 Batch Program: Detail Discription

4.6.5 Printer files : Record Formats.

01 FORMATS-MN020CBP .

COPY DDS-D10001-O OF MN020CBP .

COPY DDS-G10101-O OF MN020CBP .

COPY DDS-T10101-O OF MN020CBP .

COPY DDS-G10201-O OF MN020CBP .

COPY DDS-T10201-O OF MN020CBP .

COPY DDS-T13501-O OF MN020CBP .

IDDOS uses the 'COPY DDS-formatname-O OF printer file name' statement to create COBOL Data Division statements to describe a printer file that exists in the system. These descriptions are based on the version of the file in existence at compile time. They do not make use of the DDS source statements for the file.

IDDOS generates for each printer file an 01 level :

01 FORMATS-printer file name.

4.6.6 Additional data structures.

77 OVERFLOW-01 PIC XX VALUE 'ON'.

88 OVERFLOW-01-ON VALUE 'ON'.

88 OVERFLOW-01-OF VALUE 'OF'.

77 SW-EOF-01 PIC XX.

88 SW-EOF-01-ON VALUE 'ON'.

88 SW-EOF-01-OF VALUE 'OF'.

01 WS-GEN.

02 PROG-ID PIC X(10) VALUE SPACES.

02 ADD01 PIC 9 VALUE ZERO.

02 UPD01 PIC 9 VALUE ZERO.

02 DEL01 PIC 9 VALUE ZERO.

IDDOS generates

− for each printer file an overflow switch

− for each database file an end-of-file switch and add, update and delete flags.

Page 18: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 17 Batch Program: Detail Discription

4.6.7 Level Break processing data structures.

01 OPCK.

02 CUNMOI PIC X(00035) VALUE SPACES.

02 CUCTOI PIC X(00035) VALUE SPACES.

66 KEY-01 RENAMES CUNMOI .

66 KEY-02 RENAMES CUCTOI .

01 NPCK.

02 CUNMNI PIC X(00035) VALUE SPACES.

02 CUCTNI PIC X(00035) VALUE SPACES.

66 KEY-01 RENAMES CUNMNI .

66 KEY-02 RENAMES CUCTNI .

These generated data structures contain the old control values (OPCK) and the new control values (NPCK).

In each data structure we find the level break fields concatenated with 'OI' for the old control values and 'NI' for the new control values.

IDDOS also provides more than one field on a level. That is the reason why the '66 - level' is built in, to rename one field through another field on one level.

Page 19: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 18 Batch Program: Detail Discription

4.6.8 WORK and TOTAL fields.

01 WORK-FIELDS.

02 WW0100 PIC 9(00005) COMP-3 VALUE ZEROES.

01 TOTAL-FIELDS.

02 WW01L1 PIC 9(00007) COMP-3 VALUE ZEROES.

02 WW01L2 PIC 9(00007) COMP-3 VALUE ZEROES.

02 WW01LZ PIC 9(00007) COMP-3 VALUE ZEROES.

The data structure WORK-FIELDS contains the fields, defined by the user at a particular level, which will be used as work fields.

The data structure TOTAL-FIELDS contains the work fields, for which the user wants a cumulation to a higher level.

Page 20: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 19 Batch Program: Detail Discription

4.6.9 File-keys section.

01 FILE-KEYS.

02 KEY-MNCUMAL3 .

03 KEY-MNCUMAR .

04 CUCTCU PIC X(00035)

VALUE LOW-VALUES.

04 CUNMCU PIC X(00035)

VALUE LOW-VALUES.

The 'Keyed file' entry on the detail screen 'files used in program' (fig 4) determines if key values are used to process this file. If so, IDDOS generates a key list for the file.

The name of this key list is :

02 KEY-filenami .

03 KEY-recname .

04 field

VALUE ......... .

04 field

VALUE ......... .

- 'filenami ' : the internal name of the file in the program

- 'recname ' : the record name of the file

- 'field ' : the key-field(s) of the file,

these fields are also initialised :

- with LOW-VALUES for alphanumeric fields

- with ZEROES for numeric fields.

Of course, the order of the fields in this key list is the same as the order of the key fields in the external file description.

!!! Partial key lists are not automatically provided by IDDOS, because the generator itself has no need for partial keys.

Page 21: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 20 Batch Program: Detail Discription

4.6.10 Working-storage user.

/******* W O R K I N G - S T O R A G E U S E R *****************

01 PAROUT PIC X(256).

******************************************************************

*IDDOS: user code : working-storage user *

* *

******************************************************************

Additional data structures can be entered in the WSU process point. The specifications in this process point will be placed in the program source. In the procedure division at this process point, the entry parameter PARIN, is moved to PAROUT. PAROUT can be redefined by the REDEFINES clause.

4.6.11 LINKAGE SECTION.

LINKAGE SECTION

01 PARIN PIC X(256).

The linkage section describes data made available by another program. IDDOS provides an entry parameter-list of 256 bytes.

− the program may call other programs or may be called by another program, needing a parameter-list.

Page 22: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 21 Batch Program: Detail Discription

4.7 PROCEDURE DIVISION

4.7.1 DECLARATIVES

PROCEDURE DIVISION USING PARIN.

DECLARATIVES.

*

SECT-DCL-MN020CBP SECTION.

USE AFTER ERROR PROCEDURE MN020CBP .

PARA-DCL-MN020CBP .

MOVE 'MN020CBP ' TO PARM-FLNM IN PARM-PLER.

MOVE FILE-STAT TO PARM-STAT IN PARM-PLER.

CALL 'IP095CLB' USING PARM-FLNM IN PARM-PLER

PARM-OPCD IN PARM-PLER

PARM-FRMT IN PARM-PLER

PARM-STAT IN PARM-PLER

PARM-LOCN IN PARM-PLER.

*

SECT-DCL-MNCUMAL3 SECTION.

USE AFTER ERROR PROCEDURE MNCUMAL3 .

PARA-DCL-MNCUMAL3 .

MOVE 'MNCUMAL3 ' TO PARM-FLNM IN PARM-PLER.

MOVE FILE-STAT TO PARM-STAT IN PARM-PLER.

IF FILE-STAT NOT = '41'

CALL 'IP095CLB' USING PARM-FLNM IN PARM-PLER

PARM-OPCD IN PARM-PLER

PARM-FRMT IN PARM-PLER

PARM-STAT IN PARM-PLER

PARM-LOCN IN PARM-PLER.

IF PARM-STAT IN PARM-PLER NOT = '9D'

AND FILE-STAT NOT = '41'

STOP RUN.

*

END DECLARATIVES.

The generated program uses the DECLARATIVES to provide a method of invoking procedures that are executed when an exception condition occurs that you cannot usually test.

Each IDDOS generated program uses the DECLARATIVES routine to handle program errors. This routine uses the external program IP095CLB. An abnormal end of the calling program will be evoked. Only in the case of record lock, can program IP095CLB return to the calling program without cancelling.

Page 23: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 22 Batch Program: Detail Discription

4.7.2 MAIN SECTION

/*****************************************************************

* M A I N S E C T I O N . *

******************************************************************

SECT-MAIN SECTION.

PARA-MAIN.

MOVE PARIN TO PAROUT.

CALL 'IP001RGB' USING PARM-IPC.

CANCEL 'IP001RGB'.

MOVE 'MN020CBB ' TO PROG-ID IN WS-GEN.

PERFORM SECT-OPEN.

PERFORM SECT-INI.

PERFORM SECT-DRIVER UNTIL SW-EXIT-ON.

PERFORM SECT-CLOSE.

CALL 'IP002RGB' USING PARM-IPC.

CANCEL 'IP002RGB'.

MOVE PAROUT TO PARIN.

EXIT-MAIN-EXIT. EXIT PROGRAM.

EXIT-MAIN-STOP. STOP RUN.

EXIT-MAIN. EXIT.

The entry parameter PARIN in the linkage section is moved to PAROUT, a data structure in working-storage.

The contents of the external data area IDPARM are retrieved and placed in the data structure PARM-IPC by program IP001RGB.

The SECT-OPEN routine is executed to open the printer file(s) and the database files.

The SECT-INI routine is executed to initialise the program fields.

The DRIVER routine is executed until the SW-EXIT switch is set to'ON'.

The SECT-CLOSE routine is executed to close the printer file(s) and the database files.

The contents of the data structure PARM-IPC are written to the external data area IDPARM by program IP002RGB.

PAROUT, a data structure in working-storage is moved to the entry parameter PARIN in the linkage section.

Page 24: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 23 Batch Program: Detail Discription

4.7.3 DRIVER SECTION : Super-level program driver.

******************************************************************

* D R I V E R S E C T I O N . *

******************************************************************

SECT-DRIVER SECTION.

PARA-DRIVER.

******************************************************************

*IDDOS: User Code : Driver routine *

* *

******************************************************************

PERFORM SECT-INP-01.

PERFORM SECT-INP-02 UNTIL SW-EOF-01-ON OR SW-END-OF-LIST-ON.

PERFORM SECT-T35.

MOVE 'ON' TO SW-EXIT.

******************************************************************

*IDDOS: User Code : End program Conditioning *

* *

******************************************************************

EXIT-DRIVER. EXIT.

The DRV and END process points are the same as those,provided for an interactive program.

First, a routine INP-01 will be executed to position the based-on file.

A routine INP-02 will be executed to process individual records from the based-on file until the based-on file is at end-of-file or at end-of-list.

After all detail processing, routine T35 is performed. This is the routine to print grand totals.

Page 25: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 24 Batch Program: Detail Discription

4.7.4 INPUT SECTION : Based-on primary file.

/*****************************************************************

*IDDOS: Input section (part-1) *

******************************************************************

SECT-INP-01 SECTION.

PARA-INP-01.

MOVE CORR KEY-MNCUMAR IN KEY-MNCUMAL3

TO MNCUMAR IN MNCUMAL3 .

MOVE 'START N < ' TO PARM-OPCD IN PARM-PLER.

MOVE 'SECT-INP-01' TO PARM-LOCN IN PARM-PLER.

MOVE 'MNCUMAR ' TO PARM-FRMT IN PARM-PLER.

START MNCUMAL3 KEY IS NOT < EXTERNALLY-DESCRIBED-KEY

FORMAT IS 'MNCUMAR'

INVALID MOVE 'ON' TO SW-EOF-01.

EXIT-INP-01. EXIT.

******************************************************************

*IDDOS: Input section (part-2) *

******************************************************************

SECT-INP-02 SECTION.

PARA-INP-02.

MOVE 'READ NEXT ' TO PARM-OPCD IN PARM-PLER

MOVE 'SECT-INP-02 ' TO PARM-LOCN IN PARM-PLER

MOVE 'MNCUMAR ' TO PARM-FRMT IN PARM-PLER

IF SW-EOF-01-OF

AND SW-END-OF-LIST-OF

READ MNCUMAL3 NEXT RECORD

FORMAT IS 'MNCUMAR'

AT END MOVE 'ON' TO SW-EOF-01

END-IF.

IF SW-EOF-01-OF

MOVE 'OF' TO SW-SKIP-REC,

PERFORM SECT-R99,

IF SW-SKIP-REC-ON

OR SW-END-OF-LIST-ON

NEXT SENTENCE

ELSE

PERFORM SECT-RUPT.

EXIT-INP-02. EXIT.

Page 26: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 25 Batch Program: Detail Discription

The 'KEY-filename' holds the starting value for the START of the base-on file. SW-EOF-01 is used to indicate that the based-on file has reached end-of-file, and therefore no processing is executed for this based-on-file.

The first available record from the based-on file is retrieved through the READ NEXT instruction.

The processing of the based-on file will be started and executed until end-of-file on the based-on file or until the programmer decides to stop the processing. The end-of-list status (SW-END-OF-LIST) can be set to 'ON' to do this.

Each individual record can be tested through the R99 routine to decide whether or not to skip the record. If a record must be skipped, SW-SKIP-REC must be set to 'ON'.

If the record is selected for processing (SW-SKIP-REC is 'OF') the level break section is executed.

Page 27: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 26 Batch Program: Detail Discription

4.7.5 The Record control routine.

/*****************************************************************

*IDDOS: Record control *

******************************************************************

SECT-R99 SECTION.

PARA-R99.

******************************************************************

*IDDOS: User Code : Record control *

* *

******************************************************************

EXIT-R99. EXIT.

This routine is used to decide if records from the based-on file must be included or not.

The SW-SKIP-REC switch can be used to skip individual records. The end-of-file or end-of-list status can be used to stop file processing.

This function is similar to the Rnn routines, provided for each subfile format in the interactive generator.

Page 28: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 27 Batch Program: Detail Discription

4.7.6 LEVEL BREAK SECTION.

/*****************************************************************

*IDDOS: Level break section. *

******************************************************************

SECT-RUPT SECTION.

PARA-RUPT.

MOVE CUNMCU IN MNCUMAR IN MNCUMAL3

TO CUNMNI IN NPCK.

MOVE CUCTCU IN MNCUMAR IN MNCUMAL3

TO CUCTNI IN NPCK.

IF SW-FIRST-TIME-ON

MOVE 'OF' TO SW-FIRST-TIME

PERFORM SECT-G02

ELSE

IF KEY-02 IN OPCK NOT EQUAL TO KEY-02 IN NPCK

PERFORM SECT-T02, PERFORM SECT-G02

ELSE

IF KEY-01 IN OPCK NOT EQUAL TO KEY-01 IN NPCK

PERFORM SECT-T01, PERFORM SECT-G01

ELSE

NEXT SENTENCE.

PERFORM SECT-L00.

MOVE NPCK TO OPCK.

EXIT-RUPT. EXIT.

The new control value fields are updated.

For the first record, no level handling will be performed, only group handling is performed.

Levels will be processed, proceeding from the highest level number down. The total handling will be performed first. This total handling will also perform total handling for all the lower levels. Then group handling is performed. This also includes group handling for all the lower levels.

Detail processing will be performed.

New control values will be moved to the old control values.

Page 29: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 28 Batch Program: Detail Discription

4.7.7 Level 00 Processing.

/*****************************************************************

*IDDOS: Level 00 : LEVEL-BREAK processing detail *

******************************************************************

SECT-L00 SECTION.

PARA-L00.

******************************************************************

*IDDOS: User Code : Key initialisation detail *

* *

******************************************************************

******************************************************************

*IDDOS: User Code : Level-break processing detail *

* *

ADD 1 TO WW0100.

******************************************************************

IF OVERFLOW-01-ON

MOVE 'OF' TO OVERFLOW-01

PERFORM SECT-PHD-01.

MOVE CORR WORK-FIELDS TO D10001-O.

MOVE CORR MNCUMAR IN MNCUMAL3 TO D10001-O

MOVE CORR OPCK TO D10001-O.

MOVE CORR NPCK TO D10001-O.

MOVE 'SECT-L00 ' TO PARM-LOCN IN PARM-PLER.

MOVE 'D10001 ' TO PARM-FRMT IN PARM-PLER.

MOVE 'WRITE ' TO PARM-OPCD IN PARM-PLER.

WRITE REC-MN020CBP FROM D10001-O

FORMAT IS 'D10001'

INDICATORS ARE INDIC-TABEL

AT END-OF-PAGE MOVE 'ON' TO OVERFLOW-01.

*

* CUMULATOR GROUP

*

ADD WW0100 IN WORK-FIELDS TO WW01L1 IN TOTAL-FIELDS.

ADD WW0100 IN WORK-FIELDS TO WW01L2 IN TOTAL-FIELDS.

ADD WW0100 IN WORK-FIELDS TO WW01LZ IN TOTAL-FIELDS.

*

* INITIALISATION

*

MOVE ZEROES TO WW0100 IN WORK-FIELDS.

EXIT-L00. EXIT.

The routine to handle detail processing is always the L00 routine.

This routine includes :

− the user process point I00 to provide initialisations.

− pre-generated database accesses on level 00

− user process code L00

− printing of the format lines on level 00

− processing of cumulation fields, defined on level 00.

− initialization of cumulation fields, defined on level 00.

Page 30: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 29 Batch Program: Detail Discription

4.7.8 Level nn Processing.

/*****************************************************************

*IDDOS: Level 02 : LEVEL-BREAK processing total *

******************************************************************

SECT-T02 SECTION.

PARA-T02.

IF SW-FIRST-TIME-OF

PERFORM SECT-T01.

******************************************************************

*IDDOS: User Code : Key initialisation total *

* *

******************************************************************

******************************************************************

*IDDOS: User Code : Level-break processing total *

* *

******************************************************************

IF OVERFLOW-01-ON

MOVE 'OF' TO OVERFLOW-01

PERFORM SECT-PHD-01.

MOVE CORR WORK-FIELDS TO T10201-O.

MOVE CORR TOTAL-FIELDS TO T10201-O.

MOVE CORR OPCK TO T10201-O.

MOVE CORR NPCK TO T10201-O.

MOVE 'SECT-T02 ' TO PARM-LOCN IN PARM-PLER.

MOVE 'T10201 ' TO PARM-FRMT IN PARM-PLER.

MOVE 'WRITE ' TO PARM-OPCD IN PARM-PLER.

WRITE REC-MN020CBP FROM T10201-O

FORMAT IS 'T10201'

INDICATORS ARE INDIC-TABEL

AT END-OF-PAGE MOVE 'ON' TO OVERFLOW-01.

*

* CUMULATOR GROUP

*

MOVE ZEROES TO WW01L2 IN TOTAL-FIELDS.

EXIT-T02. EXIT.

/*****************************************************************

*IDDOS: Group 02 : *

******************************************************************

SECT-G02 SECTION.

PARA-G02.

******************************************************************

*IDDOS: User Code : Key initialisation group *

* *

******************************************************************

******************************************************************

*IDDOS: User Code : Level-break processing group *

* *

******************************************************************

IF OVERFLOW-01-ON

MOVE 'OF' TO OVERFLOW-01

PERFORM SECT-PHD-01.

MOVE CORR WORK-FIELDS TO G10201-O.

MOVE CORR TOTAL-FIELDS TO G10201-O.

MOVE CORR OPCK TO G10201-O.

MOVE CORR NPCK TO G10201-O.

MOVE 'SECT-G02 ' TO PARM-LOCN IN PARM-PLER.

MOVE 'G10201 ' TO PARM-FRMT IN PARM-PLER.

MOVE 'WRITE ' TO PARM-OPCD IN PARM-PLER.

WRITE REC-MN020CBP FROM G10201-O

FORMAT IS 'G10201'

INDICATORS ARE INDIC-TABEL

AT END-OF-PAGE MOVE 'ON' TO OVERFLOW-01.

PERFORM SECT-G01.

EXIT-G02. EXIT.

Each level handling is performed through two subroutines in the program.

The first routine handles the total processing. (Tnn). This routine includes :

− performing the execution of total handling on lower levels

Page 31: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 30 Batch Program: Detail Discription

− the user process point Inn to provide initialisations on total level nn.

− pre-generated database accesses on total level nn

− user process code Lnn

− printing of the total format lines on level nn

− processing of cumulation fields, defined on level nn.

− initialization of cumulation fields, defined on level nn.

The second routine handles the group processing. (Gnn). This routine includes :

− the user process point Jnn to provide initialisations on group level nn.

− pre-generated database accesses on group level nn

− user process code Gnn

− printing of the group format lines on level nn

− performing the execution of group handling on lower levels

Page 32: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 31 Batch Program: Detail Discription

4.7.9 Total Processing : level 35.

/*****************************************************************

*IDDOS: Level 35 : LEVEL-BREAK processing total *

******************************************************************

SECT-T35 SECTION.

PARA-T35.

IF SW-FIRST-TIME-OF

PERFORM SECT-T02.

******************************************************************

*IDDOS: User Code : Key initialisation total *

* *

******************************************************************

******************************************************************

*IDDOS: User Code : Level-break processing total *

* *

******************************************************************

IF OVERFLOW-01-ON

MOVE 'OF' TO OVERFLOW-01

PERFORM SECT-PHD-01.

MOVE CORR WORK-FIELDS TO T13501-O.

MOVE CORR TOTAL-FIELDS TO T13501-O.

MOVE CORR OPCK TO T13501-O.

MOVE CORR NPCK TO T13501-O.

MOVE 'SECT-T35 ' TO PARM-LOCN IN PARM-PLER.

MOVE 'T13501 ' TO PARM-FRMT IN PARM-PLER.

MOVE 'WRITE ' TO PARM-OPCD IN PARM-PLER.

WRITE REC-MN020CBP FROM T13501-O

FORMAT IS 'T13501'

INDICATORS ARE INDIC-TABEL

AT END-OF-PAGE MOVE 'ON' TO OVERFLOW-01.

*

* CUMULATOR GROUP

*

MOVE ZEROES TO WW01LZ IN TOTAL-FIELDS.

EXIT-T35. EXIT.

Total handling at program level includes :

− performing the execution of total handling on lower levels (except if there were no records processed).

− the user process point I35 to provide initialisations on total level 35.

− pre-generated data accesses on total level 35

− user process code L35

− printing of the total format lines on level 35.

Page 33: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 32 Batch Program: Detail Discription

4.7.10 Header formats.

/*****************************************************************

*IDDOS: Header 01 *

******************************************************************

SECT-PHD-01 SECTION.

PARA-PHD-01.

******************************************************************

*IDDOS: User Code : Heading Output *

* *

******************************************************************

MOVE 'SECT-PHD-01' TO PARM-LOCN IN PARM-PLER.

MOVE 'H1HD01 ' TO PARM-FRMT IN PARM-PLER.

MOVE 'WRITE ' TO PARM-OPCD IN PARM-PLER.

WRITE REC-MN020CBP FORMAT IS 'H1HD01'

INDICATORS ARE INDIC-TABEL

AT END-OF-PAGE MOVE 'ON' TO OVERFLOW-01.

MOVE 'SECT-PHD-01' TO PARM-LOCN IN PARM-PLER.

MOVE 'H1HD02 ' TO PARM-FRMT IN PARM-PLER.

MOVE 'WRITE ' TO PARM-OPCD IN PARM-PLER.

WRITE REC-MN020CBP FORMAT IS 'H1HD02'

INDICATORS ARE INDIC-TABEL

AT END-OF-PAGE MOVE 'ON' TO OVERFLOW-01.

MOVE 'SECT-PHD-01' TO PARM-LOCN IN PARM-PLER.

MOVE 'H1HD03 ' TO PARM-FRMT IN PARM-PLER.

MOVE 'WRITE ' TO PARM-OPCD IN PARM-PLER.

WRITE REC-MN020CBP FORMAT IS 'H1HD03'

INDICATORS ARE INDIC-TABEL

AT END-OF-PAGE MOVE 'ON' TO OVERFLOW-01.

EXIT-PHD-01. EXIT.

For each printer file, a Hff routine is provided for the printing of header formats.

This routine includes the Hff user process point code.

Page 34: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 33 Batch Program: Detail Discription

4.8 FILE ROUTINES

4.8.1 File Handling : Read

/*****************************************************************

*IDDOS: File 01 : MNCUMAL3 : Read *

******************************************************************

SECT-READ-01 SECTION.

PARA-READ-01.

MOVE CORR KEY-MNCUMAR IN KEY-MNCUMAL3

TO MNCUMAR IN MNCUMAL3 .

MOVE 'READ ' TO PARM-OPCD IN PARM-PLER.

MOVE 'SECT-READ-01' TO PARM-LOCN IN PARM-PLER.

MOVE 'MNCUMAR ' TO PARM-FRMT IN PARM-PLER.

READ MNCUMAL3 RECORD

FORMAT IS 'MNCUMAR'

INVALID MOVE 'ON' TO SW-INVALID

NOT INVALID MOVE 'OF' TO SW-INVALID.

EXIT-READ-01. EXIT.

This routine is generated for each file in the program, when an input/update access to this file is defined.

Page 35: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 34 Batch Program: Detail Discription

4.8.2 User Written subroutines.

/*****************************************************************

* IDDOS : User subroutines *

******************************************************************

SECT-SBR SECTION.

PARA-SBR.

******************************************************************

*IDDOS: User Code : User subroutines *

* *

******************************************************************

EXIT-SBR. EXIT.

If PERFORM is used to execute the subroutines from within the user process points, these subroutines must be added added to the program. They must be entered in the SBR process point.

4.8.3 Program Initialisation routine.

/*****************************************************************

* I N I T I A L I S A T I O N S E C T I O N . *

******************************************************************

SECT-INI SECTION.

PARA-INI.

MOVE PARM-MLTU IN PARM-IPC TO INDIC-AREA-MLTU.

MOVE 'OF' TO SW-EXIT.

MOVE 'ON' TO SW-FIRST-TIME.

MOVE 'OF' TO SW-END-OF-LIST.

MOVE 'OF' TO SW-SKIP-REC.

MOVE 'OF' TO SW-EOF-01.

MOVE 0 TO ADD01.

MOVE 0 TO UPD01.

MOVE 0 TO DEL01.

******************************************************************

*IDDOS: User Code : Program initialisation *

* *

******************************************************************

EXIT-INI. EXIT.

The initialisation routine performs the following functions :

− Definition of fields, used in the generated program.

− User written initialisation code in the INI process point.

Page 36: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 35 Batch Program: Detail Discription

4.8.4 OPEN routine.

/*****************************************************************

* O P E N S E C T I O N . *

******************************************************************

SECT-OPEN SECTION.

PARA-OPEN.

MOVE 'OPEN ' TO PARM-OPCD IN PARM-PLER.

MOVE 'SECT-OPEN ' TO PARM-LOCN IN PARM-PLER.

OPEN INPUT MNCUMAL3 .

OPEN OUTPUT MN020CBP .

EXIT-OPEN. EXIT.

This routine is performed at the start of the program. There is one OPEN statement per database file and printer file. The database files are opened for I-O or for INPUT, depending on the 'File type' field on the detail screen 'Files & Levels'. The printer file is always opened for OUTPUT.

4.8.5 CLOSE routine.

/*****************************************************************

* C L O S E S E C T I O N . *

******************************************************************

SECT-CLOSE SECTION.

PARA-CLOSE.

MOVE 'CLOSE ' TO PARM-OPCD IN PARM-PLER.

MOVE 'SECT-CLOSE' TO PARM-LOCN IN PARM-PLER.

CLOSE MNCUMAL3 .

CLOSE MN020CBP .

EXIT-CLOSE. EXIT.

This routine is performed at the end of the program. There is one CLOSE statement per database file and printer file.

Page 37: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 36 Batch Program: Detail Discription

4.9 Program routines.

The names of subroutines in IDDOS batch programs are built using the same conventions as the interactive program :

− position 1 = $

− position 2 = A-Z

− position 3-4 = 0-9

− position 5-6 = ZZ (for ENDSR; the first 4 positions have to be the first 4 positions of the BEGSR name)

Each routine has a different function. The routines found in batch programs are :

Gnn Routine for group processing. This routine includes user processing Jnn, group data base accesses on level nn, group user processing Gnn and the printing of formats at group level nn. --> each level 01-34.

Hff Routine to print header formats for the printer file --> each printer file, used in the program

INI General initialisation routine (at program start) --> program level routine

L00 Routine for processing of detail records. This routine includes user processing I00, data base accesses on level 00, detail user processing L00 and the printing of formats at level 00. --> available in each program.

R99 Routine containing record control processing, deciding if a record from the based-on file must be processed or skipped. --> program level routine

Page 38: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 37 Batch Program: Detail Discription

Tnn Routine for total processing. This routine includes user processing Inn, total data base accesses on level nn, total user processing Lnn and the printing of formats at group level nn. --> each level 01-35.

Page 39: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 38 Batch Program: Detail Discription

4.10 Program fields.

The batch generator also uses a set of predefined program fields. When adding your own program fields, you must make sure you avoid conflicts.

The first set of fields are the cumulator fields. They are built according to the following rules :

− At definition level : #Wxxnn

--> each work field has '#W' for the starting characters

--> 'xx' : unique number (program level)

--> 'nn' : the level on which the work field was defined

− At cumulation level : #WxxLn

--> a cumulation field has '#W' for starting characters if it was a result from a program work field

--> 'xx' : unique number (program level) : this is the same number as the work field.

--> '$n' : the level on which the cumulation field must be available.

Program fields, derived from file fields, are built according to the following rules :

− Each field in the based-on file can be used as a level break field. To build these fields, the move-part of the field name is concatenated with 'OI', for old indicatives or with 'NI' for new indicatives.

Page 40: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 39 Batch Program: Detail Discription

− Each file field in the program can be cumulated to higher levels. To build these fields, the move-part of the field name is concatenated with 'Ln', where 'n' stands for the number of the level in the program this field must be available.

Furthermore, a set of program fields is used to execute particular functions. These program fields always start with the characters '##'.

!!! Because future extensions to the generator will add program fields to this list, no user-defined

program-fields should have '##' as starting characters.

The functions of these program fields are described below :

− ADDff 9(1) Add-switch for file ff. This switch is used to make 'add' the default database access when database accesses are generated '0' : the add-status is OFF '1' : the add-status is ON

− DELff 9(1) Delete-switch for file ff. This switch is used to make 'delete' the default database access when database accesses are generated !!! Every update access will be changed to delete. '0' : the delete-status is OFF '1' : the delete-status is ON

− FILE-KEYS Data structure that contains the keys from all the database files.

− FILE-STAT X(2) This field is a data structure that contains the file-status of a database file after an input/ output operation.

− INDIC-AREA X(99) This is an array that contains 99 program-indicators. Initially, this array is filled with B'0'. This array will be used by every OUTPUT operation on the printer file.

Page 41: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 40 Batch Program: Detail Discription

− KEY-filename This is the key-list name for the file with name 'filename'.

− OVERFLOW-ff X(2) This is the end-of-page indicator for printer file ff.

− PARIN X(256) This field is the entry parameter in the linkage section.

− PARM-CMDC X(2) This field is an element from the data structure PARM-IPC. The last pressed command key can be placed in this field, to make this information available to the calling program. In the future releases, a routine can be expected to fill this field automatically to fill this field automatically. In that case, the following rules will be followed : '01' = F01, '02' = F02,... , '90' = Roll-up, '91' = Roll-down, '00' = Enter, ...

− PARM-CVAL X(15). This field is an element of the parameter list for the Execution Environment program IP020RGB, which is used to check the entered value on the screen against a value list or a field range. PARM-CVAL must contain the value to be checked.

− PARM-DATI X(6) This field is an element of the parameter list for the Execution Environment program IP030RGB, which is used to check the validity of the date, in the program. PARM-DATI must contain the date to be checked.

− PARM-DATO X(6) This field is an element of the parameter list for the Execution Environment program IP030RGB, which is used to check the validity of the date, in the program. PARM-DATO will contain the checked date in the program, determined by the PARM-FMTO parameter.

− PARM-DBVL X(15) This field is an element of the parameter list for the Execution Environment program IP020RGB, which is used to check the value in the program against a value list or a field range. This field is intended for future use.

Page 42: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 41 Batch Program: Detail Discription

− PARM-DDCD X(10). This field is an element of the parameter list for the Execution Environment program IP020RGB, which is used to check the value in the program against a value list or a field range. PARM-DDCD must contain the name of the attribute base field for which the value tables or ranges were defined.

− PARM-DTSV X(1) This field is an element from the data structure PARM-IPC.

− PARM-FLNM X(8) This field is an element of the parameter list for the Execution Environment program IP095CLB, which is used to handle program errors.

− PARM-FMTI X(1) This field is an element of the parameter list for the Execution Environment program IP030RGB, which is used to check the validity of the date, in the program. PARM-FMTI must contain the format of the date, found in PARM-DATI.

− PARM-FMTO X(1) This field is an element of the parameter list for the Execution Environment program IP030RGB, which is used to check the validity of the date, in the program. PARM-FMTO must contain the format of the date, found in PARM-DATO.

− PARM-FRMT X(8) This field is an element of the parameter list for the Execution Environment program IP095CLB, which is used to handle program errors.

− PARM-IPC X(1024) The data structure to define the compositional elements for the data area IDPARM.

− PARM-MLTU X(6) This field is an element of the data structure PARM-IPC. It contains the language code of the user.

− PARM-OMSC X(30) This field is an element of the parameter list for the Execution Environment program IP020RGB, which is used to check the value in the program against a value list or a field range. PARM-OMSC brings the description of the value item back to the program.

Page 43: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 42 Batch Program: Detail Discription

− PARM-PLDT PLIST This field is the parameter list name for the Execution Environment program IP030RGB, which is used to check date validity.

− PARM-PLER PLIST This field is the parameter list name for the Execution Environment program IP095CLB, which is used as the error-handling program.

− PARM-PLVR PLIST This field is the parameter list name for the Execution Environment program IP020RGB, which is used to check values and ranges.

− PARM-SWVR X(1) This field is an element of the parameter list for the Execution Environment program IP020RGB, which is used to check the value in the program against a value list or a field range. PARM-SWVR is returned to the calling program. 'N' = incorrect value or range 'Y' = correct value or range

− PARM-TLCD X(1) This field is an element of the data structure PARM-IPC. It contains the language code of the application system.

− PARM-TLCU X(1) This field is an element of the data structure PARM-IPC. It contains the language code of the user.

− PARM-UPRM A(256) This field is an element of the data structure PARM-IPC. It contains the user parameter list. This parameter list can be used for inter program communication.

− PARM-USER X(10) This field is an element of the data structure PARM-IPC. The PARM-USER field contains the name of the user executing the program.

Page 44: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 43 Batch Program: Detail Discription

− SW-EOF-ff X(2) This is the end-of-file switch for database file ff. 'OF' = *default 'ON' = the based-on file has reached end-of-file. The value 'ON' is automatically assigned by the program when end-of-file is reached. The programmer can also change this field to 'ON' to stop the processing of further from the based-on file.

− SW-EXIT X(2) This field can be used to force the program main driver to be executed more than once. The value 'ON' is provided automatically to stop the program after execution of the program main driver. This value has to be changed to 'OF' in the END process point to provide another execution of the program main driver.

− SW-SKIP-REC X(2) This field is used to decide whether or not to process a record from the based-on file.

'OF' : the non-process status is OFF and the record will be processed

'ON' : the non-process status is ON and the record will not be processed. Initially, this value will be set to 'OF'. The programmer must decide, in the R99 routine, if a record from the based-on file must be processed. If not, the value must be set to 'ON' in the user code. This value will be automatically reset to 'OF' before the next execution of the R99 routine.

− TOTAL-FIELDS This data structure contains the total-fields defined by the user.

− UPDff 9(1) Update-switch for file ff. This switch is used to make 'update' the default database access when database accesses are generated '0' : the update-status is OFF '1' : the update-status is ON

− WORK-FIELDS This data structure contains the work-fields defined by the user.

Page 45: TABLE OF CONTENTSiseries.realdolmen.com/iddos/pdf/CBL04 - Batchprogram - Detail... · table of contents cbl04: batch program : detail description ..... 1

Manual IDDOS 13 CBL04 44 Batch Program: Detail Discription

− WS-GEN This field is a data structure used by a generated program.