Duane,

With all due respect to Mark, it is not the DBMS doing the blocking.
Now, given Mark's response, it may not be correct to say the RPG
program itself is doing it, but Barbara and the IBM document I
referenced have made it clear that when blocking is in use the records
don't get seen by the DBMS until the HLL program's buffers are
flushed.

Call it the RPG run time or OS services if you will, but it's not the
DB. If the DB could see the data, the OS wouldn't have to turn off
the blocking when there's a unique key or a trigger and you wouldn't
ever run into the issue where one program writes out the data but
another program doesn't see it.

Charles



On Fri, Dec 3, 2010 at 1:20 PM, Christen, Duane
<Duane.Christen@xxxxxxxxxx> wrote:
Charles,

Mark explained it better but RPG isn't doing the blocking the DBMS is, RPG is just telling the DBMS to block records if possible.

I've never thought about it before but if you could force the DBMS to block records on a table with a trigger I would still expect that any trigger would still fire for each individual record when RPG handed off control to the DBMS, not when the DBMS wrote the records to disk.

Duane Christen

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Friday, December 03, 2010 11:55 AM
To: RPG programming on the IBM i / System i
Subject: Re: FILE TRIGGER

Ok,

Put together a small test file, program and trigger...

If there's a trigger on a file, RPG will not block/buffer records
written to that file.  You'll see a CPF4028 - Open of member CMWTEST
was changed to SEQONLY(*NO).

Cause . . . . . :   Member CMWTEST file CMWTEST in library CTSC_W was opened
 with the SEQONLY(*YES) parameter specified in the program or on the Override
 Database File (OVRDBF) command. However, the parameter has been changed to
 SEQONLY(*NO) because of condition 8 shown below:

 8 - The file has referential constraints, triggers, or is a distributed
file. SEQONLY(*YES) was changed to SEQONLY(*NO) to allow the trigger
programs to be called or the referential constraints to be enforced on a
record by record basis, or because SEQONLY(*YES) is not allowed for the
distributed file open.


HTH,

Charles

On Fri, Dec 3, 2010 at 12:18 PM, Mark S. Waterbury
<mark.s.waterbury@xxxxxxxxxxxxx> wrote:
Ken:

In i5/OS or OS/400, you can always issue an OVRDBF at runtime, to
specify "blocking" or to change the "blocking factor" using the SEQONLY
parameter on the OVRDBF command, without ever having to change or
recompile your programs.

Write a small RPG/400 program that writes records to a file and compile
with CRTRPGPGM ... GENOPT((*LIST) and study the generated OPM MI
assembler language instructions in the listing spool file to see the
code that is generated for the I/O.  There is no code generated in the
program to do "blocking", and so, all blocking must be done by the
system, within the database I/O routines that are called from the
generated code.

Hope that helps,

Mark S. Waterbury

 > On 12/3/2010 10:51 AM, Ken Sims wrote:
Sorry Duane, but no, that does NOT make sense.  When a file is
blocked, the program holds the records in its own storage and does not
call database management until it is ready to write the block to the
file.

(This is all irrespective of when records are actually written to some
type of permanant media.)

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-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.