× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Al,

The fields are not defined in the subfile, but are rather the product of
the addition of three fields.  Here's my subfile code:

     A          R SPODATA                   SFL CHGINPDFT(CS)
     A            SPONUM        13A  O  7  2
     A            PARTNO        15A  O  7 16
     A            PARTCL         7A  O  7 33
     A            QTY            6A  O  7 41
     A            SUPPLIER       9A  O  7 48
     A            SPRCCD    R        O  7 58
     A            SPOSDATE      10A  O  7 62
     A            SPOSTIME       5A  O  7 73
     A            SPTRMD    R        H
     A            SPRMRK    R        H
     A            SPUSR     R        H

One of the programmers here suggested that it might be because the
subfile is reading by reference.  Make sense?

Brian.

-----Original Message-----
From: Alan Shore [mailto:AlanShore@xxxxxxxx] 
Sent: Thursday, October 13, 2005 4:26 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Printing a Subfile - Revisited


Okay Brian - as Spock would say, when all the logical answers have
proven
to be NOT the answer, then the only true answer is the illogical?

The report you are writing is DETAIL
this contains the field SPONUM
you are calculating this field as
SPONUM = spno01 + '-' + spno02 + '-' + spno03;
Question - are the fields spno1, spno2 spno3 defined on the subfile?
OR
are they defined on the input file used to populate the subfile?



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx


 

             "Brian

             Piotrowski"

             <bpiotrowski@simc
To 
             oeparts.com>              "RPG programming on the AS400 /

             Sent by:                  iSeries" <rpg400-l@xxxxxxxxxxxx>

             rpg400-l-bounces@
cc 
             midrange.com

 
Subject 
                                       RE: Printing a Subfile -
Revisited  
             10/13/2005 04:08

             PM

 

 

             Please respond to

              RPG programming

              on the AS400 /

                  iSeries

             <rpg400-l@midrang

                  e.com>

 

 





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 thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.