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

Use an additional variable to store the SQLCOD from the Fetch Statement.
An other solution would be to remove the SQLCOD from your DOU, to add an
If-Statement immediately after the Fetch that checks for the SQLCOD. If
SQLCOD is 100 (=Not found) leave the DOU-Loop.

Next Question:
Is it okay to delete records from a LF that is just an alternate key of
the Original Physical file.

No, it's not a good idea, because all SQL statments where DDS desrcibed
logical files are specified will be rewritten by the query optimizer to
access the based physical file. Also, all SQL statements where DDS described
logical files are specified must be rerouted to the classic query engine
(CQE) which normally performs worse than the newer SQL Query Engine (SQE)
and rerouting a query from SQE to CQE my cost 15% performance.

If you are working with SQL always specify the physical file (or SQL table)
and never use a DDS described logical file.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Ala, Michael A
Gesendet: Wednesday, May 21, 2008 16:17
An: rpg400-l@xxxxxxxxxxxx
Betreff: SQLCOD with Multiple Sql Statements and Best Practices for
workingwith Logicals



I have a program with an sql select I check sqlcod within that fetch I may
run an SQL Delete
The issue is that this delete sets my sqlcod to 100 sometimes causing the
program end the because subsequent fetches wont run due to SQLCOD<>'00000'
0223.00 C CheckLines BEGSR
0224.00 C DOU SQLCOD<>0
0225.00 C/Exec SQL
0226.00 C+ Fetch Next
0227.00 C+ From Canceled
0228.00 C+ Into :Parent,
0229.00 C+ :Shipto,
0230.00 C+ :Company,
0231.00 C+ :Order#,
0232.00 C+ :OrderType,
0233.00 C+ :DeliverOn,
0234.00 C+ :ShipDate,
0235.00 C+ :OrderDate,
0236.00 C+ :CancelDate,
0237.00 C+ :BusinessUnit
0238.00 C/End-Exec
0239.00 C IF SQLCOD = 0
0240.00 C*-----------------------------------------------



Can I move the Value of SQLCOD to another variable so my code would read


0223.00 C CheckLines BEGSR
0224.00 C DOU FetchCode <> 0
0225.00 C/Exec SQL
0226.00 C+ Fetch Next
0227.00 C+ From Canceled
0228.00 C+ Into :Parent,
0229.00 C+ :Shipto,
0230.00 C+ :Company,
0231.00 C+ :Order#,
0232.00 C+ :OrderType,
0233.00 C+ :DeliverOn,
0234.00 C+ :ShipDate,
0235.00 C+ :OrderDate,
0236.00 C+ :CancelDate,
0237.00 C+ :BusinessUnit
0238.00 C/End-Exec
Inserteted Line EVAL FetchCode = SQLCOD

0239.00 C IF FetchCode = 0
0240.00 C*-----------------------------------------------

Next Question:
Is it okay to delete records from a LF that is just an alternate key of the
Original Physical file
In general I try to perform Updates directly on the Physical file and Use LF
for Input only Not sure why just something that I was told to do many years
ago and continue to try to do today
Is there a real reason or am I just making my life more difficult.

Thanks

Mike

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.