View previous topic :: View next topic
|
Author |
Message |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Hi,
This is my input file with LRECL=80
Code: |
RECORD1 2010-05-01
RECORD2 2010-08-01
RECORD3 2011-03-01
RECORD4 2011-08-01
RECORD5 2010-09-01
RECORD6 2010-12-01
|
I want to compare the Month(MM) in each record with Current-Month and write only those records whose month is equal to current month.
Current month is August, ie, 08
So my expected output will be
Code: |
RECORD2 2010-08-01
RECORD4 2011-08-01
|
Please gudie me ! Thanks |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What is your source of "Current-Month"? Hopefully a file with business date/data date?
There are examples here using the generation of SYMNAMEs. Also works if you need "run date", but then you have to consider midnight, and re-runs and things. |
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
@Bill
Current Date would be the run date of the job, I know of DATE1(4MD-) funtion, but have no idea how to apply in this particular requirement. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Look at the manual for "Using Symbols for Fields and Constants", concentrate on the system symbols (which you specify as s' or S') and you should find how you can specify a constant for your month and then use that to compare against your data in INCLUDE/OMIT. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
use the following DFSORT JCL
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
MNUM,S'&LMON'
//SORTIN DD *
RECORD1 2010-05-01
RECORD2 2010-08-01
RECORD3 2011-03-01
RECORD4 2011-08-01
RECORD5 2010-09-01
RECORD6 2010-12-01
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(14,2,CH,EQ,MNUM)
SORT FIELDS=COPY
//* |
|
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Thanks a lot SKOLUSU..... |
|
Back to top |
|
|
|