IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare Months from Input file with Current Month


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Wed Aug 01, 2012 5:30 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 01, 2012 5:37 pm
Reply with quote

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
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Wed Aug 01, 2012 6:13 pm
Reply with quote

@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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 01, 2012 6:31 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Aug 01, 2012 10:12 pm
Reply with quote

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
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Thu Aug 02, 2012 12:29 am
Reply with quote

Thanks a lot SKOLUSU.....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top