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

check on current day of the Week


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

New User


Joined: 26 Apr 2010
Posts: 9
Location: chennai

PostPosted: Wed Jun 01, 2011 2:00 pm
Reply with quote

I want to do a if check with current day of the week.

My requirement is : If current day is "MON" , I need to write DATE4- 3 in the output file.
If current day is not equal to "MON" , i need to write DATE4 - 1 in output file.

I am using the below sort jcl

Code:
//STEP010 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
CUR_DAY,S'&WDAY'
/*
//SORTIN   DD *
HARITHA
/*
//SORTOUT  DD DSN=TEST.SORT,
//            DISP=(,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(125,50),RLSE)
//SYSIN     DD *
  OPTION COPY
  INREC FIELDS=(01:001,07,
                          08:C';',
                          09:DATE4)
    OUTREC IFTHEN=(WHEN=(CUR_DAY,CH,EQ,C'MON'),
                               BUILD= (09:DATE4-3)),
                 IFTHEN=(WHEN=(CUR_DAY,CH,NE,C'MON'),
                               BUILD=(09:DATE4-1))
END


But this sort step is failing if I'm doing comparison on CUR_DAY field in WHEN=(CUR_DAY,CH,EQ,C'MON') condition.

Please help me out in this.

Thanks,
Haritha
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jun 01, 2011 2:23 pm
Reply with quote

Your understanding of the use of SYMNAMES is flawed.

The comparison should first specify a field in the record being input to SORT, not the field identified by SYMNAMES.

e.g. WHEN=(1,3,CH,EQ,C'MON')

or if SYMNAMES defines CUR_DAY,1,3 then WHEN=(CUR_DAY,CH,EQ,C'MON') syntax will translate to WHEN=(1,3,CH,EQ,C'MON').

Garry.
Back to top
View user's profile Send private message
sreeharithag

New User


Joined: 26 Apr 2010
Posts: 9
Location: chennai

PostPosted: Wed Jun 01, 2011 5:10 pm
Reply with quote

Garry,

Can we define SYMNAMES as CUR_DAY,1,3???It didn't worked for me.

Thanks,
haritha
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Jun 01, 2011 6:18 pm
Reply with quote

Try this

Code:
//STEP010 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SYMNAMES DD *                                               
CUR_DAY,S'&WDAY'                                               
/*                                                             
//SORTIN   DD *                                               
HARITHA                                                       
/*                                                             
//SORTOUT  DD SYSOUT=*                                         
//SYSIN     DD *                                               
  OPTION COPY                                                 
  INREC FIELDS=(01:001,07,08:C';',09:DATE4,30:CUR_DAY)         
     OUTREC IFTHEN=(WHEN=(30,3,CH,EQ,C'MON'),                 
                                 BUILD=(09:DATE4-3)),         
                   IFTHEN=(WHEN=(30,3,CH,NE,C'MON'),           
                                 BUILD=(09:DATE4-1))           
END                                                           
Back to top
View user's profile Send private message
sreeharithag

New User


Joined: 26 Apr 2010
Posts: 9
Location: chennai

PostPosted: Wed Jun 01, 2011 6:39 pm
Reply with quote

Thanks for the reply.I have tried this.This works fine.
But i do not want the current day to be written into output file.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Jun 01, 2011 6:47 pm
Reply with quote

This will not write the current day in the output file

Output:
Code:

BROWSE - SORTOUT           STEP010  - Page  1     Line  1      Cols 1-80       
COMMAND ===>                                                SCROLL ===> CURSOR
******************************* Top of Data ***********************************
       2011-05-31-08.47.03                                                     
******************************* Bottom of Data ********************************
Back to top
View user's profile Send private message
sandhyaimmadi

New User


Joined: 18 Aug 2008
Posts: 50
Location: Bangalore

PostPosted: Mon Jun 06, 2011 11:00 am
Reply with quote

gylbharat,


I also ran ur code.
The computation is resulting in errors.
Also can you plz tell me the functionality of Date4

Thanks,
Sandhya
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jun 06, 2011 12:54 pm
Reply with quote

sandhyaimmadi wrote:
gylbharat,


I also ran ur code.
The computation is resulting in errors.
Also can you plz tell me the functionality of Date4

Thanks,
Sandhya


Hi Sandhya,

The &DATE4 current date constant provides an
additional format to display the current date in a record.

&DATE4 - C'yyyy-mm-dd-hh.mm.ss' Length of output = 19 bytes
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 06, 2011 2:40 pm
Reply with quote

Hello,

Quote:
The computation is resulting in errors.
Also can you plz tell me the functionality of Date4

Are you running Syncsort?

Which release?
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jun 06, 2011 2:54 pm
Reply with quote

Hi Dick,

Yes we are using SyncSort - SYNCSORT FOR Z/OS 1.3.2.0R
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 06, 2011 3:01 pm
Reply with quote

Hello,

Now, maybe Sandhya will post which release is used on their system. . . 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 SCOPE PENDING option -check data DB2 2
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Check data with Exception Table DB2 0
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top