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

Does CURRENT-DATE function work in cobol II


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

New User


Joined: 02 Nov 2005
Posts: 24

PostPosted: Tue Jan 23, 2007 11:41 pm
Reply with quote

does CURRENT-DATE function work in cobol II? If not waht can be used in its place?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Jan 24, 2007 12:26 am
Reply with quote

Code:

 ___ Format 2--System Information Transfer __________
|                                                    |
| >>__ACCEPT__identifier-2__FROM__ _DATE__________>< |
|                                 |_DAY_________|    |
|                                 |_DAY-OF-WEEK_|    |
|                                 |_TIME________|    |
|                                                    |
|____________________________________________________|
Back to top
View user's profile Send private message
pav001

New User


Joined: 02 Nov 2005
Posts: 24

PostPosted: Wed Jan 24, 2007 1:20 am
Reply with quote

But such a call gets the date in YYMMDD format or YYYYMMDD? I want the date in YYYYMMDD format.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Jan 24, 2007 1:31 am
Reply with quote

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
View user's profile Send private message
pav001

New User


Joined: 02 Nov 2005
Posts: 24

PostPosted: Tue Jan 30, 2007 1:27 am
Reply with quote

Hi william,

Could you elaborate.. ?
What do you mean by accessing the internal date via subprogram?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jan 30, 2007 4:52 am
Reply with quote

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
Code:
20070129


which i believe is what you need. I used an X(12) for no real reason. . . icon_biggrin.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jan 30, 2007 4:59 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jan 30, 2007 6:45 am
Reply with quote

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. . . . icon_question.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jan 31, 2007 3:23 am
Reply with quote

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
View user's profile Send private message
pav001

New User


Joined: 02 Nov 2005
Posts: 24

PostPosted: Tue Feb 06, 2007 5:51 am
Reply with quote

Yes the code mentioned does work icon_smile.gif

Thanks alot..


PAV
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Feb 06, 2007 6:58 am
Reply with quote

You're welcome icon_smile.gif
Back to top
View user's profile Send private message
bijibhuyan

New User


Joined: 20 Dec 2006
Posts: 1
Location: pune

PostPosted: Tue Feb 06, 2007 4:33 pm
Reply with quote

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
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 Replace each space in cobol string wi... COBOL Programming 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top