View previous topic :: View next topic
|
Author |
Message |
srinivas_cog
New User
Joined: 05 Jun 2008 Posts: 17 Location: chennai
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
if it runs in 2010, would it not be LE 2011 ? or LT 2012 ?
Gerry |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
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 |
|
|
srinivas_cog
New User
Joined: 05 Jun 2008 Posts: 17 Location: chennai
|
|
|
|
Hi Gerry,
I am sorry . it should be 2011 not 2012.
It should be LE to 2011
Thanks, |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
srinivas_cog
New User
Joined: 05 Jun 2008 Posts: 17 Location: chennai
|
|
|
|
Hi Dick,
I am using SYNCSORT. Yes i can use fileaid also but not Easytrieve.
Thanks, |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
srinivas_cog
New User
Joined: 05 Jun 2008 Posts: 17 Location: chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thanks for letting us know
d |
|
Back to top |
|
|
|