Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Loop Termination with CLIST PROC

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Loop Termination with CLIST PROC
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: 1746
Location: Bloomington, IL

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

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Wed Nov 23, 2011 1:34 am    Post subject: Reply to: Loop Termination with CLIST PROC
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    Post subject: Reply to: Loop Termination with CLIST PROC
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Wed Nov 23, 2011 1:52 am    Post subject: Reply to: Loop Termination with CLIST PROC
Reply with quote

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

Global Moderator


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

PostPosted: Wed Nov 23, 2011 1:57 am    Post subject: Re: Reply to: Loop Termination with CLIST PROC
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    Post subject: Reply to: Loop Termination with CLIST PROC
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts save SAY var loop. italo_pm CLIST & REXX 3 Sun Sep 04, 2016 3:06 am
No new posts how to find clist's or view library Andrew Hsia CLIST & REXX 4 Tue Jun 28, 2016 6:07 pm
No new posts 2 same CLIST pgm but with different n... boyti ko CLIST & REXX 5 Fri Jun 03, 2016 4:55 pm
No new posts New PROC not reflecting in prod even ... Musab Ahmed CA Products 9 Tue Mar 15, 2016 12:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us