Avoid recursive calls in LANSA functions when using ATTN-key
|Product/Release:||LANSA for the AS/400|
|Abstract:||LANSA ATTN program for LANSA|
|Submitted By:||LANSA Technical Support|
A common practice in the AS/400 world is to attach a menu to the ATTN-key. This makes it then very simple for users to start up various procedures from no matter which screen they are using. However a small problem occurs if the screen is displayed from a LANSA function and the user would like to start up another LANSA function from the ATTN-key menu, resulting in a recursive call. There is a way of avoiding this recursive call by using a couple of CL programs to transfer the job between groups.
The first CL program (PGM1) should be called from the ATTN-key menu where the call to the LANSA function would normally be placed. This program then calls the second program which actually calls the LANSA function.
DCL VAR(&GRPJOB) TYPE(*CHAR) LEN(10)
/* Start a separate group task and call program 2 */
IF COND(&GRPJOB *NE ‘A') THEN(DO)
TFRGRPJOB GRPJOB(B) INLGRPPGM(PGM2)
/* If transfer failed, try again */
MONMSG MSGID(CPF1310) EXEC(TFRGRPJOB GRPJOB(B) INLGRPPGM(PGM2)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(END))
LANSA REQUEST(RUN) PROCESS(pppppp) FUNCTION(fffff) PARTITION(ppp)
Be sure to remove LANSA's own attention key program by setting position 462 of data area [email protected]' to N.