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
 

 

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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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