Page 1 of 1

Need to add hours from given time

PostPosted: Tue Jun 11, 2013 8:58 pm
by deva_048
While using the function getting error shown below:

DISPLAY FUNCTION ADD-DURATION (WS-TIME MINUTES 15)

EXPECTED A FUNCTION-NAME, BUT FOUND "ADD-DURATION". THE "DISPLAY" STATEMENT WAS DISCARDED.

Version: IBM ENTERPRISE COBOL FOR Z/OS 4.2.0 0

Re: Need to add hours from given time

PostPosted: Tue Jun 11, 2013 9:18 pm
by Robert Sample
When I look at the Enterprise COBOL 4.2 Language Refernce manual, there is no ADD-DURATION function listed in the manuall -- neither in the intrinsic function list, nor in the Index. So where did you get the idea that such a function exists in COBOL?

Re: Need to add hours from given time

PostPosted: Tue Jun 11, 2013 9:20 pm
by deva_048
While browsing in net i have found out this idea everyone mentioned... Is there any other possible way to implement this??

Re: Need to add hours from given time

PostPosted: Tue Jun 11, 2013 9:25 pm
by Robert Sample
You have, hopefully learned the first lesson about browsing the Internet for information -- not everything you read on the Internet is accurate and true.

If you are wanting to add hours to a given time, there are two verbs in COBOL that can do this: ADD and COMPUTE. Which you use will depend upon your level of COBOL expertise. You will also have to consider what your time value represents -- elapsed time or time of day. The different is 37 hours is a perfectly valid elapsed time value, whereas time of day values will be limited to the range 0 to 12 (or 0 to 24). For time of day values, if you go over the maximum you need to determine what to do (add 1 to a day field, or just subtract the maximum value from the computation, or something else).

Re: Need to add hours from given time

PostPosted: Tue Jun 11, 2013 10:12 pm
by Akatsukami
When you saw that there were real answers in this thread, Deva-kun, what did you do?

Re: Need to add hours from given time

PostPosted: Tue Jun 11, 2013 11:38 pm
by dick scherrer
Hello,

While browsing in net i have found out this idea everyone mentioned...

No, NOT everyone has mentioned this . . . And if some did, did you ensure they are using the IBM compiler on the mainframe?

Is here some particular reason you chose to ask the same question as your other post that Akatsukaimi referenced?

Just because you let a couple of weeks go by, do not expect different answers. You were given ways to get to your goal.

It is good to look for things on your own - we highly encourage this, but is is not so good to ask about syntax you have not even verified in the COBOL manual.

Good luck :)