Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Example: using limits

This example shows how you can use an expiration date field to hold either a normal expiration date or else a high limit that allows an "everlasting" subscription.

Suppose that your application checks subscriptions for expiration, but you want some subscriptions to last indefinitely. Consider the following code fragment:

Process Dateproc(Flag,Trig). . .
. . .
01 SubscriptionRecord.
   03 ExpirationDate  PIC 9(6) Date Format yyxxxx.
. . .
77 TodaysDate  Pic 9(6) Date Format yyxxxx.
. . .
   If TodaysDate >= ExpirationDate
      Perform SubscriptionExpired

Suppose that the application encounters the following values:

Because both dates are windowed, the first subscription is tested as if 20070104 were compared with 19991231, and so the test succeeds. However, when the compiler detects the special value, it uses trigger expansion instead of windowing. Therefore, the test proceeds as if 20070104 were compared with 99999999. This test will always fail.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)