On 2022-01-26 12:11 p.m., DEnglander--- via RPG400-L wrote:
>
> I wanted to specifically get the job date, and %date is the system date. I
> was testing a job interactively [it normally runs in QBATCH] and was
> wondering why it was not getting the correct job date. But when I signed
> off and back on, it did, since it reinitialized.
> ...

RPG only gets the job date during the *INIT phase of a module.

That phase runs
- once per activation group for linear-main or NOMAIN modules
- the first time any procedure in the module procedure is called in a cycle-main module, and again when the main procedure is called when the previous call to the module's main procedure ended with LR on.

Instead of using *DATE directly, you could write a program or module with a cycle-main procedure to retrieve the current job date. It would set on LR before returning, so it would get a new value for *DATE every time it was called.

dcl-pi getJobDate;
dateval date(*iso);
end-pi;
dateval = %date(*date);
*inlr = '1';

It could have a packed(8) parameter if you wanted the actual *DATE numeric value, but that could be tricky if some jobs might have a different job date format. %DATE understands the format of *DATE, but it wouldn't know the format of a packed(8) value.


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-2022 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.