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

How to exit from a rexx program


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

Active User


Joined: 22 Mar 2009
Posts: 161
Location: South Africa

PostPosted: Tue Nov 24, 2009 8:22 pm
Reply with quote

Hi, Please check below:

REXX Program:
Code:

/**********REXX***********/                                                 
PARM1=ITSORT                                                           
PARM2=TREC                                                             
"EXECIO * DISKR MYINDD (FINIS STEM REC."                               
DO I = 1 TO REC.0                                                       
  IF (SUBSTR(REC.I,1,6) == PARM1) & (SUBSTR(REC.I,8,4) \= PARM2) THEN
    SAY "YOU ENTERED A WRONG PROGRAM MODE. ",                 
            "ENTER THE PROGRAM MODE AS: " SUBSTR(REC.I,8,4)   
  ELSE                                                       
    SAY "CONGRATS YOU ENTERED RIGHT PROGRAM AND MODE"                             
END       


Output:

YOU ENTERED A WRONG PROGRAM MODE. ENTER THE PROGRAM MODE AS: BATC
CONGRATS YOU ENTERED RIGHT PROGRAM AND MODE
CONGRATS YOU ENTERED RIGHT PROGRAM AND MODE
CONGRATS YOU ENTERED RIGHT PROGRAM AND MODE
***

the content of file :

ITSORT BATC
ITTEST ONLI
TESTMR DUAL
TESTIT BATC

Here even if the condition with the first IF statement matches it is still going to the ELSE condition. I need to exit out of the IF condition whenever the 1st IF satisfies.
Can anyone suggest me.

Thanks,
Abhijit.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Nov 24, 2009 8:35 pm
Reply with quote

Learn to use code tags ! ........... and the EXIT statement
Code:
/**********REXX***********/
/*TRACE I*/
/*ARG PARM1 PARM2*/
PARM1=ITSORT
PARM2=TREC
"ALLOC DA('TESTITN.PGMNAME.LIST') F(MYINDD) SHR REUSE"
"EXECIO * DISKR MYINDD (FINIS STEM REC."
DO I = 1 TO REC.0
  IF (SUBSTR(REC.I,1,6) == PARM1) & (SUBSTR(REC.I,8,4) \= PARM2)
  THEN DO
    SAY "YOU ENTERED A WRONG PROGRAM MODE. ",
    "ENTER THE PROGRAM MODE AS: " SUBSTR(REC.I,8,4)
    EXIT
  END
  ELSE
    SAY "CONGRATS YOU ENTERED RIGHT PROGRAM AND MODE"
END
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Nov 24, 2009 8:38 pm
Reply with quote

deleted by poster
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top