Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1777
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: 10327
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: 10327
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: 1777
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
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts LIBDEF not working in called proc packerm CLIST & REXX 0 Fri Sep 15, 2017 7:22 pm
No new posts Calling CLIST through job and REXX Sahasra K CLIST & REXX 19 Tue Aug 01, 2017 10:25 am
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am
No new posts Trace in CLIST PANEL cvnlynn CLIST & REXX 1 Thu Jun 22, 2017 11:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us