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