× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 10-Aug-2016 10:37 -0500, John Arnold (MFS) wrote:
On 09-Aug-2016 14:08 -0500, Stone, Joel wrote:
<<SNIP>>
Surely there must be an easier way to write something like:

If Cust-add-date = ws-curr-date

Where Cust-add-date is type "L" format *MDY

Without breaking apart and rebuilding the current date?

Have you looked at the FIND-DURATION intrinsic function in COBOL -
that should be usable for this purpose.

COMPUTE W-DAYS =
FUNCTION FIND-DURATION (W-DTDSCH W-DTPAID DAYS).

Use a duration for the purpose of comparing date values? Of course what is shown, is not a comparison; so presumably the implication is that the next statement to be performed, in order to effect the desired equivalence test from the OP, would be the test for the difference between W-DTDSCH and W-DTPAID being zero days?:

IF W-DAYS = 0 THEN …

Even so, I am not sure that is helpful to resolve the issue from the OP, whereby the alluded problem is that WS-CURR-DATE is effectively either a PIC X(8) or a PIC 9(8) with eight digits forming a date-like value with the format YYYYMMDD. So while the above COMPUTE could accomplish a preface to the task of a later compare, only if given two *date* data-items as input.? But that alone, still leaves the original issue unsolved, not just for the lack of an actual compare, but the OP seems to be expressing a disdain for a requirement to reformat a[n effective] character-string of digits without separators into an actual date-value. If W-DTDSCH is replaced by Cust-Add-Data from the OP, and W-DTPAID is replaced by Ws-Curr-Date from the OP, then the function would not be allowed to compile, because the latter is not a date-typed data-item\variable; i.e. msg LNC2767 "Function argument 'WS-CURR-DATE' did not have the correct type for function 'FUNCTION FIND-DURATION'."


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.