Trail: PROIV Documentation > Developer > PROIV Developer > Developing Functions > Events and Logic > CALLEXIT

 

 

Purpose

CALLEXIT returns control to calling function or cycle, after processing end-of-function logics.
 

Syntax

CALLEXIT({return code})
 

Operation

return code  is optional and can be of three value types:

1) the default value of 1003

2) any number the user defines (recommended range 0 - 999)


3) negative numbers generated by a system error.
 

Remarks

If a return code that is less than zero or greater than 999 is specified the code will be considered valid by PROIV.  However, you may accidentally use a number that is reserved for the system.  PROIV permits the user to use any number, and does not check to see if a predefined system number is being used.  For best results stay within the above-defined limits.

When a CALLEXIT is issued, processing returns to the next step of the calling function or cycle. 

If the calling function is the topmost function, then CALLEXIT processing is similar to FNEXIT.

When a CALLEXIT is issued from a function of a logical screen, the top most exit logic is executed (all intermediate exit logics are ignored, see the examples below), and any necessary commits to databases are automatically issued.  The value of the return code equals the value assigned by the last CALLEXIT encountered within the function or logical screen.
 

Example

LSCALL(CompStat,RETURNCODE)

If LSCALL(CompStat,#ReturnCode) is run and cycle CompStat issues a CALLEXIT(999) then #ReturnCode=999.

If LSCALL(CompStat,#ReturnCode) is run and cycle CompStat issues a CALLEXIT without an argument then #ReturnCode=1003, provided a system error has not occurred.

If LSCALL(CompStat,#ReturnCode) is run and cycle CompStat issues a CALLEXIT without an argument and a system error has occurred, then #ReturnCode will be a negative number.  For example if a function call is issued and the function does not exist, the return code will be –660, which is the system value for an INVALID GLOBAL FUNCTION NAME error message.

If LSCALL(CompStat,#ReturnCode) is issued, followed by LSCALL(StatStep,#ReturnCode), and the flow falls through other LSCALLs and the final one issues a CALLEXIT(123), control is immediately returned to the exit logic of cycle StatStep (skipping all the intermediate exit logics) with a return value of 123.  When the exit logic of LS6 is complete, control is returned to LS5 with #ReturnCode=123, unless the value of #ReturnCode is modified by an addition CALLEXIT command during the exit logic of LS6 (in such cases the new value is returned to LS5, see the following example).

If LSCALL (5,#ReturnCode) is issued, followed by LSCALL(6,#ReturnCode), and the flow falls through  LS7, LS8, eventually to LS9, and LS9 issues a CALLEXIT(123), control is immediately returned to the exit logic of LS6 (skipping the intermediate exit logics of LS7 and LS8), with a return value set to 123.  For this example, the exit logic of LS6 issues a CALLEXIT(456) command.  When the exit logic is complete, control is returned to LS5 with #ReturnCode=456.  Note that the new return value assigned in the exit logic of LS6 is the value that is returned to LS5.  Also note that because a CALLEXIT command (from LS9) was in progress when the exit logic of LS6 issued its CALLEXIT command, a new CALLEXIT is not added to the command stack; the functional part of the new CALLEXIT command is totally ignored, only its argument is recognized.
 

Comment on this topic

Topic ID: 520026

 
 
 

Table of Contents

Index

Glossary

-Search-

Back