Joined: 29 Jun 2006 Posts: 1439 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-
Lrecl = 267
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)
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 *
* Convert ddmmyy in BI format to Z'ddmmyy'
* Convert Z'ddmmyy' to C'20yymm'
* Keep record if open date equals close date and
* 20yymm date equals yyyymm-1 date