Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Question on Date Manipulation in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Piyari

New User


Joined: 19 Nov 2007
Posts: 4
Location: India

PostPosted: Mon Nov 19, 2007 11:43 am    Post subject: Question on Date Manipulation in cobol
Reply with quote

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

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Mon Nov 19, 2007 11:56 am    Post subject:
Reply with quote

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

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Mon Nov 19, 2007 12:40 pm    Post subject: Reply to: Question on Date Manipulation in cobol
Reply with quote

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

New User


Joined: 19 Nov 2007
Posts: 4
Location: India

PostPosted: Fri Nov 23, 2007 12:55 pm    Post subject: Reply to: Question on Date Manipulation in cobol
Reply with quote

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

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 12:59 pm    Post subject:
Reply with quote

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

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Nov 27, 2007 11:41 pm    Post subject:
Reply with quote

Hi Piyari,


I don't know the full reqs of your problem, but did you account for leap year?
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us