|
Hmmm, ok. Well, still strange things abound... I've made the modifications to the code as directed by the group (Al, I had to add Rrn = Rrn +1 or the code went into endless loop). So here's where we stand: BegSR PrintReport; rdashes = *ALL'-'; Rrn = 1; write HEADING; DoW Rrn < Rrn_Max; Chain Rrn SPODATA; If PrtOverFlow; Write HEADING; PrtOverflow = *off; endif; SPONUM = spno01 + '-' + spno02 + '-' + spno03; PARTCL = %subst(spptcl:1:7); SUPPLIER = spspcd + ' ' + spsplc; SPOSDATE = %subst(%char(spsddt):5:2) + '/' + %subst(%char(spsddt):7:2) + '/' + %subst(%char(spsddt):1:4); if %len(%trim(%char(spsdtm))) = 1; SPOSTIME = '00:0' + %trim(%char(spsdtm)); endif; if %len(%trim(%char(spsdtm))) = 2; SPOSTIME = '00:' + %trim(%char(spsdtm)); endif; if %len(%trim(%char(spsdtm))) = 3; SPOSTIME = '0' + %subst(%char(spsdtm):1:1) + ':' + %subst(%char(spsdtm):2:2); endif; if %len(%trim(%char(spsdtm))) = 4; SPOSTIME = %subst(%char(spsdtm):1:2) + ':' + %subst(%char(spsdtm):3:2); endif; PARTNO = %trim(spptno); QTY = %trim(%editc(spoqty:'3')); Write DETAIL; Rrn = Rrn + 1; EndDo; Write pfooter; Close SPOINQP; Open SPOINQP; EndSR; So I run the program and query the database. Here's the data that is returned: 200510-ZA-001 32155S9V A031 6 191630 13 RP 10/01/2005 08:08 200510-ZA-001 32155S9V A121 6 191630 13 RP 10/01/2005 08:08 200510-ZA-001 32155S9V A301 6 191630 13 RP 10/01/2005 08:08 200510-ZA-002 33100S3V A120M1 2 141350 04 SS 10/02/2005 09:38 200510-ZA-003 51320S0X C000M1 120 132280 01 SS 10/02/2005 11:37 200510-ZA-004 76861S3V A040M2 10 140290 04 SS 10/02/2005 14:11 200510-ZA-005 79100S3V A400M1 3 140290 11 SS 10/02/2005 14:11 Now when I print out the data, it executes the above subroutine. Here's what comes out: 200510-ZA-005 79100S3V A400M1 3 140290 11 SS 10/02/2005 14:11 200510-ZA-005 79100S3V A400M1 3 140290 11 RP 10/02/2005 14:11 200510-ZA-005 79100S3V A400M1 3 140290 11 RP 10/02/2005 14:11 200510-ZA-005 79100S3V A400M1 3 140290 11 RP 10/02/2005 14:11 200510-ZA-005 79100S3V A400M1 3 140290 11 SS 10/02/2005 14:11 200510-ZA-005 79100S3V A400M1 3 140290 11 SS 10/02/2005 14:11 200510-ZA-005 79100S3V A400M1 3 140290 11 SS 10/02/2005 14:11 As you can see, the first record is correct (it is the last record of the subfile). The rest of the fields (up to the "SS") are all the last record in the subfile. Other than the "SS" field that varies, the remaining fields are all the same record. This is getting to the point of lunacy. Again, I thank everyone who has helped me thus far. Brian. -----Original Message----- From: Holden Tommy [mailto:Tommy.Holden@xxxxxxxxxxxxxxxxx] Sent: Thursday, October 13, 2005 3:18 PM To: RPG programming on the AS400 / iSeries Subject: RE: Printing a Subfile - Revisited I'm not sure you're stuck on the last record from following the thread.... *some* of the detail data on the report does change per record...those are the same fields that are defined in your subfile. The other fields on your detail record should be as well else you'll have to move the data from the display fields to the print fields. Thanks, Tommy Holden
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.