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
 

 

Why this function SUBTRACT-DURATION can't be used in cobol?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
linc

New User


Joined: 25 Aug 2008
Posts: 25
Location: china

PostPosted: Mon Sep 15, 2008 9:08 am    Post subject: Why this function SUBTRACT-DURATION can't be used in cobol?
Reply with quote

Anybody knows why this function can't be used in cobol?
IGYPS2130-S Expected a function-name, but found "SUBTRACT-DURATION"The "MOVE" statement was discarded.
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: Mon Sep 15, 2008 10:07 am    Post subject:
Reply with quote

Hello,

Quote:
Anybody knows why this function can't be used in cobol?
Because IBM has not chosen to support it in the compiler. . . Possibly because it is not part of the cobol standard. . .

Quote:
FUNCTION SUBTRACT-DURATION is not a valid COBOL FUNCTION, regardless of the COBOL version/release.
From another topic - maybe something from that topic will help with what you need:
http://ibmmainframes.com/about30525.html
Back to top
View user's profile Send private message
linc

New User


Joined: 25 Aug 2008
Posts: 25
Location: china

PostPosted: Mon Sep 15, 2008 10:17 am    Post subject:
Reply with quote

Thanks for your quick reply.Now I am looking for that topic and find some useful information as following:
Quote:
What is your version/release of COBOL?

The minimum is COBOL/370 (released over 15 years ago) for the support of FUNCTION's, which is the successor to COBOL2.

FUNCTION SUBTRACT-DURATION is not a valid COBOL FUNCTION, regardless of the COBOL version/release.

When you say you need the "previous system-date", what is the amount of time do you need to subtract from the current-date? Minutes, Hours, Days, etc? We're all unsure.

To use the supported COBOL FUNCTION's, check out -

01) FUNCTION CURRENT-DATE
02) FUNCTION INTEGER-OF-DATE
03) ADJUST RESULT FROM INTEGER-OF-DATE
04) FUNCTION DATE-OF-INTEGER

However, I second Dick's suggestion regarding a standardized date methodology sub-system and you should speak with some of your other colleagues.

Regards,

Bill

So according to this,should I use those 4 COBOL function to code?I am not clearly about the "03) ADJUST RESULT FROM INTEGER-OF-DATE " usage?
Thanks very much.
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: Mon Sep 15, 2008 10:32 am    Post subject:
Reply with quote

Hello,

#3 is not actually a function. It is a suggestion that someone could "adjust the result" of the integer-of-date function.

Yes, you should be able to use those functions (assuming you are using a compiler that supports them). As mentioned, functions have been around for a long time. When you run a complie, the compiler version is shown at the top of the page. Most systems are using Enterprise COBOL now.

You can also use db2 for date arithmetic. Look in the db2 forum, there are multiple examples.
Back to top
View user's profile Send private message
linc

New User


Joined: 25 Aug 2008
Posts: 25
Location: china

PostPosted: Mon Sep 15, 2008 10:57 am    Post subject:
Reply with quote

Hi :
The program need to subtract from the current system date for every week.So I just want to find an easy way to perform this .
Maybe it is a little bit complicated to subtract 1 day from the current-date?So is there any exist function or some sample program for reference?
Many thanks.I use Endevor to complie my program and specify the program type as C3PTD2.
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: Mon Sep 15, 2008 11:17 am    Post subject:
Reply with quote

Hello,

If i understand what you want to do, i believe you can do what you want with the "integer-of-date" and the "date-of-integer" fumnction. Suggest you make up a small test routine and ust the current data as inlut to the integer-of-date function. Subtract 1 from that result and use this as input to the date-of-integer function. The standard date returned should be "yesterday".

I'd suggest you do this isolated test and be sure the functions work as you need before incorporating them into the full code.

Someone should be here if there are questions.
Back to top
View user's profile Send private message
revel

Active User


Joined: 05 Apr 2005
Posts: 135
Location: Bangalore/Chennai-INDIA

PostPosted: Mon Sep 15, 2008 11:24 am    Post subject:
Reply with quote

Linc,

May be the format which you are using for computation or in a Cobol Verb is not compatible format

The Date should be in this format YYYYMMDD

Check it out fallowing link for further clarification

http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.aix.cbl.doc/rlinfdi.htm

Hope this helps
Back to top
View user's profile Send private message
linc

New User


Joined: 25 Aug 2008
Posts: 25
Location: china

PostPosted: Mon Sep 15, 2008 11:32 am    Post subject:
Reply with quote

Yes,that's exactly what I want to do.Thanks for your proposel.
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 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
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am


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