Sunteți pe pagina 1din 30

RPG/400

Date 19-Sep-2005

Manu Soman

Contents
What are Indicators Part I
Indicators on RPG/400

Part II
More on Indicators

Part III
Usage of Indicators

Part IV
Indicators Referred to As Data

What are Indicators

An RPG indicator is a switch that can be turned on or off to

provide information about the result of an instruction performed in by the program. itself.
1 ON True 0 OFF False

More ..
Indicators are defined either by an entry on the specification or

by the RPG/400 program itself.


An indicator that has been defined can also be used to condition

calculation and output operations.


The RPG/400 program sets and resets certain indicators at

specific times during the program cycle.

Types of Indicators
General Indicators 01 to 99 These indicators can be used for any purpose for controlling I/O

operation of file, controlling conditions etc.


Special Purpose Indicators

LR 1P QA QG, QV H1 to H9 KA to KY L1 to L9 M1 to M9, MR U1 to U8

Last Record First Page Overflow indicators Halt Indicators Function Keys Level Break Indicators Matching Records External Indicators

Indicator Example

Part I Indicators on RPG/400

Types
Overflow Indicators Record Identifying Indicators Control Level Indicators Field Indicators Resulting Indicators

Overflow Indicators
Overflow Indicators are used to check whether the last line of a

page has been printed or passed.


Overflow Indicators can be defined on
File specifications from positions 33 to 34. Calculation Specifications from positions 9 to 17.

Output Specifications from positions 23 to 24.


Overflow indicators can be specified only for program described

PRINTER files.

Record Identifying Indicators


This indicator is set on when corresponding record type is set on

for processing.
This is defined on input specifications from positions 19 to 20.
The valid record identifying Indicators are
01 - 99

H1 - H9
L1 - L9 LR

U1 - U9
RT

10

Control level indicators


This indicator designates an input field as a control field and is

defined by an entry in positions 59 and 60 of I specifications.


The valid entries are L1 through L9 with L1 being the lowest and L9

the highest in the order of importance.


Control fields can be specified only for primary and secondary files.

11

Field Indicators
Field Indicators are used to determine if the specified element is

less than zero, greater than zero, zero or blank.


These are generally defined by an entry in positions 65 and 66,

67 and 68 or 69 and 70 of the input specifications.


Halt indicators (H1 through H9) can be used as field indicators

to check for an error condition in the field or array element as it is read into the program.

12

Resulting Indicators
The purpose of the resulting indicators depends on the Operation

Code specified in positions 28 through 32.


Resulting indicators are generally used to test the result field

after an arithmetic operation, to identify a record-not-found condition, to indicate an exception/error condition for a file operation, or to indicate an end-of-file condition.
You can specify resulting indicators in three places (positions

54-55, 56-57, and 58-59) of the calculation specifications.

13

Example

14

Part II More on Indicators

15

Types
External Indicators Internal Indicators Return indicator

16

External Indicators
External indicators are through U1 and U8 and these can be set

up in a CL or RPG program.
The status of the external indicators can be changed in the

program by specifying them as resulting indicators on the calculation specifications or as field indicators on the input specifications.
Setting the external indicators on or off in the program has no

effect on file operations.

17

Internal Indicators
Internal indicators are of 3 types First Page Indicator Last Record Indicator Matching Record Indicator

18

Return Indicator
Return Indicator is used to indicate to the internal RPG/400 logic

that control should be returned to the calling program.


RT can be set on as a record identifying indicator, a resulting

indicator, or a field indicator and can also be used as a conditioning indicator for calculation or output operations.

19

Part III - Usage of Indicators

20

Types
Indicators are also used to represent a certain condition, which

are as follows..
File Conditioning Indicators Function Key Indicators

Halt Indicators
Indicators conditioning Calculations

21

File Conditioning Indicators


The file conditioning indicators (U1 to U8) are specified in

positions 71 and 72 of the file description specifications.


If the indicators specified in positions 71 and 72 is off when the

program is called, the file is not opened and file operations for that file are ignored while the program is running.
A file conditioning entry can be made for input, output, update,

or combined files.
..FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U1.. FADDDSP CF E WORKSTN UC

22

Function Key Indicators


Function key indicators in a program that contains a WORKSTN

device if associated function keys are specified in the data description specifications.
The function key indicators correspond to function keys 1

through 24. Function key indicator KA corresponds to function key 1, KB to function key 2 . . . KY to function key 24.
Function key indicators that are set on can then be used to

condition calculation or output operations and can also be set off by the SETOF operation.

23

Halt Indicators

Halt indicators are used to indicate errors during the running of the program.

If a halt indicator is on, a message is issued to the user of which the following responses are valid:

Set off the halt indicator and continue the program.

Issue a dump and end the program.


End the program with no dump.

If a halt indicator is on when a RETRN operation is processed or when the LR indicator is on, the called program ends abnormally.

24

Indicators Conditioning Calculations


Indicators that are used to specify the conditions under which a

calculation is done.
Indicators to condition calculations can be specified in positions

7 and 8 and/or in positions 9 through 17.

25

Part IV - Indicators Referred as Data

26

*IN
The array *IN is a predefined array of 99 one-position, character

elements representing the indicators 01 through 99. The elements of the array should contain only the character values '0' (zero) or '1' (one).
Moving a character '0'or '1' or *OFF or *ON to any of these

fields sets the corresponding indicator Off or On.

27

*INxx
The field *INxx is a predefined one-position character field

where xx represents any one of the RPG/400 indicators except 1P or MR.


Any value, other than '0' (zero) or '1' (one)should not be moved

to *INxx.

28

Quiz

29

Thank You

30

S-ar putea să vă placă și