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

Need to get the records which are LE to next year


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srinivas_cog

New User


Joined: 05 Jun 2008
Posts: 17
Location: chennai

PostPosted: Mon Aug 24, 2009 4:02 pm
Reply with quote

Hi,

I need to get all the records which are having the date less than or equal to next year's date.

Suppose if the job is running in 2010 then need to get all the records which are having the date lessthan or equal to 2012.

Input : file length : 180; date starts in 10th postion (20090824)

Please let me know if you have any ideas.

Thanks,
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Aug 24, 2009 4:07 pm
Reply with quote

Hi,

if it runs in 2010, would it not be LE 2011 ? or LT 2012 ?


Gerry
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Mon Aug 24, 2009 4:23 pm
Reply with quote

you can pass the current date using symname extract the year there are some format by which you can get the current year, just compare it with the date field present in your file,

I also agree with Gerry if you add want rec which has date less then next year then in above date will be less than 2011 and not 2012
Back to top
View user's profile Send private message
srinivas_cog

New User


Joined: 05 Jun 2008
Posts: 17
Location: chennai

PostPosted: Mon Aug 24, 2009 4:26 pm
Reply with quote

Hi Gerry,

I am sorry . it should be 2011 not 2012.

It should be LE to 2011

Thanks,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 24, 2009 8:33 pm
Reply with quote

Hello,

Quote:
Please let me know if you have any ideas.
Which sort product is used on the system?

Are either Easytrieve or FileAid available?
Back to top
View user's profile Send private message
srinivas_cog

New User


Joined: 05 Jun 2008
Posts: 17
Location: chennai

PostPosted: Tue Aug 25, 2009 9:57 am
Reply with quote

Hi Dick,

I am using SYNCSORT. Yes i can use fileaid also but not Easytrieve.

Thanks,
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Aug 25, 2009 10:09 am
Reply with quote

Hi,

try this
Code:
//*                                                                   
//S1       EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
001                                                                   
/*                                                                     
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)       
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  OPTION COPY                                                         
* CREATE SYMBOL AS FOLLOWS:                                           
* YEAR,'YYYY'                                                         
* WHERE YYYY IS CURRENT YEAR + 1 (ADD 1 )                             
  INREC OVERLAY=(21:DATE2,                                             
    1:C'YEAR,''',21,4,ZD,ADD,+1,EDIT=(TTTT),C'''',21:60X)             
/*                                                                     
//S2       EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                     
//SORTIN   DD DSN=INPUT FILE                               
//SORTOUT  DD DSN=OUTPUT FILE                             
//SYSIN    DD *                                           
  OPTION COPY                                             
  INCLUDE COND=(10,4,CH,LE,YEAR)                           



Gerry
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 25, 2009 11:32 am
Reply with quote

srinivas_cog,

The same can be achieved in a single step like this.
Code:
//STEP1    EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN= Input file  (FB/180)                     
//SORTOUT  DD DSN= Output file (FB/180)                     
//SYSIN    DD *                                             
  INREC OVERLAY=(181:&DATE2,187:181,4,ZD,ADD,+1,M11,LENGTH=4)
  SORT FIELDS=COPY                                           
  OUTFIL INCLUDE=(10,4,ZD,LE,187,4,ZD),BUILD=(1,180)         
Back to top
View user's profile Send private message
srinivas_cog

New User


Joined: 05 Jun 2008
Posts: 17
Location: chennai

PostPosted: Tue Aug 25, 2009 11:59 am
Reply with quote

Thanks Gerry and Arun. Given solutions are working fine.

I used the below card

OPTION COPY
INCLUDE COND=(1,4,CH,LE,&DATE2+12)

I tested this also .. working fine.

Thanks,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 25, 2009 7:18 pm
Reply with quote

Good to hear it is working - thanks for letting us know icon_smile.gif

d
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top