On Wed, May 12, 2010 at 4:40 PM, CRPence <CRPbottle@xxxxxxxxx> wrote:
Charles Wilt wrote:

delete from mytable
  where datefld <= CURRENT_DATE - 1 month
     and Delete_Zip_File(char(datefld,ISO)) = '0';

Anybody see a problem with this?  (hint consider non short circuit
evaluations ;)

  I have never used a function in selection, in the WHERE clause,
to implement the desired EXTERNAL ACTION.  I have only used such a
function for the actual selected rows; i.e. SELECT UDFname().

  AFaIK there is no means to ensure that a function would not be
called in order to evaluate the predicate for every row; i.e. in the
case of deleting a file, I was never confident that any additional
selection within the same statement would preclude /illogical/
invocations of the function.

Yeah, as we were entering the statement into source, the lightbulb went off...

<grin>

  Of course same reason any standalone SELECT would not be allowed,
but I suspect you were aware of that.  As for resolution, the SELECT
can be part of a CREATE TABLE or INSERT INTO, or to effect just one
row for a VALUES INTO just make the statement select the SUM of the
function result against each selected row.

Now that might be an idea.


Anyway, the developer is looking at just using RPG RLA to delete
the rows, calling the CL program normally when the date changes.

  Nothing wrong with that.  However why call a CLP to invoke a CL
command which [effectively] just calls the API to effect the
remove\delete?  Just invoke the API to delete the file.


Mainly because the CL was already written, but also because the
developer in question has no experience with APIs...

However, this might be a good introduction and really the API use woul
dhave lets hoops to jump through than the CL.

Thanks for the ideas Chuck!

Charles Wilt

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.