View previous topic :: View next topic
|
Author |
Message |
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
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 |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
One way is to move some variable e.g., "20" in CC field of WS-DATE for 21st Century. |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
Use FUNCTION CURRENT-DATE? |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Shall i use the code as:
Code: |
ACCEPT WS-DATE FROM CURRENT-DATE. |
for using the FUNCTION CURRENT-DATE? |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
gvsus
New User
Joined: 27 Mar 2008 Posts: 4 Location: USA
|
|
|
|
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 |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
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 |
|
|
|