View previous topic :: View next topic
|
Author |
Message |
ashokakash
New User
Joined: 15 Nov 2006 Posts: 21 Location: Chennai
|
|
|
|
When I get system date using DATE function it returns the below
ACCEPT WS-SYS-DATE FROM DATE
WS-SYS-DATE = 00071119
Can any one explain why that returns 0007 instead of 2007?
Also will this be enough to add 2 to the high order byte? I believe till year 8000 addition of 2 to the high order byte will not cause any problem. Please correct me if I am wrong |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
I tried ACCEPT WS-SYS-DATE FROM DATE and I got 071119.
We use MOVE FUNCTION CURRENT-DATE TO PDATE-PTIME and we get 2007111917103128-060 the full date, time, and GMT-offset. CCYYMMDDHHMMSSHH-GMT This might be a better option than adding 2. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
ACCEPT WS-SYS-DATE FROM DATE
WS-SYS-DATE = 00071119 |
If this is what happened on your system, there is most likely an error in the code.
ACCEPT FROM DATE returns the proper value. |
|
Back to top |
|
|
PriyaSubramanian
New User
Joined: 27 May 2008 Posts: 12 Location: Bangalore
|
|
|
|
Douglas Wilder wrote: |
I tried ACCEPT WS-SYS-DATE FROM DATE and I got 071119.
We use MOVE FUNCTION CURRENT-DATE TO PDATE-PTIME and we get 2007111917103128-060 the full date, time, and GMT-offset. CCYYMMDDHHMMSSHH-GMT This might be a better option than adding 2. |
MOVE FUNCTION CURRENT-DATE (1:14) TO WS-DATE
is giving error in compilation. the error is 'FUNCTION" was not defined as a data-name'.
Can anyone tell me why this happens? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
From the LR manual section 6.2.1.3:
Quote: |
DATE
Has the implicit PICTURE 9(6). If the DATEPROC compiler option is in effect, then the returned value has implicit DATE FORMAT YYXXXX, and identifier-2 must be defined with this date format.
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, 27 April 1995 is expressed as: 950427
DATE YYYYMMDD
Has the implicit PICTURE 9(8). If the DATEPROC compiler option is in effect, then the returned value has implicit DATE FORMAT YYYYXXXX, and identifier-2 must be defined with this date format.
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, 27 April 1995 is expressed as: 19950427 |
Since you said to accept from DATE, you got the 6-digit value without the century -- exactly what you asked for. |
|
Back to top |
|
|
|