IBM AS/400 manual Cycle Programming, RPG IV Overview, RPG Program Logic Cycle

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 28
Image 28
Cycle Programming

RPG IV Overview

Cycle Programming

When

a system processes data,

it must do the processing in a partic

This

logical order is provided

by:

¹ The ILE RPG compiler

¹The program code

The logic the compiler supplies

programis calledcycle

the.When

you

let

the

 

 

compiler

provide

the

logic

for

your

programs,cycle programmingit is

called.

 

 

 

The

program

cycle

is

a series of steps that your program repeats un

condition

is

reached.

Depending

on

the

specifications

you

code,

the

 

or

may

not

use

each

step

in

the

cycle.

 

 

 

 

 

 

 

 

If

you

want to

 

have

files controlled by the cycle,

the

information

t

RPG

specifications

in

your source program need not specify when recor

files are

read.

The

compiler

supplies

the logical

order

for

these

op

some

output

operations,

when

your

source

program

is

compiled.

 

 

 

If you do not want

to

have

files

controlled by

 

the

cycle,

you

must

some

other

way,

 

either

by creating an

 

end-of-file

 

condition

by setting

record (LR) indicator, by creating a return condition by setting on th indicator, or by returning directly using the RETURN operation.

Note: No cycle code is generated for subprocedures or when NOMAIN is fied on the control specification.

Figure 1 shows the specific steps in the general flow of the RPG pro

Start

Perform

detail

calculations

Write heading and detail lines

Move fields

Get input

record

No

LR on

Yes

End of

program

Perform

total

calculations

Write total output

Figure 1. RPG Program Logic Cycle

.1/ RPG processes all heading and detail lines (H or D in position output specifications).

4 ILE RPG for AS/400 Programmer's Guide

Page 28
Image 28
IBM AS/400 manual Cycle Programming, RPG IV Overview, RPG Program Logic Cycle