View previous topic :: View next topic
|
Author |
Message |
Piyari
New User
Joined: 19 Nov 2007 Posts: 4 Location: India
|
|
|
|
Hi,
I have a requirement to see if a particular date falls within 3 years from the current date.
My input date is in CYYMMDD format. (eg, 3031201). We need to check if this date falls within 3 years from the Current date.
Pls share your thoughts on how best this could be accompolished.
Our installation uses VS COBOL II. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Piyari,
Quote: |
My input date is in CYYMMDD format. (eg, 3031201). |
Generally the value of 'C' is taken either 0 (for 19XX years) or 1 (for 20XX).
How did you get 3? |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Piyari,
Welcome to the forums.
Quote: |
Pls share your thoughts on how best this could be accompolished.
|
It can be done using SORT. Also search the DFSORT forum for similar topics. . Try this JCL and change the same as per your requirement.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(21:DATE1,
1:C'YEAR,''',23,2,ZD,SUB,+3,EDIT=(TT),25,4,C'''',21:60X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *
1031115
1051119
1061119
1071119
1031115
1041119
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(2,6,CH,GE,YEAR)
/*
|
output:
Code: |
1051119
1061119
1071119
1041119
|
|
|
Back to top |
|
|
Piyari
New User
Joined: 19 Nov 2007 Posts: 4 Location: India
|
|
|
|
Murali,
Answering your question, our programs have been coded in a such a way that '2' corresponds to 19XX years & ' 3' corresponds to 20XX years.
Aaru,
Thanks for your suggestion. I accompolished it with cobol logic itself.
First i converted the input date to YYYYMMDD format.
Then i subtracted 3 years from the Current date and checked if input date was greater than that.
Since the number of input records in the input file is not huge,this should do the trick for me! |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Piyari,
Good you got your req.
Also its very pleasing to know, you dint forget to reply back and following the post even after a week. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Piyari,
I don't know the full reqs of your problem, but did you account for leap year? |
|
Back to top |
|
|
|