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



Once I started using Unions and SQL, it was much easier for me. Thanks for
the reply though.

-----Original Message-----
From: Richard B Baird [mailto:rbaird@esourceconsulting.com]
Sent: Thursday, May 23, 2002 8:28 AM
To: rpg400-l@midrange.com
Subject: RE level break within a level break - (was Difference bet. Primary
and Full procedural file)


Ramanujam,

see below:

--------original message----------
Lets say I want to print Unit of measure totals for each UOM under a
product

level break. Example:

Product|Bin |Warehouse|.... Quantity|UOM|.....
xyz    |AA1 |  T1     |      125.00 |LB |.....
xyz    |AB1 |  T2     |      100.00 |EA |......
xyz    |AB2 |  T2     |       10.00 |BX |......

Totals For Product xyz in Std. UOM EA-Each   99999.99
               EA-Each        100.00
                 LB-Pounds      125.00
                 BX-Boxes        10.00
When I get a product level break, I am supposed to show the product totals
and the UOM for that product totals... Do I make any sense?
<snip>
--------end of original message----------

What you are trying to do is not uncommon, and would have to be done using
my method below, or by reading through the file again at the end of each
item break, whether you used the cycle or not.

Try something like this - it's incomplete but it has the basics of what you
need to do and will work whether or not the file is actually sorted by uom
after item.

it's written as if the print file is ext defined, but if your's is
internally defined, you would need to define the 'L2 write's to be
'except's instead.

hth,

Rick


Fitmdtl    IP   E             DISK
Freport    O    E             PRINTER

D $uom            s              4    dim(99)
D $qty            s              9s 2 dim(99)

 * index for array processing
D $indx           s              2s 0

 * Holds number of array elements
D $tindx          s              2s 0

 *    define control breaks for input file.

IitmdtlRec     01
I                                          ITNBR         L2
I                                          ITUOM         L1

 *    Item Changed, inz uom total arrays and indices

C                   if        *inL2 = *on
C                   clear                   $uom
C                   clear                   $qty
C                   eval      $indx = 0
C                   eval      $tindx = 0
C                   end

 *    UOM changed, find existing or initialize new uom array element.

C                   if        *inL1 = *on
C     ITUOM         lookup    $uom($indx)                            10

C                   if        not %equal
C                   eval      $tindx = $tindx + 1
C                   eval      $indx  = $tindx
C                   end

C                   eval      $uom($indx) = ITUOM
C                   end

 *    accumulate totals, write detail

C                   eval      $qty($indx) = $qty($indx) + ITQTY
C                   write     DetailLine

CL2   1             do        $tindx        $indx
CL2                 eval      TUOM = $uom($indx)
CL2                 eval      TQTY = $qty($indx)
CL2                 write     UomTotals
CL2                 enddo

CL2                 write     ItemTotals

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
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 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.