|
Thanks and sure Scott the section of code in question is below(ignore
formatting issues caused by copy/paste). I did try having the 'O' specs
before any 'P' specs however then I can not get past the V5R2
precompiler(maybe I am just not setting the right options on the compile
command??). I have tried moving the 'O' specs around a bit(per previous
email suggestions) without success. The funny thing to me is I have other
(sub)procedures not of SQLRPGLE type which work fine in the order that
this source is in. Thanks for your help.
h NOMAIN
fkstrl if e k disk usropn
fksnml if e k disk usropn
frtlavgftw if e k disk usropn
Frtlavgfts2cf e workstn usropn
Fprt198 o F 198 PRINTER OFLIND(*INOF) usropn
**********************************
* Procedure Prototypes Copy Book *
**********************************
/include rtlavgftpr
**********************************
* Output Specs for Detail Report *
**********************************
Oprt198 e heading 3
O 10 'RTLSOORDP'
o 68 'Retail Special'
O 89 'Order Shipped Report'
O e heading 1
O 08 'DATE:'
O *DATE Y 18
O 125 'PAGE:'
O PAGE 130
O e heading 1
O 15 'Store / Name'
O 30 'Employee'
O 50 '# of Trans'
O 70 '# of Footwear'
O 100 'Average(%)'
O e detail 1
O store 20
O employee 30
O #trans 50
O #foot 70
O average 100
O e break 2
O 120 '********************'
O 100 '********************'
O 80 '********************'
O 60 '********************'
O 40 '********************'
O 20 '******************'
P rtlavgprt B EXPORT
D rtlavgprt PI
D st_rng1 3p 0
D st_rng2 3p 0
D strdt d
D enddt d
******************
*Data Structures *
******************
* KSWMPMY File layout for embedded sql
dkswmpmy e ds
***********************
* Procedure Variables *
***********************
dfirstpage s n inz(*on)
dstore s 13a inz(*blanks)
demployee s 25a inz(*blanks)
d#trans s 5p 0 inz(0)
d#foot s 5p 0 inz(0)
daverage s 5p 2 inz(0)
dtmpstrdt s 8p 0 inz(0)
dtmpenddt s like(tmpstrdt)
dtmpsp1ss s 5p 0 inz(0)
dspecialorder s 1a inz('J')
dfirstrun s n inz(*on)
dsavstr s 3p 0 inz(0)
dsavemp s 5p 0 inz(0)
dsavtrans# s 6p 0 inz(0)
di s 3p 0 inz(0)
dbrkrpt s n inz(*off)
dleavewin s n inz(*off)
drtltotft s 9p 0 inz(0)
drtltottrans s 9p 0 inz(0)
dstrtotft s like(rtltotft)
dstrtottrans s like(rtltottrans)
/free
open kstrl;
open ksnml;
open rtlavgftw;
open rtlavgfts2;
open prt198;
exsr builddata;
dow not leavewin;
exfmt answin;
select;
other;
leavewin = *on;
endsl;
enddo;
close kstrl;
close ksnml;
close rtlavgftw;
close rtlavgfts2;
close prt198;
*inlr = *on;
//////////////////////////////////////////////////////////////////
// BUILDDATA Subroutine - Handles collection of data for report //
//////////////////////////////////////////////////////////////////
begsr builddata;
i = 1;
tmpstrdt = %DEC(%char(strdt:*iso0):8:0);
tmpenddt = %DEC(%char(enddt:*iso0):8:0);
/end-free
c/exec sql declare sales cursor for
c+ select * from kswmpmy where divss = 'F' and
c+ (st#ss >= :st_rng1 and st#ss <=
:st_rng2
c+ and d07ss >= :tmpstrdt
c+ and d07ss <= :tmpenddt) and
c+ (o27ss <> :specialorder) and
c+ (st#ss <> 500)
c+ order by st#ss, sp1ss, tktss
c/end-exec
C/EXEC SQL
C+ WHENEVER NOT FOUND GOto eofsales
C/END-EXEC
c/exec sql
c+ open sales
c/end-exec
c dow sqlcod = 0
c/exec sql
c+ fetch sales into :kswmpmy
c/end-exec
/free
// test for house account cashier
tmpsp1ss = %dec((%char(st#ss) + '99'):5:0);
if (sp1ss = tmpsp1ss);
iter;
endif;
// test for return transaction
chain (st#ss:sp1ss:tktss) rtlavgftw;
if %found(rtlavgftw);
iter;
endif;
if (sp1ss <> savemp);
if not firstrun;
average = #foot / #trans;
strtottrans += #trans;
strtotft += #foot;
exsr print;
#trans = 0;
#foot = 0;
// get employee name
chain (sp1ss) ksnml;
if %found(ksnml);
employee = spnsn;
endif;
endif;
endif;
if (st#ss <> savstr);
if not firstrun;
brkrpt = *on;
savstr = st#ss;
#trans = strtottrans;
#foot = strtotft;
monitor;
average = strtotft / strtottrans;
on-error;
// no op
endmon;
exsr print;
#trans = 0;
#foot = 0;
strtottrans = 0;
strtotft = 0;
// get store name
chain (st#ss) kstrl;
if %found(kstrl);
store = %char(st#ss) + '/' + stnks;
endif;
endif;
endif;
exsr loadsumdta;
if firstrun;
savstr = st#ss;
firstrun = *off;
endif;
enddo;
/end-free
c eofsales tag
/free
// todo need to report the last employee and store
#trans = strtottrans;
#foot = strtotft;
monitor;
average = strtotft / strtottrans;
on-error;
// no op
endmon;
exsr print;
strtottrans = 0;
strtotft = 0;
except break;
store = 'Grand Total:';
#trans = rtltottrans;
#foot = rtltotft;
monitor;
average = rtltotft / rtltottrans;
on-error;
// no op;
endmon;
/end-free
c/exec sql
c+ close sales
c/end-exec
/free
endsr;
/////////////////////////////////////////////////////////////////////////
// LOADSUMDTA Subroutine - Handles loading of data for summary
display //
/////////////////////////////////////////////////////////////////////////
begsr loadsumdta;
if savtrans# <> tktss;
savtrans# = tktss;
rtltottrans += 1;
strtottrans += 1;
endif;
rtltotft += u51ss;
strtotft += u51ss;
endsr;
//////////////////////////////////////////////
// PRINT Subroutine - Handles report output //
//////////////////////////////////////////////
begsr print;
if firstpage or *inof;
except heading;
firstpage = *off;
*inof = *off;
endif;
if brkrpt;
except break;
brkrpt = *off;
endif;
except detail;
endsr;
/end-free
p rtlavgprt e
Scott Klement wrote:
If the "O" specs are not to be used globally then it would seem that
they should come between your "C" specs & the procedure end spec....
O specs are always global. Files in RPG are global -- you can't
declare a file that's local to a subprocedure. (At least, not using
standard RPG operations. You can do it with APIs, but that's another
topic altogether)
Since files are always global, so are O specs. They have to go before
the first P spec in the program.
Duane, can you possibly post your code, or at least part of it, since
I'm struggling to get a mental picture of what it looks like...
--
Weyco Group -
Florsheim, Brass Boot, Nunn Bush, Stacy Adams
Duane Kehoe Phone # 414.908.1814
EC / Programmer / Analyst Fax # 414.908.1601
Email: dkehoe@xxxxxxxxxxxxxx
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.