View previous topic :: View next topic
|
Author |
Message |
akhi007
New User
Joined: 30 Jan 2006 Posts: 35 Location: Richmond
|
|
|
|
Hi,
Facing an issue with DO WHILE/DO loops in a CLIST PROC. CLIST PROC is calling a REXX routine in a DO WHILE loop. REXX code can return an RC 0 or 4. It runs fine when the rexx routine returns the RC of 0 and exiting the loop when return code is 4.
For e.g. Clist program is given below
Code: |
PROC 0
WRITE INSIDE CLIST PROC
WRITE BEFORE LOOP
SET &I = 1
DO WHILE &I <= 5
WRITE COUNTER VALUE = &I
%REXXPGM
SET I = &I + 1
END
WRITE AFTER LOOP
EXIT(0)
|
REXX program
Code: |
/*rexx*/
say "inside rexxpgm"
rc = 4
exit rc
|
Did any one experienced issue like this before?
Thanks ! |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Use return rather than exit. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
NO
( just tested, both with EXIT and RETURN ) |
|
Back to top |
|
|
akhi007
New User
Joined: 30 Jan 2006 Posts: 35 Location: Richmond
|
|
|
|
My apologies, forgot to mention. It works fine with EXIT & RETURN in foreground, but while running in batch, it comes out of the loop and exiting the program.
Added a display statement for return code
Code: |
PROC 0
WRITE INSIDE CLIST PROC
WRITE BEFORE LOOP
SET &I = 1
DO WHILE &I <= 5
WRITE COUNTER VALUE = &I
%REXXPGM
WRITE RCODE = &LASTCC
SET I = &I + 1
END
WRITE AFTER LOOP
EXIT CODE(0)
|
Output in foreground
Code: |
INSIDE CLIST PROC
BEFORE LOOP
COUNTER VALUE = 1
INSIDE REXXPGM
RCODE = 4
COUNTER VALUE = 2
INSIDE REXXPGM
RCODE = 4
COUNTER VALUE = 3
INSIDE REXXPGM
RCODE = 4
COUNTER VALUE = 4
INSIDE REXXPGM
RCODE = 4
COUNTER VALUE = 5
INSIDE REXXPGM
RCODE = 4
AFTER LOOP |
Output in TSO Batch
Code: |
INSIDE CLIST PROC
BEFORE LOOP
COUNTER VALUE = 1
INSIDE REXXPGM |
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
deleted |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
akhi007 wrote: |
My apologies, forgot to mention. It works fine with EXIT & RETURN in foreground, but while running in batch, it comes out of the loop and exiting the program. |
Ah, you are invoking TSO by the IKJEFT1B entry point rather than IKJEFT01 in the background, aren't you. Switch to IKJEFT01. |
|
Back to top |
|
|
akhi007
New User
Joined: 30 Jan 2006 Posts: 35 Location: Richmond
|
|
|
|
You got me.. I was using IKJEFT1A.. Switched to IKJEFT01 few mins ago and it went thru... I need to be careful !! |
|
Back to top |
|
|
|