Control levels?

AS/400 programming
What are control levels? In my program there is I Spec with control levels L1, L2 , AND L3 are associated with three fields of a file as follows
And further two subroutines are getting invoke depending upon the level value i.e
L1 EXSR xxdsp (L1 at conditional indicator position)
L1 EXSR yydsp (L1 at level position)
What does it mean?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Assuming that your program is written using RPG/400 you should refer to the RPG/400 Reference manual. This manual describes the use of control level indicators L1 through L9 in Chapter 3 (RPG/400 Indicators).

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Gilly400
    Hi, The L0-L9 indicators are "Level Break" indicators. These indicators are set on when the value in the field in your input specs changes. They are/were commonly used for subtotals and totals in reports. The reason for the two EXSR statements is the RPG cycle - the EXSR with L1 in the conditional indicator position will be performed each time the statement is encountered and L1 is set on. The EXSR with the L1 at level position (which is probably in your main routine, just before *INLR is seton or the RETURN opcode) will only be performed at "Total time". The RPG reference contains more information on the RPG cycle - this is a fairly complex subject on it's own. Most programmers avoid it these days, but in the days of System/34 and System/36 it was standard practice. Regards, Martin Gilbert.
    23,730 pointsBadges:
  • graybeard52
    So, in your example, the L1 indicator is turned on when the value in field3 changes. The EXSR with the L1 in the level column will then execute, BEFORE the input fields are read into memory. Usually this outputs totals of some kind. The the input buffer is loaded with the next record (with the "new" field3 value), and the rest of the calc (with no level indicator) runs. The L1 indicator is still on while the first record in this group gets processed. Thus the EXSR with the conditioning L1 and no level get executed on the first record of the new group. The L2 and L3 work the same way, except that they also turn on all lower indicators. So when field2 changes, both L2 and L1 are seton (even if field3 doesn't change) and get processed. When field1 changes, L3, L2, L1 all get turned on. The LR indicator that gets turned on at last record, turns on all the "L" indicators, so all totals get processed.
    3,115 pointsBadges:
  • Pcatlin
    You might also take a look at this flowchart: RPG Cycle It is the official RPG logic cycle flow. In your example field1, field2 and field3 are "control fields" for the purposes of this flowchart. -Phil C
    200 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: