Posted: Tue Aug 16, 2005 2:41 pm Post subject: Retrieve specific records from VSAM(KSDS) dynamically
Hallo Friends,
I have VSAM(KSDS) file with key starting from 1 to 16, out of which starting 6 bytes gives the year(YYYY format) and month(MM format). I need to get the last 4 months records i.e., from 200504 - 200507. Can I do using some utilities(Idcams/sort/any) ?. I have tried it with Easytrieve but I need alternatives to compare the efficiency. Its a monthly job so the key should be dynamic.
For ex:-
For August : I need records starting with 200504 and ending with 200507
For Septemeber: I need records starting with 200505 and ending with 200508
and so on....
I tried to search for this specifc problem but couldn't find the right one..
Hi Friends,
I am continuing with the above post.
I believe we can do something like FROMKEY(200504*) - TOKEY(200507*).
But can I do something to change these pararmeter dynamically for everymonth in IDCAMS.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Aug 16, 2005 5:07 pm Post subject:
Lal,
Try this untested JCL. I just wrote the date logic on a piece of paper. see if I missed any criteria. The first step creates a dynamic include step as follows which will be used in the next step to filter the records.
Code:
SORT FIELDS=COPY
INCLUDE COND=(1,6,ZD,GE,200504,AND,1,6,ZD,LT,200508)
The trick part is to subtract the year in case of the months jan, feb, mar and apr. For those months you subtract 92 from the year and month portion so as to pick the last year date with 4 months subtracted. For the rest of the months it is simply subtracting 4 from the month portion.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Apr 21, 2006 6:20 pm Post subject:
With z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006), you can now do this using relative dates as follows:
Code:
OPTION COPY
INCLUDE COND=(1,6,ZD,GE,DATE2P-4,AND,1,6,ZD,LT,DATE2P)
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum