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



Charles;

From the document you referenced, use DBMS instead of system.
" Blocking is performed when the first I/O is performed after the open. The system reads a block of records into the system buffer (located in the Open Data Path (ODP) for that file) when the first read in the user's program is run and then moves the first of these records into the program buffer so the program can process that data. When the program next performs a read, the next record in the block is moved into the program buffer by the program (no system calls are made). When the block no longer contains records that the program has not processed, another call to the system is made, and another block of records is placed into the system buffer, the first of these is placed into the program buffer, and the cycle continues until the file is closed or the end of file is reached. If the program positions in the file and then does a read, the old block of records is discarded, and a new block of records is obtained.

Writes are essentially the same. The program fills the system buffer with some number of writes before a call to the system to write the block and the final block being written at file close time (if the last write did not happen to occur at a block boundary)."

Blocking may be an "extension" of the DBMS but it is still the DBMS. The HLL buffer only gets loaded with one record at a time, from the ODP, which may contain a block of records.

If you could force a table, with an active trigger attached, it would still have to fire the trigger at each individual I/O, otherwise your DB wouldn't be in a consistent state.

Duane Christen

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

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.