View previous topic :: View next topic
|
Author |
Message |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Hello,
My Input file has date of births [LRECL=80]
Code: |
RECORD1 1985-09-10
RECORD2 1975-09-10
RECORD3 1965-09-10
RECORD4 1955-09-10
RECORD5 1945-09-10
|
I need to subtract the birthdate in file from CURRENT DATE and check if the Difference is greater than value 00179999, and write only those record for which this condition is true. Can this be done using DATEDIFF funtion of DFSORT ?
Please guide me. Thanks |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
i almost bothered to look it up for you
(the link that SKOLUSU provided,
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
in the other thread that you originally posted this question,
and in the new thread that Bill created,
well, my post count is up, anyway!),
but then I divided 00179999 by 365 and that was about 494 years
so you did not mean days, apparently.
WTH does 00179999 represent? |
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
@dbzTHEdinosauer
DATEDIFF function does give us the difference in number of days, so this difference has to be greater than 00179999 , only then that particular record can be written to output file |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
FM,
00179999 days divided by 365 is approx 494 years.
current date 2012 - 494 years = approx 1518.
got any birthdates in that area on file????? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
techslam, you recognize that the only birth dates qualifying would be in the Julian calendar, a/k/a "Old Style", yes? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Akatsukami wrote: |
techslam, you recognize that the only birth dates qualifying would be in the Julian calendar, a/k/a "Old Style", yes? |
good point, completely forgot about that,
may have to revise my question.. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
dbzTHEdinosauer wrote: |
Akatsukami wrote: |
techslam, you recognize that the only birth dates qualifying would be in the Julian calendar, a/k/a "Old Style", yes? |
good point, completely forgot about that,
may have to revise my question.. |
IIRC, the current difference between the Julian and Gregorian calendars is only 14 days, not nearly enough to make whatever techslam is trying to do reasonable. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the TS has THREE topics on the same rubbish,
unless he comes up quickly with a clear description of the requirement
and a clear indication of where he wants the discussion continued
all the topics will be locked and deleted after a while |
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
I Apologies for this duplicate topics.
Let the dicussion continue here and other two topics can be locked |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
we are waiting on you
Aslam
to provide an reasonable requirement.
as of yet, you have not. |
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Hi All,
I have kind of implemented this rquirement using ICETOOL. The code is below :-
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
13000601 RECORD1
19820401 RECORD2
19750201 RECORD3
19790501 RECORD4
19730701 RECORD5
19800501 RECORD6
19870101 RECORD7
19600801 RECORD8
//OUT1 DD DSN=TEST.ASLAM.ME.OUT1,DISP=(NEW,CATLG,DELETE)
//OUT2 DD DSN=TEST.ASLAM.ME.OUT2,DISP=(NEW,CATLG,DELETE)
//OUT3 DD DSN=TESTN.ASLAM.ME.OUT3,DISP=(NEW,CATLG,DELETE)
//TOOLIN DD *
COPY FROM(IN) TO(OUT1) USING(CTL1)
COPY FROM(OUT1) TO(OUT2) USING(CTL2)
COPY FROM(OUT2) TO(OUT3) USING(CTL3)
/*
//CTL1CNTL DD *
SORT FIELDS=COPY
OUTREC OVERLAY(50:DATE1)
/*
//CTL2CNTL DD *
SORT FIELDS=COPY
INREC OVERLAY(50:50,8,Y4T,DATEDIFF,1,8,Y4T)
/*
//CTL3CNTL DD *
SORT FIELDS=COPY
INCLUDE COND=(51,7,ZD,GT,00179999)
/*
|
The DOB in first record is a dummy date 13000601, just to make sure there is some output based on the final condition.
I know the above code can be written in a far better way. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Use SORT not ICETOOL
put DATE1 in SYSNAMES
in INREC do your overlay (use the SYSNAMES name)
in OUTREC do you INCLUDE
one output file. |
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
I tried below code -->
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSNAMES DD *
TDATE,DATE1
//SORTIN DD *
13000601 RECORD1
19820401 RECORD2
19750201 RECORD3
19790501 RECORD4
19730701 RECORD5
19800501 RECORD6
19870101 RECORD7
19600801 RECORD8
//SORTOUT DD DSN=TESTAEN.ASLAM.ME.OUT1,DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY(50:TDATE,Y4T,DATEDIFF,1,8,Y4T)
INCLUDE COND=(51,7,ZD,GT,00179999)
/*
|
Giving below error -->
Code: |
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 -
SORT FIELDS=COPY
INREC OVERLAY(50:TDATE,Y4T,DATEDIFF,1,8,Y4T)
$
ICE006A 0 OPERAND DEFINER ERROR
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
SYMNAMES not SYSNAMES |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Bill Woodger wrote: |
SYMNAMES not SYSNAMES |
my fault, I should have looked it up. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
check if the Difference is greater than value 00179999 |
I suspect there is a misunderstanding in the number of days difference . . .
This may be supposed to select people over 18 years old (but 179999 is NOT the number of days. . .).
Possibly there will be a bit of clarification posted. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
techslam,
You don't need 3 passes of data to get the desired results. Here is a DFSORT JCL which will give you the desired results.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
13000601 RECORD1
19820401 RECORD2
19750201 RECORD3
19790501 RECORD4
19730701 RECORD5
19800501 RECORD6
19870101 RECORD7
19600801 RECORD8
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY(81:DATE1,X,81,8,Y4T,DATEDIFF,1,8,Y4T)
OUTFIL BUILD=(1,80),INCLUDE=(90,8,SFF,GT,179999)
//* |
The output from this is
If your intention is to pick 18 years and older then you don't need Datediff function you can just subtract 18 years from the current date and use that date to compare your input dates.
Code: |
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20010601 RECORD1
19820401 RECORD2
19750201 RECORD3
19790501 RECORD4
19730701 RECORD5
19800501 RECORD6
19870101 RECORD7
19600801 RECORD8
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY(81:DATE1,X,81,8,Y4T,SUBYEARS,+18,TOGREG=Y4T)
OUTFIL BUILD=(1,80),INCLUDE=(1,8,ZD,LT,90,8,ZD)
//* |
The output from this job is
Code: |
19820401 RECORD2
19750201 RECORD3
19790501 RECORD4
19730701 RECORD5
19800501 RECORD6
19870101 RECORD7
19600801 RECORD8
|
|
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Thanks Skolusu and everyone. |
|
Back to top |
|
|
|