+ All Categories
Home > Documents > RPG400 Indicators

RPG400 Indicators

Date post: 27-Oct-2014
Category:
Upload: udayavalluru
View: 130 times
Download: 4 times
Share this document with a friend
Description:
RPG Indicator information in brief.
Popular Tags:
30
RPG/400 Date 19-Sep-2005 Manu Soman
Transcript
Page 1: RPG400 Indicators

RPG/400Date 19-Sep-2005

Manu Soman

Page 2: RPG400 Indicators

2

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

Page 3: RPG400 Indicators

3

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 0‘ON’ ‘OFF’

True False

Page 4: RPG400 Indicators

4

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.

Page 5: RPG400 Indicators

5

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 Last Record • 1P First Page• QA – QG, QV Overflow indicators• H1 to H9 Halt Indicators• KA to KY Function Keys• L1 to L9 Level Break Indicators• M1 to M9, MR Matching Records• U1 to U8 External Indicators

Page 6: RPG400 Indicators

6

Indicator Example

Page 7: RPG400 Indicators

7

Part I – Indicators on RPG/400

Page 8: RPG400 Indicators

8

Types

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

Page 9: RPG400 Indicators

9

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.

Page 10: RPG400 Indicators

10

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

Page 11: RPG400 Indicators

11

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.

Page 12: RPG400 Indicators

12

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.

Page 13: RPG400 Indicators

13

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.

Page 14: RPG400 Indicators

14

Example

Page 15: RPG400 Indicators

15

Part II – More on Indicators

Page 16: RPG400 Indicators

16

Types

External Indicators Internal Indicators Return indicator

Page 17: RPG400 Indicators

17

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.

Page 18: RPG400 Indicators

18

Internal Indicators

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

Page 19: RPG400 Indicators

19

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.

Page 20: RPG400 Indicators

20

Part III - Usage of Indicators

Page 21: RPG400 Indicators

21

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

Page 22: RPG400 Indicators

22

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

Page 23: RPG400 Indicators

23

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.

Page 24: RPG400 Indicators

24

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.

Page 25: RPG400 Indicators

25

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.

Page 26: RPG400 Indicators

26

Part IV - Indicators Referred as Data

Page 27: RPG400 Indicators

27

*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.

Page 28: RPG400 Indicators

28

*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.

Page 29: RPG400 Indicators

29

Quiz

Page 30: RPG400 Indicators

30

Thank You


Recommended