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
 

 

check on current day of the Week

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: check on current day of the Week
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

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Jun 01, 2011 2:23 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: check on current day of the Week
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    Post subject: Re: check on current day of the Week
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

Site Director


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

PostPosted: Mon Jun 06, 2011 2:40 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Jun 06, 2011 3:01 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Syntax to check the first 4 digits of... kshirabdhi DFSORT/ICETOOL 10 Tue May 03, 2016 12:21 pm


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