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
 

 

Help Required in DATE Function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ashokakash

New User


Joined: 15 Nov 2006
Posts: 18
Location: Chennai

PostPosted: Tue Nov 20, 2007 4:00 am    Post subject: Help Required in DATE Function
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    Post subject:
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

Site Director


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

PostPosted: Tue Nov 20, 2007 8:43 am    Post subject:
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    Post subject:
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: 7936
Location: Bellevue, IA

PostPosted: Thu Aug 21, 2008 4:39 pm    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


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