Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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

Senior Member


Joined: 08 May 2006
Posts: 1002
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 Comparision with current time arunsoods DFSORT/ICETOOL 5 Thu Nov 09, 2017 10:37 am
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us