MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Current Date from a COBOL program.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Aug 27, 2009 11:06 am    Post subject: Current Date from a COBOL program. Reply with quote

I am using below code to get current date from system date and displaying it:

Code:

PROCEDURE DIVISION.
01-PARA.           
    ACCEPT W-DATE FROM DATE.       
    DISPLAY 'FULL: ' W-DATE.
    STOP RUN.


It is displaying the date as "090827" but I am looking to get "20090807". How to get it? Please help.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Aug 27, 2009 1:49 pm    Post subject: Reply with quote

mf_user,

please search before posting. check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=1089&highlight=function+currentdate
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Fri Aug 28, 2009 4:44 am    Post subject: Reply with quote

Oops..... Embarassed

I have got hold of another method to generate date in CCYYMMDD format.

Code:

ACCEPT W-DATE FROM DATE YYYYDDMM.


HTH. Very Happy
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Fri Aug 28, 2009 6:34 am    Post subject: Reply with quote

mf_user wrote:
Oops..... Embarassed

I have got hold of another method to generate date in CCYYMMDD format.

Code:

ACCEPT W-DATE FROM DATE YYYYDDMM.


HTH. Very Happy


I tried this in IBM Enterprise COBOL for z/OS 4.1.0 and got a compiler error. Which COBOL version you use ?
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Fri Aug 28, 2009 7:01 am    Post subject: Reply with quote

Never mind. It should be
Code:

ACCEPT W-DATE FROM DATE YYYYMMDD.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Wed Sep 16, 2009 11:59 pm    Post subject: Reply with quote

Just for my .02$...

DATE: Has the implicit PICTURE 9(6). The sequence of data elements (from left to right) is:
  • 2 digits for the year
  • 2 digits for the month
  • 2 digits for the day
Thus, 17 September 2009 is expressed as: 090917.

DATE YYYYMMDD: Has the implicit PICTURE 9(8 ). The sequence of data elements (from left to right) is:
  • 4 digits for the year
  • 2 digits for the month
  • 2 digits for the day
Thus, 17 September 2009 is expressed as: 20090917.
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group