View previous topic :: View next topic
|
Author |
Message |
pav001
New User
Joined: 02 Nov 2005 Posts: 24
|
|
|
|
does CURRENT-DATE function work in cobol II? If not waht can be used in its place? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Code: |
___ Format 2--System Information Transfer __________
| |
| >>__ACCEPT__identifier-2__FROM__ _DATE__________>< |
| |_DAY_________| |
| |_DAY-OF-WEEK_| |
| |_TIME________| |
| |
|____________________________________________________| |
|
|
Back to top |
|
|
pav001
New User
Joined: 02 Nov 2005 Posts: 24
|
|
|
|
But such a call gets the date in YYMMDD format or YYYYMMDD? I want the date in YYYYMMDD format. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
pav001 wrote: |
But such a call gets the date in YYMMDD format or YYYYMMDD? I want the date in YYYYMMDD format. |
Pick any of the Y2K solutions or access the internal date via subprogram. |
|
Back to top |
|
|
pav001
New User
Joined: 02 Nov 2005 Posts: 24
|
|
|
|
Hi william,
Could you elaborate.. ?
What do you mean by accessing the internal date via subprogram? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Pav,
This code
Code: |
*
01 HOLD-DATE PIC X(12).
STRING FUNCTION CURRENT-DATE (1:4)
FUNCTION CURRENT-DATE (5:2)
FUNCTION CURRENT-DATE (7:2) DELIMITED BY '\'
INTO HOLD-DATE.
DISPLAY HOLD-DATE.
|
returns
which i believe is what you need. I used an X(12) for no real reason. . . |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
The problem is that COB II has no 8 char "current date". They need to go down and retrieve some form of the system date or use the date that's available and apply one of the Y2K methods (sliding windows?) on it to get the century. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When i tried directly referencing CURRENT-DATE the code failed with compiler errors.
When i used the function, it worked.
I'll check tomorrow to see which version of COBOL this was done with.
In the meantime, trying the function couldn't hurt anything. . . . |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Here's the first line out of a compile here:
Quote: |
PP 5655-G53 IBM ENTERPRISE COBOL FOR Z/OS 3.4.1
|
Pav, has there been progress? |
|
Back to top |
|
|
pav001
New User
Joined: 02 Nov 2005 Posts: 24
|
|
|
|
Yes the code mentioned does work
Thanks alot..
PAV |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome |
|
Back to top |
|
|
bijibhuyan
New User
Joined: 20 Dec 2006 Posts: 1 Location: pune
|
|
|
|
Hi All,
CURRENT-DATE doesn't work with cobol II. So, we have to rplace it with
ENTER COBOL
MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE
ENTER S-COBOL
As the Format of CURRENT-DATE is MM/DD/YY ? X(8)
FUNCTION CURRENT-DATE format is YYYYMMDDHHMMSSxx-xxxx - returns a 21-character alphanumeric value.
So, we have to move the FUNCTION CURRENT-DATE to CURRENT-DATE
using reference modification.
Please try out and let me know if it works out.
Thanks,
Bijay. |
|
Back to top |
|
|
|