|
View previous topic :: View next topic
|
| Author |
Message |
satish.ms10
Active User

Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi All,
I am trying to find the difference between two date fields. I am able to get the value but I am not able to exclude input records if any of the date is zeros.
I am using following sort card
| Code: |
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(10,8,CH,NE,C'00000000',AND,
18,8,CH,NE,C'00000000'),
BUILD=(18,8,Y4T,DATEDIFF,10,8,Y4T))
|
Below is the test data. I do not want to process 2nd and 5th record because any of the date field is zero.
| Code: |
----+----1----+----2----+
AJAKLFJJL2013010120130105
SDAFSDASL2013010100000000
CXVGSDFJL2013010120130105
ERYKLFJJL2013010120130105
UREYLFJJL0000000020130105
MHGGFJJJL2013010120130105
TYIRTFJJL2013010120130105
|
Can anyone help me in this regard.
Thanks,
Satish |
|
| Back to top |
|
 |
satish.ms10
Active User

Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi All,
Just to inform you that I am getting my desired output using below sort card.
| Code: |
SORT FIELDS=COPY
OUTFIL INCLUDE=(10,8,CH,NE,C'00000000',AND,
18,8,CH,NE,C'00000000'),
IFTHEN=(WHEN=INIT,
BUILD=(18,8,Y4T,DATEDIFF,10,8,Y4T))
|
Many thanks..!!
Thanks,
Satti |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Please explain your problem better
What is the expected output before I start guessing it wrong?
Please also show the expected output withing codetags |
|
| Back to top |
|
 |
satish.ms10
Active User

Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi Pandora,
Below is my input:
| Code: |
----+----1----+----2----+
AJAKLFJJL2013010120130105
SDAFSDASL2013010100000000
CXVGSDFJL2013010120130105
ERYKLFJJL2013010120130105
UREYLFJJL0000000020130105
MHGGFJJJL2013010120130105
TYIRTFJJL2013010120130105
|
Date1 starts at 10th position and is in CCYYMMDD format.
Date2 starts at 10th position and is in CCYYMMDD format.
I want to find the difference between Date2 and Date1 if the both the dates are not zeros.
Since Date2 is zero in second record I do not want to process. Also, 5th record since Date1 is zero.
So, my output file will contain 5 records
| Code: |
+0000004
+0000004
+0000004
+0000004
+0000004
|
Thanks!! |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thanks
I was too fast to reply and just saw you solved it yourself
Also ensure the it is always 00000000 and not any other value so your card might not work as expected |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
satish.ms10,
Here is a simplified version.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AJAKLFJJL2013010120130105
SDAFSDASL2013010100000000
CXVGSDFJL2013010120130105
ERYKLFJJL2013010120130105
UREYLFJJL0000000020130105
MHGGFJJJL2013010120130105
TYIRTFJJL2013010120130105
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OMIT COND=(10,8,UFF,EQ,0,OR,18,8,UFF,EQ,0)
INREC BUILD=(18,8,Y4T,DATEDIFF,10,8,Y4T)
//* |
|
|
| Back to top |
|
 |
satish.ms10
Active User

Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
| Thanks a lot Kolusu, |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|