Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compare Months from Input file with Current Month

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Compare Months from Input file with Current Month
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Aug 01, 2012 5:37 pm    Post subject: Reply to: Compare Months from Input file with Current Month
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Aug 01, 2012 6:31 pm    Post subject: Reply to: Compare Months from Input file with Current Month
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts Reg:Displaying the particular month o... bhavana yalavarthi All Other Mainframe Topics 4 Sat Jul 08, 2017 8:13 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us