|
> One of my co-workers asked an interesting question. Can an internal
> print file exist in a program with sub-procedures?
Yes. I've done several times.
> He defined the O-specs after the last sub-procedure but the compiler
> complains the O-specs are out of sequence. Moving the O-specs above the
> sub-procedures generates the same message, which makes sense.
No, it doesn't make sense. The O-specs should come BEFORE the
subprocedures, and it should NOT generate an error message. O-specs come
before P-specs.
> Has anyone made this work? I know the obvious answer is to use external
> print files (my personal favorite) but not everyone here is comfortable
> using them.
Here's a trivial program that works on my system, maybe that'll help:
H DFTACTGRP(*NO)
FQSYSPRT O F 80 PRINTER OFLIND(*INOF)
D PrintMe pr
D Text 80A const
D PrtText s 80A
D FirstTime s 1N inz(*ON)
/free
PrintMe('Dear Santa,');
PrintMe(' I''ve been a very good boy this year, and I''ve always');
PrintMe('wanted a pony. Can I please have a pony, Santa, please?');
PrintMe('I won''t ever ask you for anything ever again!');
PrintMe(' ');
PrintMe('Except maybe a sports car.');
PrintMe(' ');
PrintMe('Sincerely,');
PrintMe(' Dick Cheney');
*inlr = *on;
/end-free
OQSYSPRT E TOP 1 3
O E LINE 1
O PrtText 80
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Print a line of text on a report.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P PrintMe B
D PrintMe PI
D Text 80A const
c if FirstTime
c except TOP
c eval FirstTime = *OFF
c endif
c if *INOF
c except TOP
c endif
c eval PrtText = Text
c except LINE
P E
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.