"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx> wrote on 04/28/2017 12:53:44
PM:
"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx> wrote on 04/28/2017 12:43:14
PM:
RPG does not auto total anything (at least not RPG IV or RPGLE).
You must accumulate the total in the calcs.
Once you have your value, if the field matches a field in the printer
file,
the contents will be printed just like any other field.
Hmmm, I must be getting my computer languages confused. So, in
RPG, if I have L1, L2, and L3 defined then I have to also define 4
different accumulator fields and accumulate them myself in c-specs?

OK, I got the following working. My question is, is this the best
that can be done from the perspective of using free-form as much as
possible? Too bad IBM didn't give us special subroutine names for the
control levels like BEGSR *INL1, BEGSR *INL2, ... BEGSR *INLR so that we
could eliminate a few more fixed-format C-specs when using control breaks.
I wonder if they'd be amenable to accepting an RFE in this area?

ctl-opt AlwNull(*USRCTL) DatFmt(*ISO) TimFmt(*ISO)
Dftactgrp(*no) Actgrp(*caller) Debug Option(*SRCSTMT:
*NODEBUGIO);

FCYCLEF IP E K DISK
FCYCLEP O E PRINTER OFLIND(*IN90)

dcl-s QUAN_L1 like(VALU);
dcl-s QUAN_LR like(VALU);
dcl-s VALU_L1 like(VALU);
dcl-s VALU_LR like(VALU);

ICYCLERF 99
I TYPE TYPE L1

exsr HEADINGS;

eval(h) VALU = COST * QUAN;
QUAN_L1 += QUAN;
VALU_L1 += VALU;
write DETAIL;

CL1 exsr L1TOTAL
CLR exsr LRTOTAL

begsr HEADINGS;
if *in90;
write PAGEHD;
write COLHD;
*in90 = *off;
endif;
endsr;

begsr L1TOTAL;
QUAN = QUAN_L1;
QUAN_L1 = *zero;
QUAN_LR += QUAN;
VALU = VALU_L1;
VALU_L1 = *zero;
VALU_LR += VALU;
write SUBTL;
exsr HEADINGS;
endsr;

begsr LRTOTAL;
QUAN = QUAN_LR;
VALU = VALU_LR;
write TOTAL;
endsr;

begsr *INZSR;
*IN90 = *ON;
endsr;

Sincerely,

Dave Clark

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.