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
 

 

Does CURRENT-DATE function work in cobol II

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Does CURRENT-DATE function work in cobol II
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: 3158
Location: Tucson AZ

PostPosted: Wed Jan 24, 2007 12:26 am    Post subject:
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    Post subject: Re: Does CURRENT-DATE function work in cobol II
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: 3158
Location: Tucson AZ

PostPosted: Wed Jan 24, 2007 1:31 am    Post subject: Re: Does CURRENT-DATE function work in cobol II
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    Post subject:
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

Site Director


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

PostPosted: Tue Jan 30, 2007 4:52 am    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Tue Jan 30, 2007 4:59 am    Post subject:
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

Site Director


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

PostPosted: Tue Jan 30, 2007 6:45 am    Post subject:
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

Site Director


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

PostPosted: Wed Jan 31, 2007 3:23 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Feb 06, 2007 6:58 am    Post subject:
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    Post subject: Re: Does CURRENT-DATE function work in cobol II
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    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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


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