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

IFTHEN WHEN=ANY usage?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Nov 28, 2011 6:12 pm
Reply with quote

Hi,

Can any one please let me know the usage of WHEN=ANY clause in the IFTHEN statement?

From the Manual --> WHEN=ANY: Used after multiple WHEN=(logexp) clauses to apply additional operation to the records if they satisfied the criteria for any of the preceding WHEN=(logexp) clauses.

I tried using when=any but the output was not as expected.

MY JCL
Code:

//STEP002  EXEC PGM=SORT,COND=(0,NE)                       
//SYSPRINT DD SYSOUT=*                                     
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
AA 01                                                     
AA 02                                                     
AA 03                                                     
AA 04                                                     
AA 05                                                     
AA 06                                                     
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(50:SEQNUM,2,ZD)),       
        IFTHEN=(WHEN=(4,2,ZD,EQ,+02),                     
                OVERLAY=(10:C'REC TYPE 2')),               
        IFTHEN=(WHEN=(4,2,ZD,EQ,+03),                     
                OVERLAY=(10:C'REC TYPE 3')),               
        IFTHEN=(WHEN=ANY,                                 
                OVERLAY=(40:C'XXX')),                     
        IFTHEN=(WHEN=NONE,                                 
                OVERLAY=(10:C'NO VALID REC'))             
/*                                                         


OUTPUT:
Code:

AA 01    NO VALID REC                            01
AA 02    REC TYPE 2                              02
AA 03    REC TYPE 3                              03
AA 04    NO VALID REC                            04
AA 05    NO VALID REC                            05
AA 06    NO VALID REC                            06


Can any one please give a sample jcl with a example of showing when=any?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Nov 28, 2011 6:57 pm
Reply with quote

HIT=NEXT?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Nov 28, 2011 7:21 pm
Reply with quote

HIT=NEXT is right on.
Quote:
Processing of IFTHEN clauses continues unless one of the following occurs: A WHEN=(logexp) or WHEN=ANY clause is satisfied, and HIT=NEXT is not specified
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Nov 28, 2011 7:50 pm
Reply with quote

Thanks Bill and Dick. It working fine now... icon_smile.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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts STEM usage in REXX CLIST & REXX 14
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts JCL and TAPE drives: how to maximize ... JCL & VSAM 9
Search our Forums:

Back to Top