|
Good Day,
I am just starting on Externally described print files and my first attempt is not very satisfying.
The code below prints generic heading and then detail lines (if any).
The 'Write HEAD' executes but apparently is writing something weird. If I 'Write Head' enough times to trigger overflow, I get a
halt that tells me I did, but I suppose failed to handle it properly. So it writes something.
If I have detail - the detail prints fine and when I look at the spool entry - no output visible by 'write head'.
If I have no detail ( but 'write head' executes ) - the spool file exists but it won't let me browse, print, or copy the entry. I assume it put out
something - trash maybe.
In Addition, If anyone could point me to a good explanation of handling overflow, that would be nice.
Thanks
H DftActGrp(*No) ActGrp(*Caller)
H*Debug(*No) Optimize(*Basic)
H Debug Optimize(*None)
H InDent('>') Text(*SrcMbrTxt)
H Option(*NoXref :*NoShowCpy : *NoExpDDS : *Ext : *Showskp :
H *NoDebugIO)
0004 FPOMASTER IPE E K Disk
0003 FPOASN IF E K DISK
0005 FTST117PRT O E PRINTER
0019 D RecDate S D INZ(*SYS)
0019 D TodayDate S D Inz(*SYS)
D ASNPo S Like(PAPon)
D ASNItem S Like(PAItem)
D EOFASN S N
* below in lieu of ext desc print file
D*ponum S 5 0
D*item S 5 0
D*line S 3
D*part S 30
D*qtyleft S 5 0
D*ORDN S 10
D*ASNDAT S L Datfmt(*MDY)
D*firm S 15
D*asnqty S 5 0
D once S N
IPORec1 01
/FREE
// Eval once = *On;
if not Once;
Eval once = *On;
write HEAD;
endIf;
If *IN01 and
PODEL = ' ' and
POLnk = 0 and
PORDat > 0;
//
// CONVERT Rec Date
//
Eval RecDate = %Date(PORDat:*CMDY);
//
// Find Matching date and print po heading
//
If RecDate = TodayDate and
(POQty - POQtr) > 0;
Eval Ponum = POPon;
Eval Item = POItm;
Eval Line = POLin1;
Eval Part = POPrt1;
Eval QtyLeft = POQty - POQtr;
Write PODetail;
//
// Read POASN to find matching entry
//
Eval ASNPO = PoPon;
Eval ASNItem = PoItm;
Setll(E)KeyASN POASN;
Eval EOFASN = *Off;
Dow Not EOFASN;
Read POASN;
If %Error or %EOF;
Eval EOFASN = *On;
Iter;
EndIf;
If PAPon <> PoPon or
PAItem <> PoItm;
Eval EOFASN = *On;
Iter;
EndIf;
//
// Print ASNDetail for Matching PO/Item
//
Eval OrdN = PAOrdN;
Eval AsnDat = PADate;
Eval Firm = PAFirm ;
Eval ASNQty = PAQty;
Write ASNDetail;
EndDo;
EndIf;
EndIf;
/End-free
CSR *INZSR Begsr
C KeyASN KList
C KFLD ASNPo
C KFLD ASNItem
C EndSr
PRTF
A*%%TS DD 20090709 162645 buddy REL-V5.0.1 WDSc
A*%%PR 2066132I
A*%%EC
A* CRTPRTF FILE(MARR/OPN117PRT) SRCFILE(MARR/QRPGLESRC) SRCMBR(OPN117PRT) D
A* OPTION(*EVENTF) PAGESIZE(66 80 *ROWCOL) REPLACE(*YES)
A*
A R HEAD SKIPB(02) SKIPA(05)
A*%%TS DD 20090630 110016 buddy REL-V5.0.1 WDSc
A*%%RI 00000
A 4' OPN117'
A 43'Daily ASN Report'
A* 70DATE
A* EDTCDE(Y)
A* SPACEA(1)
A* 4'P.O. Number'
A* UNDERLINE
A* 17'Item'
A* UNDERLINE
A* 25'Line'
A* UNDERLINE
A* 35'Part Number'
A* UNDERLINE
A* 66'Qty Remaining'
A* UNDERLINE
A R PODETAIL
A*%%TS DD 20090630 110016 buddy REL-V5.0.1 WDSc
A*%%RI 00000
A PONUM 5 0O 5EDTCDE(3)
A ITEM 5 0O 17EDTCDE(3)
A LINE 3 O 26
A PART 30 O 32
A QTYLEFT 5 0O 70EDTCDE(3)
A SPACEA(1)
A R ASNDETAIL
A*%%TS DD 20090709 162645 buddy REL-V5.0.1 WDSc
A*%%RI 00000
A 5'Order# -'
A ORDN 10 O 14
A 26'Date -'
A ASNDAT L O 33TEXT('ASN Date')
A DATFMT(*MDY)
A 44'Firm -'
A FIRM 15 O 51
A 67'Qty -'
A ASNQTY 5 0O 73EDTCDE(3)
A SPACEA(2)
CL
OVRPRTF FILE(TST117PRT) TOFILE(QPRINT) DEV(P2)
CALL TST117
DLTOVR FILE(*ALL)
ENDPGM
Buddy McClean
IT Director
Ext 106
Marr Bros Inc
214.948.7387
1.800.627.7276
Ext 106
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.