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



I was thinking that this would be a Homes Simpson moment. I was
right. DOOOOOOOOH!

When I ran it with STRSQL the error was way more obvious. QSFN01 had
to be 'BOC151CL', not 'BOC151'.

So, I can do this two ways:

1) (the way I know) put the statements in a file and run multiple DELETES.
2) Put the functions and switch settings in a file as suggested by
Charles and run a single DELETE. Thing is, I did not specify that a
function and a matching switch setting were needed. I don't know how
to do that.

Guess I will just go with what I know. Only 29 delete lines.

Thanks. Too much weird stuff going on around here. Tomorrow is
another nightmare for others.

John McKee

On Wed, Oct 31, 2012 at 6:29 AM, <rob@xxxxxxxxx> wrote:
The message
Member BSYSQSP2 in SECWRK not journaled to journal *N.
BSYSQSP2 not valid for operation.
can be resolved by either
RUNSQLSTM ... COMMIT(*NONE)
or by adding WITH NC to the end of your sql statement.

Can you recreate the test environment (aka re add the deleted rows) and
see if
SELECT ...
FROM SECWRK/BSYSQSP2
WHERE QSSEC2 <> '@ADR' AND
QSFN01 = 'BOC151' AND QSSW01 = 'E'
returns rows?

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From: John McKee <jmmckee@xxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>,
Date: 10/30/2012 05:48 PM
Subject: Re: SQL and trigger s
Sent by: midrange-l-bounces@xxxxxxxxxxxx



Finally getting to try this. I wanted to use the file method. I
neglected to include an additional parameter in my example.

Needs to be:
DELETE FROM SECWRK/BSYSQSP2 WHERE QSSEC2 <> '@ADR' AND
QSFN01 = 'BOC151' AND QSSW01 = 'E'

Other values for QSFN01 have either no value for QSSW01 or some other
single character.

But, for the single situation above, joblog shows this:
Member BSYSQSP2 in SECWRK not journaled to journal *N.
BSYSQSP2 not valid for operation.
RUNSQLSTM command failed.
SQL0910 received by.....


I was working on a copy of the file. I copied the live file to the
test environment. All journalling is correct. It runs with no error.

But, the spool file has this:

SQL0100 Position 1 Row not found for DELETE
SQL7960 Commit complete


I remember seeing a message stating xx rows effected when I have used
STRSQL. The above suggests to me that it didn't work. I have checked
the field names and they are in the file.

Obviously, I am missing something else.

I can hear Homer Simpson coming.......


Thanks.

John McKee

On Mon, Oct 29, 2012 at 1:32 PM, Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:
SQL DELETE without a where clause theoretically means delete each row
one by one.

Originally, this is how the DB worked, meaning SQL deletes were far
slower than CLRPFM for example.

At v5r3 (?) IBM enhanced the SQL delete processing, from the manual:
An SQL DELETE statement that does not contain a WHERE clause will
delete all rows of a table. In this case, the rows may be deleted
using either a clear operation (if not running under commitment
control) or a change file operation (if running under commitment
control). If running under commitment control, the deletes can still
be committed or rolled back. This implementation will be much faster
than individually deleting each row, but individual journal entries
for each row will not be recorded in the journal. This technique will
only be used if all the following are true:
v The target table is not a view.
v A significant number of rows are being deleted.
v The job issuing the DELETE statement does not have an open cursor on
the file (not including pseudo-closed SQL cursors).
v No other job has a lock on the table.
v The table does not have an active delete trigger.
v The table is not the parent in a referential constraint with a
CASCADE, SET NULL, or SET DEFAULT delete rule.
v The user issuing the DELETE statement has *OBJMGT or *OBJALTER
system authority on the table in addition to the DELETE privilege.

If any of the above are true, then the DB falls back to the originally
row-by-row delete.

HTH,
Charles


On Mon, Oct 29, 2012 at 1:42 PM, John McKee <jmmckee@xxxxxxxxxxxxxx>
wrote:
Thanks Charles.

After I sent the email, I found the trigger program source. Looks
like all this one does is write add/chg/dlt to a log file. With that,
I thought the issues i had encountered with the SQL working but still
needing to touch things was also a trigger. Not in that case.

I would have thought that an SQL delete would not have worked, due to
the trigger. But, apparently it isn't an issue. Why doesn'r CPYF
MBROPTOPT(*REPLACE) fire the delete and add triggers? A reason not to
do so, would be a lot of additional overhead, therefore a performance
issue. Any other reason?

John McKee

On Mon, Oct 29, 2012 at 12:11 PM, Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:
The delete trigger is causing the problem...

Tables with a delete trigger don't allow the CLRPFM that implict in a
CPYF MBROPT(*REPLACE)

I think it will work if you can disable the trigger..

Another option, simply use SQL
delete from testfile

insert into testfile select * from prodfile

However, in either case you should figure out what the triggers do.
Perhaps you need them to fire, perhaps you don't want them to fire in
this scenario. Only you can figure that out.

Charles

On Mon, Oct 29, 2012 at 12:28 PM, John McKee <jmmckee@xxxxxxxxxxxxxx>
wrote:
I was attempting to copy a live data file to our test environment.
Process was intended to refresh the file so I could test the SQL
process to delete records later this week.

Well, first part is to save the test environment file. No issue.
Then, copy and replace records. Doesn't work.

File has three triggers on it. After insert, after update, and after
delete.

I am assuming I could disable the triggers in the test environment
and
then do the copy. Am I correct? And, on the live environment, would
I have to disable one or more triggers to use SQL to delete selected
rows?

Both questions are easily answered by me just doing this in the test
environment. My concern, though, is what might happen to the live
environment if I disable the triggers (all, or just one), do the SQL
delete. and reenable the triggers. I am concerned that I might
introduce an error that causes problems days later. While the system
is going away, a number of accounts will remain on the system to be
worked for some months. I don't want to trash something that will
cause bigger headaches.

I needed to change four fields in one data file. Tedious, as there
are five fields and fourty-eight records. I had "bright idea" - just
use an UPDATE. The contents were updated, sort of. But, when the
file is changed using the approved method, some other changes are
made. Bottom line was that the maintenance program had to be used to
finish the changes. At least that mess was easily fixed.

So, I would like to test the SQL on test environment, but need to
refresh the file. Can't because of the triggers. Will disable allow
CPYF to update the file? What of the triggers? No idea, at this
point, what they do.

Any suggestions?

John McKee
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.