View previous topic :: View next topic
Author
Message
sreeharithag New User Joined: 26 Apr 2010Posts: 9 Location: chennai
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
Garry Carroll Senior Member Joined: 08 May 2006Posts: 1193 Location: Dublin, Ireland
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
sreeharithag New User Joined: 26 Apr 2010Posts: 9 Location: chennai
Garry,
Can we define SYMNAMES as CUR_DAY,1,3???It didn't worked for me.
Thanks,
haritha
Back to top
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
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
sreeharithag New User Joined: 26 Apr 2010Posts: 9 Location: chennai
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
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
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
sandhyaimmadi New User Joined: 18 Aug 2008Posts: 50 Location: Bangalore
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
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
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
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
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
gylbharat Active Member Joined: 31 Jul 2009Posts: 565 Location: Bangalore
Hi Dick,
Yes we are using SyncSort - SYNCSORT FOR Z/OS 1.3.2.0R
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
Now, maybe Sandhya will post which release is used on their system. . .
Back to top
Please enable JavaScript!