![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: How can I add 7 days to a date from within a Cobol Routine. Is there a converse of LIB$DAY which converts number of days to a date. The Answer is : How you do this depends greatly on the original format of the date you will be using as a basis for the calculation. One can see dates in various binary formats including quadword and UTC, and one can see dates in a variety of text formats. With text-format dates, you may well be able to use a combination time, a text-format time specification that includes both an absolute time and a delta time. In this case, the delta time would be "7-" or similar. To determine midnight seven days hence (in DCL), use: $ x = f$cvtim("TODAY+7-","ABSOLUTE") The lib$add_times call would appear tailor-made to this situation. lib$add_times expects one of the two quadwords to be a delta time. You will need to call sys$bintim or sys$cvt_[to|from]_internal_time to get the quadwords. To go from binary to text, there are various routines including sys$asctim, sys$numtim, lib$cvt_vectim, and others. There are also a variety of UTC-format time routines available. COBOL or other language is only a factor in the relative difficulty of calling certain system service routines from the language, and/or in the availability of any language-specific date routines.
|