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

Truncated System Date


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

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Wed Mar 26, 2008 10:11 am
Reply with quote

Hi All,

I am using the piece of Code

Code:
ACCEPT WS-DATE FROM DATE.

I have declared the WS-DATE variable as CCYYMMDD. But the date provided by the system is YYMMDD.

Can we get the year as CCYY by any means?
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Wed Mar 26, 2008 10:28 am
Reply with quote

One way is to move some variable e.g., "20" in CC field of WS-DATE for 21st Century.
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Wed Mar 26, 2008 11:05 am
Reply with quote

Use FUNCTION CURRENT-DATE?
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Wed Mar 26, 2008 11:24 am
Reply with quote

Shall i use the code as:

Code:
ACCEPT WS-DATE FROM CURRENT-DATE.


for using the FUNCTION CURRENT-DATE?
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Wed Mar 26, 2008 8:18 pm
Reply with quote

swapnadeep.ganguly
I can write one line of code for you but I dont want to do that, please refer to COBOL manual of how to use Functions.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Wed Mar 26, 2008 10:45 pm
Reply with quote

Code:
ACCEPT ... FROM DATE


is pre-Y2K COBOL. Since zillions of programs use it, IBM could not expand the result or otherwise alter the syntax, so you can't just define your receiving field to an incompatible length.

The function mentioned is the post-Y2K solution.
Back to top
View user's profile Send private message
gvsus

New User


Joined: 27 Mar 2008
Posts: 4
Location: USA

PostPosted: Thu Mar 27, 2008 4:52 am
Reply with quote

Code:
ACCEPT WS-DATE FROM DATE CCYYMMDD.


I think it works in ILE Cobol only.

I have mainframe code like above in production.
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Thu Mar 27, 2008 9:20 am
Reply with quote

Hi all,

The piece of code that worked for me are as under:

Code:
ACCEPT WS-DATE FROM DATE YYYYMMDD.


Also, there is another piece of code that extract the current date from the system. It is as under:

Code:
SELECT CURRENT DATE
   FROM SYSIBM.SYSDUMMY1
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 Sysplex System won't IPL at DR site I... All Other Mainframe Topics 2
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 How to delete a user's alias from the... JCL & VSAM 11
Search our Forums:

Back to Top