IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Loop Termination with CLIST PROC


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
akhi007

New User


Joined: 30 Jan 2006
Posts: 35
Location: Richmond

PostPosted: Wed Nov 23, 2011 1:22 am
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Nov 23, 2011 1:28 am
Reply with quote

Use return rather than exit.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 23, 2011 1:34 am
Reply with quote

NO
( just tested, both with EXIT and RETURN )
Back to top
View user's profile Send private message
akhi007

New User


Joined: 30 Jan 2006
Posts: 35
Location: Richmond

PostPosted: Wed Nov 23, 2011 1:38 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 23, 2011 1:52 am
Reply with quote

deleted
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Nov 23, 2011 1:57 am
Reply with quote

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
View user's profile Send private message
akhi007

New User


Joined: 30 Jan 2006
Posts: 35
Location: Richmond

PostPosted: Wed Nov 23, 2011 1:59 am
Reply with quote

You got me.. icon_biggrin.gif I was using IKJEFT1A.. Switched to IKJEFT01 few mins ago and it went thru... I need to be careful !! icon_surprised.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
This topic is locked: you cannot edit posts or make replies. REXX - Do - Not able to LOOP CLIST & REXX 10
No new posts REXX - Dataset checking in a do forev... CLIST & REXX 6
No new posts Same command as on commandline in REX... TSO/ISPF 6
Search our Forums:

Back to Top