View previous topic :: View next topic |
Author |
Message |
mf_user Intermediate

Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Thu Aug 27, 2009 11:06 am Post subject: Current Date from a COBOL program. |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
mf_user Intermediate

Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Fri Aug 28, 2009 4:44 am Post subject: |
|
|
Oops.....
I have got hold of another method to generate date in CCYYMMDD format.
Code: |
ACCEPT W-DATE FROM DATE YYYYDDMM.
|
HTH.  _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
 |
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Fri Aug 28, 2009 6:34 am Post subject: |
|
|
mf_user wrote: | Oops.....
I have got hold of another method to generate date in CCYYMMDD format.
Code: |
ACCEPT W-DATE FROM DATE YYYYDDMM.
|
HTH.  |
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 |
|
 |
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Fri Aug 28, 2009 7:01 am Post subject: |
|
|
Never mind. It should be
Code: |
ACCEPT W-DATE FROM DATE YYYYMMDD.
|
|
|
Back to top |
|
 |
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Wed Sep 16, 2009 11:59 pm Post subject: |
|
|
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 |
|
 |
|
|