Return to the RPG Tips
Sample SQLRPGLE report program
Fqsysct if e k disk
Fqsysprt o f 132 printer oflind(*inof)
d pgmsts esds extname(ppgmsts)
D @Sql s 1000
D @MtrmDs e ds Extname(Mtrm)
/free
Except #Head;
Read Rqsysct;
Dow Not %Eof(Qsysct);
If Scdlcd = *Blanks and scprac <> '9S'
and scprac <> 'SL';
@Sql =
'select * from mpms' + scprac + '/mtrm where tmtrty = '
+ '''' + 'C'
+ '''' + ' and '
+ ' tmtrcd not in'
+ ' (select hrtrcd from mpms' + scprac + '/mhtr)'
+ ' and tmdlcd = ' + '''' + ' ' + '''';
exec sql prepare badqry from :@Sql;
exec sql Declare BadCsr scroll cursor for BadQry;
exec sql Open BadCsr;
exec sql Fetch Next from BadCsr into :@Mtrmds;
If Sqlcod = 0;
Dow Sqlcod = 0;
Except #Bad;
exec sql Fetch Next from BadCsr into :@Mtrmds;
EndDo;
EndIf;
exec sql Close BadCsr;
EndIf;
Read Rqsysct;
EndDo;
*Inlr = *On;
Return;
/End-Free
Oqsysprt e #Head 3 03
o or of 3 03
O $RDATE 8 ' - - '
O $TIMEX 20 ' : : '
O 67 'Never Billed'
O 115 'Page'
O PAGE 120
O $PGM 132
O e #Head 1
o or of 1
O 2 'PR'
O +2 'TRCD '
O +2 'CPT '
O +2 'Description'
O ef #Bad 1
O scprac 2
O tmtrcd +2
O tmcpt1 +2
O tmtrds +2
[report a broken link by clicking here]