We've used a similar pattern for years and couldn't be happier.

-----Original Message-----
From: Dan [mailto:dan27649@xxxxxxxxx]
Sent: Tuesday, September 12, 2017 4:41 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: /eof compiler directive to keep prototypes in source with the logic

So, I'm on a runaway train now with service programs, taking time off-hours (I'm a contractor) to learn all of this stuff, and now stumbling onto conditional compiler directives.

I've always disliked the idea of keeping prototypes in their own source file, usually QPROTOSRC. So, while I was searching for information on how to use /DEFINE, /IF DEFINED, etc., I found Jon and Susan's article at
and opened up "Code Sample 1" (pasted below), which appears to be an answer to avoiding QPROTOSRC files. My question: Is anyone actually using this technique? If anyone has considered using it, but decided not to, can you explain why?

- Dan

* Source member EndOfMonth
* Ignore H-spec if only processing prototypes /If Not Defined(OnlyProtos) H DatFmt(*ISO) NoMain /EndIf

D EndOfMonth Pr D DatFmt(*ISO)
D WorkDate D DatFmt(*ISO) Value

* If prototypes is all we want, then
* skip straight to end of file
/If Defined(OnlyProtos)

P EndOfMonth B
D PI D DatFmt(*ISO)
D WorkDate D DatFmt(*ISO) Value

* Working variables
D DayNo S 3P 0

* Advance the input date (WorkDate) by one month

C AddDur 1:*M WorkDate

* Subtract day number from result to reach last
* day of previous month

C Extrct WorkDate:*D DayNo
C SubDur DayNo:*D WorkDate

C Return WorkDate

P EndOfMonth E

This thread ...


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

This mailing list archive is Copyright 1997-2020 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].