This PP command forces this to be the last time round a named loop. This command has no effect until the *END command is reached. So:

[*do lpRound=33:99]

[*last lpRound]

Line out [lpRound]

[*end lpRound]

will output one line:

Line out 33

Note that the *LAST command must refer to a valid PP loop index. It does not have to be the last opened loop where loops are nested.

[*do lpOuter=33:99]

[*do lpInner=1:3]

[*last lpOuter]

Line inside [lpOuter] [lpInner]

[*end lpInner]

Line outside [lpOuter]

[*end lpOuter]

will output four lines:

Line inside 33 1

Line inside 33 2

Line inside 33 3

Line outside 33

If *SLE is encountered for a loop after *LAST it will be actioned.

PP command *LAST can also be used on a DBLOOP index. In this case any subsequent *SLE will be executed. PP command *SLE does not work with ODBC except when *LAST has been used.