View previous topic :: View next topic
|
Author |
Message |
dudenithy
New User
Joined: 02 Mar 2012 Posts: 48 Location: India
|
|
|
|
Hello All,
I have an input file with date in packed decimal format in YYYYNNN (julian) format. I need to extract the records only when the year is equal to current year. Assume i have an input like below,
Code: |
2013184 0 400.00
2013226 0 53.58
2012261 0 11.11
2012293 0 127.43
2012263 0 29.70 |
Now i should get output only below.
Code: |
2013184 0 400.00
2013226 0 53.58 |
It should be done for every year, I have seen so far only the date comparison using DATE function which includes month and day, but i need to filter only based on year. It would be better if someone could provide the suggestion. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Create SYMNAMES that have the previous and next year.
Compare the input year to be sure it is between the 2 calculated years. |
|
Back to top |
|
|
dudenithy
New User
Joined: 02 Mar 2012 Posts: 48 Location: India
|
|
|
|
Hi Dick, thanks for the reply, could you explain in detail.. if possible., |
|
Back to top |
|
|
dudenithy
New User
Joined: 02 Mar 2012 Posts: 48 Location: India
|
|
|
|
dudenithy wrote: |
Hi Dick, thanks for the reply, could you explain in detail.. if possible., |
Dick, I understood now took in a other way and confused |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
So, it is now working for you?
If you post your solution, it will help someone with a similar question some day. |
|
Back to top |
|
|
dudenithy
New User
Joined: 02 Mar 2012 Posts: 48 Location: India
|
|
|
|
No, i haven't done yet, ve to go back office tomorrow and then try it.. but as the logic was clear, it should work !! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Ok, we'll be interested to hear it went well
d |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Hi Dick,
Not sure why you wanted two years in symnames but I tried the below code
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
CCYY,S'&YR4'
//SORTIN DD *
2013184 0 400.00
2013226 0 53.58
2012261 0 11.11
2012293 0 127.43
2012263 0 29.70
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,4,CH,EQ,CCYY) |
Output
Code: |
********************************* TOP OF DATA **********************************
2013184 0 400.00
2013226 0 53.58
******************************** BOTTOM OF DATA ******************************** |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK, and now the packed-decimal part. It can be done without data manipulation.
Also document as not working if the step is run in the "wrong" year. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Not sure why you wanted two years in symnames |
I used 2 years so that when the requirement is for more than one year, there is little/no change to accommodate this.
Code: |
INCLUDE COND=(1,4,CH,EQ,CCYY) |
Probably not as the data is packed-decimal . . . |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
dick scherrer wrote: |
Hello,
Quote: |
Not sure why you wanted two years in symnames |
I used 2 years so that when the requirement is for more than one year, there is little/no change to accommodate this.
Code: |
INCLUDE COND=(1,4,CH,EQ,CCYY) |
Probably not as the data is packed-decimal . . . |
Got it..Thanks |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
use the following control cards. I assumed that your input has RECFM=FB and LRECL=80
Code: |
//SYMNAMES DD *
CURRYR,S'&LYR4'
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:19,4,Y4U)
OUTFIL BUILD=(1,80),INCLUDE=(81,4,CH,EQ,CURRYR)
//* |
|
|
Back to top |
|
|
|