|
!!!!!! It worked! !!!!!! Thanks Paul! You were absolutely correct! I did copy the logic from my fillsub routine to the printsub routine! Now I can start growing my hair back! Thank you!!!! Brian. -----Original Message----- From: Paul Tuohy [mailto:tuohyp@xxxxxxxxxxxxx] Sent: Friday, October 14, 2005 3:01 AM To: RPG programming on the AS400 / iSeries Subject: Re: Printing a Subfile - Revisited Hi Brian, It would seem from the code that the fields you are using to place values in the DETAIL record fields are not from the subfile. 7 of the 8 fields you are printing are incorrect and these are the 7 fields you are setting in the loop. Therefore - spno01, spno02, spno03, sppctl, spspcd, spsplc, spsddt, spsdtm, spptno, spoqty do NOT come from the subfile. At a guess, you copied this bit of logic from the loop that you used to build the subfile. The reason that the values are the same on every record you print is that they were the values in the last record you read from the database file (?). If you are using the same field names on the DETAIL record as you have in the subfile SPODATA record then you do not need to have any moves and the routine should simply be BegSR PrintReport; rdashes = *ALL'-'; write HEADING; For Rrn = 1 To Rrn_Max; Chain Rrn SPODATA; If PrtOverFlow; Write HEADING; PrtOverflow = *off; endif; Write DETAIL; EndFor; Write pfooter; Close SPOINQP; Open SPOINQP; EndSR; It is much easier to use a For loop instead of a Dow (it means you do not need to do the rrn+1). You do NOT HAVE TO use the RRN field on the CHAIN - you can use a workfield if you want. But you might as well use RRN. HTH Paul Tuohy ComCon +353 1 282 6230 www.comconadvisor.com ----- Original Message ----- From: "Brian Piotrowski" <bpiotrowski@xxxxxxxxxxxxxxx> To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> Sent: Thursday, October 13, 2005 9:08 PM Subject: RE: Printing a Subfile - Revisited > 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 > > > > -- > This is the RPG programming on the AS400 / iSeries (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.