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: 7992
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
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm
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


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