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
 

 

Subtract birthdate in input file from current date !

 
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: Thu Aug 02, 2012 4:39 pm    Post subject: Subtract birthdate in input file from current date !
Reply with quote

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

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 4:43 pm    Post subject:
Reply with quote

i almost bothered to look it up for you
(the link that SKOLUSU provided,
http://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
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Thu Aug 02, 2012 4:44 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 4:48 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Aug 02, 2012 4:49 pm    Post subject:
Reply with quote

techslam, you recognize that the only birth dates qualifying would be in the Julian calendar, a/k/a "Old Style", yes?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 4:50 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Aug 02, 2012 4:56 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Aug 02, 2012 5:00 pm    Post subject: Reply to: Subtract birthdate in input file from current date
Reply with quote

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 icon_cool.gif
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 5:14 pm    Post subject: @enrico-sorichetti
Reply with quote

I Apologies for this duplicate topics.

Let the dicussion continue here and other two topics can be locked
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 5:33 pm    Post subject:
Reply with quote

we are waiting on you
Aslam
to provide an reasonable requirement.

as of yet, you have not.
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 5:41 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 5:49 pm    Post subject:
Reply with quote

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

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Thu Aug 02, 2012 6:04 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7231

PostPosted: Thu Aug 02, 2012 6:11 pm    Post subject: Reply to: Subtract birthdate in input file from current date
Reply with quote

SYMNAMES not SYSNAMES
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 6:14 pm    Post subject: Re: Reply to: Subtract birthdate in input file from current
Reply with quote

Bill Woodger wrote:
SYMNAMES not SYSNAMES


my fault, I should have looked it up.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Aug 02, 2012 7:12 pm    Post subject:
Reply with quote

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

Senior Member


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

PostPosted: Thu Aug 02, 2012 9:49 pm    Post subject: Reply to: Subtract birthdate in input file from current date
Reply with quote

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
Code:

13000601 RECORD1


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

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Mon Aug 06, 2012 3:25 pm    Post subject:
Reply with quote

Thanks Skolusu and everyone.
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
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 15 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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