It was basically a way of doing something like the following.... in psudo
code....
chain (pattern1: color1:) myfile
if found
update
else
write
endif
instead he did this.....
write
if error
update
endif
Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777
Gary Thompson <GThompson@xxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
05/27/2011 09:04 AM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
To
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
cc
Subject
Re: insert code was(Re: Embedded SQL - performance question)
Exec Sql Insert Into myLib/myFile (Pattern, Color, Onhand)
VALUES(:Pattern1,
:Color1, :Qty1);
IF SQLCOD = -803;
Chain (Pattern1: Color1) myFile;
IF %found;
Onhand = Qty1;
Update myFilef %fields(Onhand);
Endif;
Endif;
My 2 cents is the author intended to:
1) ensure a particular Pattern and Color
is recorded with current value of Onhand
2) if SQL insert failes, update
existing Pattern and Color
with current Onhand
The mix of SQL and RLA is a little different
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.