I am trying to understand simple batch processing using RPGLE and PRTF members below is the code for both but the results look like this (The columns print instead of the data) What am I doing wrong:
KDCSTPGM.RPGLE this is the rpgle member with logic
Dcl-f Customers Disk KEYED Usage(*Input);
Dcl-f Custlist Printer Usage(*Output) Oflind(Endofpage);
//Standalone variable declarations
Dcl-s Endofpage Ind Inz(*on);
dcl-s count packed(2:0);
// Main Procedure
Read Customers;
Dow Not %eof(Customers);
If Endofpage;
write Header;
Endofpage = *off;
Endif;
count += 1;
write Detail;
Read Customers;
Enddo;
If Endofpage;
write Header;
Endif;
write total;
*inlr = *On;
Return;
CUSTLIST.PRTF This is the printer file
A R HEADER
A 2 55'Customer List'
A 2 97DATE
A 2117PAGNBR
A 3 3'Customer:'
A R DETAIL SPACEB(1)
A 3'Customer Number'
A SPACEB(3)
A 25'Last Name '
A 43'First Name'
A 63'Phone'
A 82'Email'
A R TOTAL SPACEB(1)
A CUSTONO R 2SPACEB(4)
A REFFLD(CUSTSREC/CUSTONO MyLib/CUS-
A TOMERS)
A CLNAME R 14REFFLD(CUSTSREC/CLNAME MyLib/CUST-
A OMERS)
A CFNAME R 36REFFLD(CUSTSREC/CFNAME MyLib/CUST-
A OMERS)
A CPHONE R 54REFFLD(CUSTSREC/CPHONE MyLib/CUST-
A OMERS)
A CEMAIL R 66REFFLD(CUSTSREC/CEMAIL MyLib/CUST-
A OMERS)
A*%%RS+<record-sequences>
A*%%RS+ <sequence name="Custlist">
A*%%RS+ <device type="printer" width="132" height="66" />
A*%%RS+ <record-write record-format="HEADER" />
A*%%RS+ <record-write record-format="DETAIL" />
A*%%RS+ <record-write record-format="TOTAL" />
A*%%RS+ </sequence>
A*%%RS </record-sequences>
You don't have any data fields in your DETAIL record, instead they are in the TOTAL record...
Your PRTF should look more like so
A R HEADER
A 2 55'Customer List'
A 2 97DATE
A 2117PAGNBR
A 4 3'Customer Number'
A 4 25'Last Name '
A 4 43'First Name'
A 4 63'Phone'
A 4 82'Email'
A R DETAIL SPACEB(1)
A CUSTONO R 2
A REFFLD(CUSTSREC/CUSTONO MyLib/CUS-
A TOMERS)
A CLNAME R 14REFFLD(CUSTSREC/CLNAME MyLib/CUST-
A OMERS)
A CFNAME R 36REFFLD(CUSTSREC/CFNAME MyLib/CUST-
A OMERS)
A CPHONE R 54REFFLD(CUSTSREC/CPHONE MyLib/CUST-
A OMERS)
A CEMAIL R 66REFFLD(CUSTSREC/CEMAIL MyLib/CUST-
A OMERS)
A R TOTAL SPACEB(2)
A 10'Total Count:'
A COUNT 2 0 +2