Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
Im coding a new job for extracting the records and the job run is not scheduled yet.
But its been decided that the job has to go as a monthly job. Assuming the run is on 1st of every month (mostly this is going to happen), the job has to extract all the records whose date fall in the previous month.
Ex: If the job runs on 1 Jan 2007, the final file should have records between 01 Dec 2006 to 31 Dec 2006.
Note: Since the job run is not deceided yet, I had given example of 18 Jan 2007 in my previous post.
I had tried the following for converting DDMMYY to YYMMDD-
Code:
Lrecl = 267
Recfm=FB
Key -
BATC-BATC-KEY PIC X(14) @ col 9
Date Variables -
BATC-DATE-OPENED PIC 9(06) COMP (starts at 61 col)
BATC-DATE-CLOSED PIC 9(06) COMP (starts at 65 col)
** convert dates from BI to ZD format
INREC FIELDS=(1,60,
61,4,BI,TO=ZD,LENGTH=6, * BATC-DATE-OPENED
65,4,BI,TO=ZD,LENGTH=6, * BATC-DATE-CLOSED
69,199)
SORT FIELDS=COPY
OUTREC FIELDS=(1,60,
65,2, ** YY COMES FIRST FOR BATC-DATE-OPENED
63,2, ** MM FOLLOWS
61,2, ** DD
71,2, ** YY COMES FIRST FOR BATC-DATE-CLOSED
69,2, ** MM FOLLOWS
67,2, ** DD
69,199)
/*
Kindly let me know, is there a way to extract the data for a month (considering all the options explained above)?
write a rexx routine to change the date and submit the member. and also write an jcl to kick off the rexx program. and schedule the same jcl according to ur requirment.
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
If there is ever a chance that this job will be run on the the 30th or 31st of a month (some kind of scheduling exception), this will need to be accounted for when determining which data to use.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Murali,
If I understand correctly what you want, it seems like you're overcomplicating it. It seems you want to keep the records from the previous month that have the same open and close date. You can compare the binary fields directly to determine if the open and close date are the same. You can check for the previous month by comparing the yymm portion of the date to yymm-1. Here's a DFSORT job that does that.
If you really want to check for the previous 30 days rather than the previous month, let me know and I can show you how to modify the job to do that.
You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DATE2-1. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/267)
//SORTOUT DD DSN=... output file (FB/267)
//SYSIN DD *
OPTION COPY
* Convert ddmmyy in BI format to Z'ddmmyy'
INREC OVERLAY=(268:61,4,BI,TO=ZD,LENGTH=6,
274:65,4,BI,TO=ZD,LENGTH=6,
* Convert Z'ddmmyy' to C'20yymm'
280:C'20',272,2,270,2)
* Keep record if open date equals close date and
* 20yymm date equals yyyymm-1 date
OUTFIL INCLUDE=(61,4,BI,EQ,65,4,BI,AND,
280,6,CH,EQ,DATE2-1),
BUILD=(1,267)
/*