How to filter out the data by date using DFSORT
I have a flat file with some useful data along with timestamp
on each record. Inorder to create a report, I need data of last month ONLY for my further analysis. With out using a cobol source code, REXX EXECs I need to filter out last month's data using DFSORT. Hope my question is clear.
Note: I use JOBTRAC scheduler. Using JOBTRAC parameters, I can dynamically allocate values and filter out data, but dont want to make use of them.
Here is a possible answer:
//STEP01 EXEC PGM=SORT,REGION=0M
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.DATASET,DISP=SHR
//SORTOUT DD DSN=OUTPUT.DATASET,DISP=NEW
//SYSIN DD *
INCLUDE COND=(001,007,EQ,DATE2(-)-1)
/*
I have assumed the following things:
- The timestamp starts at position one
- The timestamp is an alphanumeric
- The timestamp starts with YYYY-MM-DD
- "Last month" is the month previous to the current one
精彩评论