View previous topic :: View next topic
Author
Message
srajendran2 New User Joined: 13 May 2008Posts: 56 Location: Chennai
Hi,
I have a requirement to check if the header date is equivalent to current date. if it is not the rest of the processing should be skipped. The header date format is MM/DD/YYYY. I tried to use the format MD4/ in INCLUDE COND, but it did not work.
Back to top
Akatsukami Global Moderator Joined: 03 Oct 2009Posts: 1787 Location: Bloomington, IL
How did it not work?
Back to top
srajendran2 New User Joined: 13 May 2008Posts: 56 Location: Chennai
There is an error in the syntax. I think i have wrongly used the MD4 condition in the INCLUDE COND. PLease find below the code and error.
Code:
SORT FIELDS=COPY
INCLUDE COND=(1,10,CH,EQ,DT=(MD4/))
Code:
SYSIN :
SORT FIELDS=COPY
INCLUDE COND=(1,10,CH,EQ,DT=(MD4/))
*
WER268A INCLUDE STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
Please paste your code and input and also let us know your sort product
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
1.DT should be DATE
2.Please check if SYNCSORT supports DATE=(MD4/)
3.Syncosrt queries should be asked in JCL forum
4.Even if syncsort support ,to make it work you first need to overlay then try to filter that using include
Back to top
srajendran2 New User Joined: 13 May 2008Posts: 56 Location: Chennai
The product is
SYNCSORT FOR Z/OS 1.3.2.1R
jcl is
Code:
//*
//SORT EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=TSTH.AAAAAA.REXX.INPUT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=TSTH.DFSORT.OUTP,
// DISP=(NEW,CATLG),
// UNIT=SYSDA,
// SPACE=(CYL,(400,400),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,10,CH,EQ,DATE=(MD4/))
/*
Input is
05/31/2013
05/31/2013,BBBB,1,0.000000000,
05/31/2013,CCCC,3,0.000000000,
05/31/2013,DDDD,1,0.000000000,
05/31/2013,AAAA,4,0.000000000,
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
and the expected output is?
Back to top
srajendran2 New User Joined: 13 May 2008Posts: 56 Location: Chennai
i expect the header record to be copied to the output file if the current date is equal to header date (MM/DD/YYYY)
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
You expect to copy only the header record or even the detail records when the header record date is equal to current date?
Back to top
srajendran2 New User Joined: 13 May 2008Posts: 56 Location: Chennai
Just the header
Back to top
Pandora-Box Global Moderator Joined: 07 Sep 2006Posts: 1592 Location: Andromeda Galaxy
Quote:
4.Even if syncsort support ,to make it work you first need to overlay then try to filter that using include
Back to top
bodatrinadh Active User Joined: 05 Jan 2007Posts: 101 Location: chennai (India)
Hi Rajendran,
Try this code...
Assuming LRECL=80 and RECFM=FB.
Code:
//STEP1 EXEC PGM=SORT
//SORTIN DD *
06/19/2013
06/19/2013,BBBB,1,0.000000000,
06/19/2013,CCCC,3,0.000000000,
06/19/2013,DDDD,1,0.000000000,
06/19/2013,AAAA,4,0.000000000
//SORTOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD)),
IFTHEN=(WHEN=(81,04,ZD,EQ,+1),OVERLAY=(51:7,4,1,2,4,2))
SORT FIELDS=COPY
OUTFIL OUTREC=(1,10,72X),INCLUDE=(51,08,CH,EQ,&DATE1)
Output -
Thanks
-3nadh
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
srajendran2,
Since you just need to validate just the first record alone, you may skip the rest of the records and check the first record as below.
Code:
//SYSIN DD *
OPTION COPY,STOPAFT=1
INREC OVERLAY=(81:1,2,4,2,9,2)
OUTFIL INCLUDE=(81,6,Y2W,EQ,Y'DATE1'),BUILD=(1,80)
/*
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi,
you may also want to set a different return code if there are no matches
Code:
//FILEOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,STOPAFT=1
INREC OVERLAY=(81:1,2,4,2,9,2)
OUTFIL FNAMES=FILEOUT,INCLUDE=(81,6,Y2W,EQ,Y'DATE1'),
BUILD=(1,80),NULLOFL=RC4
Gerry
Back to top
Please enable JavaScript!