IBM AS/400 manual Subprocedure logic, Indicators, RPG IV Overview, The first, last

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 29
Image 29
The first

RPG IV Overview

.2/ RPG reads the next record and sets on the record identify control level indicators.

.3/

RPG

processes total calculations (conditioned by control level

 

L1

through L9, an LR indicator, or an L0 entry).

 

 

.4/

RPG

processes all total output lines

(identified

by

a T in

 

the

output

specifications).

 

 

 

 

 

.5/

RPG

determines if the LR indicator

is on. If it is on, the

.6/

The

fields of the selected input

records move from the rec

 

essing area.

RPG sets

on

field

indicators.

 

 

.7/

RPG processes all detail calculations (not conditioned by cont

 

indicators

in

positions

7

and

8

of

the calculation specificati

 

the

data

from the record

at

the

beginning of

the

cycle.

The first

cycle

 

 

 

 

 

 

 

 

 

 

The first and last time through the program cycle differ somewhat f Before reading the first record the first time through the cycle, three things:

¹ handles input parameters, opens files, initializes program data

¹ writes the records conditioned by the 1P (first page) indicator

¹ processes all heading and detail output operations.

For example, heading lines printed before reading the first record constant or page heading information, or special fields such as PAGE a The program also bypasses total calculations and total output steps on cycle.

The

last

cycle

 

 

 

 

 

 

 

 

 

The

last time

a

program goes through

the cycle,

when

no

more

record

able,

the program sets the LR (last

record) indicator

and the

L1 t

level) indicatorson . toThe program processes the

total

calculations

and

tot

output,

then

all

files are closed, and then

the

program

ends.

 

 

Subprocedure logic

The general flow of a subprocedure is much simpler: the calculations cedure are done once, and then the subprocedure returns. There is generated for a subprocedure.

Indicators

An indicator is a one-byte character field that is either set on (' generally used to indicate the result of an operation or to conditi processing of an operation. Indicators are like switches in the flow logic. They determine the path the program will take during processin on how they are set or used.

Indicators can

be

defined

as variables on the definition specifica

also

use RPG

IV

indicators,

which are defined either by an entry

or

by the

RPG

IV program

itself.

Chapter 1. Overview of the RPG IV Programming5 Language

Page 29
Image 29
IBM AS/400 manual Subprocedure logic, Indicators, RPG IV Overview, The first, last