IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Files to extract INCLUDE only based on YEAR


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dudenithy

New User


Joined: 02 Mar 2012
Posts: 48
Location: India

PostPosted: Tue Nov 26, 2013 8:09 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 26, 2013 8:36 pm
Reply with quote

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
View user's profile Send private message
dudenithy

New User


Joined: 02 Mar 2012
Posts: 48
Location: India

PostPosted: Tue Nov 26, 2013 8:39 pm
Reply with quote

Hi Dick, thanks for the reply, could you explain in detail.. if possible.,
Back to top
View user's profile Send private message
dudenithy

New User


Joined: 02 Mar 2012
Posts: 48
Location: India

PostPosted: Tue Nov 26, 2013 8:53 pm
Reply with quote

dudenithy wrote:
Hi Dick, thanks for the reply, could you explain in detail.. if possible.,


Dick, I understood now icon_smile.gif took in a other way and confused icon_redface.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 26, 2013 9:03 pm
Reply with quote

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
View user's profile Send private message
dudenithy

New User


Joined: 02 Mar 2012
Posts: 48
Location: India

PostPosted: Tue Nov 26, 2013 9:16 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 26, 2013 9:23 pm
Reply with quote

Ok, we'll be interested to hear it went well icon_cool.gif

d
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Nov 27, 2013 11:49 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 27, 2013 12:55 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 27, 2013 7:47 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Nov 27, 2013 8:39 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Nov 28, 2013 12:35 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top