View previous topic :: View next topic
|
Author |
Message |
linc
New User
Joined: 25 Aug 2008 Posts: 25 Location: china
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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:
ibmmainframes.com/about30525.html |
|
Back to top |
|
|
linc
New User
Joined: 25 Aug 2008 Posts: 25 Location: china
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
linc
New User
Joined: 25 Aug 2008 Posts: 25 Location: china
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
Back to top |
|
|
linc
New User
Joined: 25 Aug 2008 Posts: 25 Location: china
|
|
|
|
Yes,that's exactly what I want to do.Thanks for your proposel. |
|
Back to top |
|
|
|