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




Michael,

Yes, you can save the SQLCOD value for comparison purposes. I have done
that in programs with multiple SQL statements and it worked fine.

I can't think of any reason you shouldn't use a logical file to delete
records. Their may be a database design rule being violated there that
I'm not aware of but no practical one that I can think of.

Rick

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Ala, Michael A
Sent: Wednesday, May 21, 2008 9:17 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: 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

Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.

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.