Subroutines, Macros
2.5 Parameterized subroutine return (RET)
Job planning
Programming Manual, 03/2006 Edition, 6FC5398-2BP10-1BA0
2-15
RET
Subroutine end
(use instead of M17)
<block_number/label> Parameter: Block number or label as
STRING (constant or variable) of the
block at which to resume execution.
Execution is resumed in the calling
program at the block with the "Block
number/label".
<block after block with block number/label>, Parameter of type INTEGER
If the value is greater than 0,
execution is resumed at "Block
number/label". If the value is equal
to 0, the subroutine return goes to
the block with <block number/label>.
<no_of_return_levels>, Parameter of type INTEGER with the
permissible values 1 to 11.
Value = 1: The program is resumed in
the current program level –1 (like
RET without parameters).
Value = 2: The program is resumed in
the current program level –2,
skipping one level, etc.
<return to beg. of program>, Parameter of type BOOL
Value 1 or 0.
Value = 1 If the return goes to the
main program and ISO dialect mode is
active there, execution will be
resumed at the beginning of the
program.
Example of error handling: Resumption in the main program after ASUP processing
N10010 CALL "UP1" ; Program level 0 main program
N11000 PROC UP1 ; Program level 1
N11010 CALL "UP2"
N12000 PROC UP2 ; Program level 2
N19000 PROC ASUB ; Program level 2 (ASUB execution)
... RET("N10900", , ... ; Program level 3
N19100 RET(N10900,,$P_STACK) ; Subroutine return
N10900 ; Resumption in main program
N10910 MCALL ; Deactivate modal subroutine
N10920 G0 G60 G40 M5 ; Correct further modal settings