IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help Required in DATE Function


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ashokakash

New User


Joined: 15 Nov 2006
Posts: 21
Location: Chennai

PostPosted: Tue Nov 20, 2007 4:00 am
Reply with quote

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

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue Nov 20, 2007 4:51 am
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 20, 2007 8:43 am
Reply with quote

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

New User


Joined: 27 May 2008
Posts: 12
Location: Bangalore

PostPosted: Thu Aug 21, 2008 12:10 pm
Reply with quote

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

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 21, 2008 4:39 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
Search our Forums:

Back to Top