|
How many box id's could an item contain?
Duplicated id's in an item possible?
Sum each id?
In this case: use a DS array!
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] Im Auftrag von
tim ken
Gesendet: Sonntag, 10. September 2023 14:51
An: RPG programming on IBM i
Betreff: Re: Adding all the box quantities for a item
Hi,
But is no looping etc.( any loop logic inside rpgle or inside sqlrpgle
program) required to add all such quantities for all the associated box
ids for a specific item number here to display their sum on display file
screen here ?
Thanks
On Sun, Sep 10, 2023, 18:14 Jerry Adams <midrange@xxxxxxxx> wrote:
Aside from the fact this is a bad design, it is a simple matter, aswhich
someone else suggested early on:
Total = qty1 + qty2 + .....
But that is so simple, I just know I missed something - again.
Jerry C. Adams
IBM i Programmer/Analyst
Tradition is just peer pressure from dead people.
--
NMM&D
615-585-2175
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of
tim ken
Sent: Sunday, September 10, 2023 7:22 AM
To: RPG programming on IBM i
Subject: Re: Adding all the box quantities for a item
Thanks,
Just for more clarification it's a single file item master which has all
these fields in it item number (which we search on display file screen),
box id, quantities for box id.
One item number mave one or more boxes andeach box has unique box id and
it's quantity in the Quantity field.
Considering this what would be the updated rpgle and sqlrpgle program
could display the sum of all the corresponding quantities for all suchfigure
boxes( I mean sum of quantities associated with each box id) for an item
number on display file screen ?
Thanks much...
On Sun, Sep 10, 2023, 17:13 Jerry Adams <midrange@xxxxxxxx> wrote:
Please excuse me if I missed it, but, like Daniel, I am trying to
seemsout exactly what the objective is here. Superficially, I admit, it
forsimple: How much (quantity) do we have in the warehouse for a specific
item. But it could be that we want to know how much is available for
shipment (unallocated).
As Daniel said two tables are needed: (1) an Item Master, and (2) a Lot
Inventory. The Lot Inventory is needed only, in my experience, for
inventory valuation at month-end; i.e., each Lot (or Box) was bought
adiscrete
different prices. Here, by the way, I am assuming that we are talking
about generic items, such as books, candy, etc., not high value,
isitems, such as jewelry that are inventoried, well, discretely.
If all you want to know is how much of any item, regardless of price,
thein inventory, then an SQL over the Lot Table will suffice, as Danielsales,
illustrated. However, if you want to know how much is available for
then one must include any order allocation. That could be done in theLot
Table, but the minimum wage packers in the warehouse will pull the itemother
from whichever Lot (Box) is closest at the time. Because of that and
quirks, I always keep the allocation in the Item Master and then, as
isorder is filled, reduce inventory in the Lot/Boxes since, at the end ofthe
day the auditors (usually) do not care which box was used.
This is, of course, a simplification; it ignores whether the inventory
ofvalued on a FIFO or LIFO basis. That distinction is usually onlypertinent
when the order is filled and on-hand inventory is reduced. Naturally,your
auditor’s rules may differ or vary somewhat. On the other hand, assomeone
else speculated earlier, this seems like a textbook exercise; in whichcase
ignore everything I said. If not, get the objective defined better andthe
rules needed to meet that objective.
Jerry C. Adams
IBM i Programmer/Analyst
What the world needs is more geniuses with humility. There are so few
Ofus left.
--
NMM&D
615-585-2175
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf
containsDaniel Gross
Sent: Sunday, September 10, 2023 4:12 AM
To: RPG programming on IBM i
Subject: Re: Adding all the box quantities for a item
Hi Tim,
so I'm trying to understand and explain a solution.
First - I think you have one table (I will call it "items") with the
item
master data, and another table (I will call it "boxes") which
forone
record for each box of records, and a quantity how many items are in
each
box. Is this near?
If yes - simply use SQL to query both tables at the same time:
exec sql declare csrItemBoxes cursor for
select boxes.id,
max(boxes.item_id),
case
when boxes.id is not null
then max(items.description)
else "Total Quantities:"
end,
sum(boxes.quantity)
from boxes
join items on items.id = boxes.item_id
where boxes.item_id = :itemid
group by rollup (boxes_id);
Now this will give your cursor one line per box and a summary line
forallthis
boxes.
Now loop through that cursor and add a subfile line for each row
fetched.
If the "boxes.id" field is "null", you have the summary line - in
line, the description field will be filled with the text "Totalline
Quantities:".
Maybe set a flag to give that line another color, and deactivate a
selection option field, because this is a summary line.training,
HTH
Daniel
P.S.: As far as I can see, you haven't received a proper RPGLE
and now you should change/maintain existing programs. Ask yourto
supervisor
to give you a proper training, find yourself a training
(like [1]systemideveloper.com) or find a tutor/coach who is willing
help you (for profit or not) - just my 2ct.it
Am 09.09.2023 um 20:52 schrieb tim ken <timk2574@xxxxxxxxx>:
Hi,
They are like below :-
On display file screen (a subfile)
Enter item number :- .................
Once we enter item number then program need to look for this item
number
in
a item master file and if it successfully finds an item in it then
further checks corresponding boxes ( for each item there might be
multiple
such boxes in box id field of this same item master file) and
quantityeachitem
such box there is corresponding 'quantity' field is there in same
master file so we need to add all such quantities for all thethe
individual
boxes and then finally sum it up and show on display file screen.
Just for more clarification:-
Box no. Quantity
Box 1 5
Box 2 7
Box 3 15
Then just for example if all the above 3 boxes are there for item
number
'xyz' then
Program should be able to read this item master file for a specfic
item
number which is entered on display file(which is a subfile with
record,
control, header and footer but does not contain column headings on
display
screen for these boxes but such multiple boxes are present in this
item
master file for each such item number )
And then program should add quantities for all these boxes and on
display file(subfile) it should be able to display like :- "Toteach
Quantities: 27 Sum"
Thanks a lot.. ..
On Sun, Sep 10, 2023, 00:00 Glenn Gundermann
<glenn.gundermann@xxxxxxxxx>
wrote:
Sorry, my previous reply was incorrect. No need for GROUP BY.Is
box a
separate row in the item master table or is each box and
aitem_number
separate column in the same row? If the former:exec sqlSELECT
sum(quantity) INTO :totalQtyFROM item_master WHERE
=subscription
:itemNo;Your display file will define the field TOTALQTY.Yours
truly,Glenn
Gundermannglenn.gundermann@xxxxxxxxx(416) 317-3144
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any
relatedrelated
questions.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.
References
Visible links
1. https://www.systemideveloper.com/
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
relatedquestions.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
--questions.--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
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.