MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » October 2012

Re: Quick file changes



fixed

John,

IIRC, a SQL statement can be quite long, even inside a source member. The
real limit is in the length of a particular line. You can, of course, split
your statement into several lines.

When I have this type of requirements (eg., multiple DELETEs), I like to
encapsulate my SELECT into a view. That way, I can check if my logic is
sound. Using Charles's idea, you could write something like the following:

*********

CREATE VIEW MYLIB/MYVIEW AS(
SELECT * FROM BSYSQSP2
WHERE QSSEC2 <> 'xxxx'
AND QSFN01 in (
'FUNCTION'
, 'FUNCTION2'
, 'FUNCTION3'
)
);
*********
That way you could check your statement with:
SELECT * FROM MYLIB/MYVIEW

Backup your data (just in case, as we IT people NEVER, EVER do mistakes
:-) )
CREATE TABLE MYLIB/MYBACKUP AS (
SELECT * FROM Mylib/MyView
) With Data ;

And delete your records:

DELETE FROM

Luis Rodriguez
IBM Certified Systems Expert — eServer i5 iSeries





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact