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
 

 

How to exit from a rexx program

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

Active User


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

PostPosted: Tue Nov 24, 2009 8:22 pm    Post subject: How to exit from a rexx program
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: 8593
Location: Back in jolly old England

PostPosted: Tue Nov 24, 2009 8:35 pm    Post subject:
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    Post subject:
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    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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm


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