Date 19-Sep-2005

Manu Soman

 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


 The RPG/400 program sets and resets certain indicators at specific times during the program cycle.. 4 .  Indicators are defined either by an entry on the specification or by the RPG/400 program itself.More .  An indicator that has been defined can also be used to condition calculation and output operations.

MR U1 to U8 Last Record First Page Overflow indicators Halt Indicators Function Keys Level Break Indicators Matching Records External Indicators 5 . controlling conditions etc.Types of Indicators  General Indicators 01 to 99  These indicators can be used for any purpose for controlling I/O operation of file.  Special Purpose Indicators • • • • • • • • LR 1P QA – QG. QV H1 to H9 KA to KY L1 to L9 M1 to M9.

Indicator Example 6 .

Part I – Indicators on RPG/400 7 .

Types  Overflow Indicators  Record Identifying Indicators  Control Level Indicators  Field Indicators  Resulting Indicators 8 .

 Overflow indicators can be specified only for program described PRINTER files.  Overflow Indicators can be defined on • File specifications from positions 33 to 34. 9 .Overflow Indicators  Overflow Indicators are used to check whether the last line of a page has been printed or passed. • Calculation Specifications from positions 9 to 17. • Output Specifications from positions 23 to 24.

H9 L1 .Record Identifying Indicators  This indicator is set on when corresponding record type is set on for processing.L9 LR • • U1 .99 • • • H1 .  The valid record identifying Indicators are • 01 .U9 RT 10 .  This is defined on input specifications from positions 19 to 20.

 Control fields can be specified only for primary and secondary files.  The valid entries are L1 through L9 with L1 being the lowest and L9 the highest in the order of importance.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. 11 .

greater than zero. 12 .  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. 67 and 68 or 69 and 70 of the input specifications. zero or blank.  These are generally defined by an entry in positions 65 and 66.Field Indicators  Field Indicators are used to determine if the specified element is less than zero.

56-57. to identify a record-not-found condition. or to indicate an end-of-file condition.Resulting Indicators  The purpose of the resulting indicators depends on the Operation Code specified in positions 28 through 32. 13 . and 58-59) of the calculation specifications.  Resulting indicators are generally used to test the result field after an arithmetic operation. to indicate an exception/error condition for a file operation.  You can specify resulting indicators in three places (positions 54-55.

Example 14 .

Part II – More on Indicators 15 .

Types  External Indicators  Internal Indicators  Return indicator 16 .

 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.External Indicators  External indicators are through U1 and U8 and these can be set up in a CL or RPG program. 17 .  Setting the external indicators on or off in the program has no effect on file operations.

Internal Indicators  Internal indicators are of 3 types • First Page Indicator • Last Record Indicator • Matching Record Indicator 18 .

19 .Return Indicator  Return Indicator is used to indicate to the internal RPG/400 logic that control should be returned to the calling program. a resulting indicator. or a field indicator and can also be used as a conditioning indicator for calculation or output operations.  RT can be set on as a record identifying indicator.

Usage of Indicators 20 .Part III .

. which are as follows…. • File Conditioning Indicators • Function Key Indicators • Halt Indicators • Indicators conditioning Calculations 21 .Types  Indicators are also used to represent a certain condition.

.U1.  A file conditioning entry can be made for input. output.File Conditioning Indicators  The file conditioning indicators (U1 to U8) are specified in positions 71 and 72 of the file description specifications..L..KExit++Entry+A...Device+..I... update.. ... the file is not opened and file operations for that file are ignored while the program is running....  If the indicators specified in positions 71 and 72 is off when the program is called.. or combined files......... FADDDSP CF E WORKSTN UC 22 ..FFilenameIPEAF..

KY to function key 24.  The function key indicators correspond to function keys 1 through 24. Function key indicator KA corresponds to function key 1.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. KB to function key 2 . 23 .  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. . .

the called program ends abnormally. End the program with no dump. 24 .  If a halt indicator is on when a RETRN operation is processed or when the LR indicator is on.  If a halt indicator is on.Halt Indicators  Halt indicators are used to indicate errors during the running of the program. 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.

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.

Indicators Referred as Data 26 .Part IV .

character elements representing the indicators 01 through 99.  Moving a character '0'or '1' or *OFF or *ON to any of these fields sets the corresponding indicator Off or On. 27 .*IN  The array *IN is a predefined array of 99 one-position. The elements of the array should contain only the character values '0' (zero) or '1' (one).

 Any value. 28 . other than '0' (zero) or '1' (one)should not be moved to *INxx.*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.

Quiz 29 .

Thank You  30 .

Sign up to vote on this title
UsefulNot useful