Mr. Pelkie states, in his article "Sorting It Out" (MC, September 1992), "...From the description of the OVRDBF command in the Command Reference, I am unable to understand the difference between the NBRRCDS and SEQONLY parameters...." I, too, have searched the IBM manuals for an answer to this question. The answer was provided by John Sears, a true guru of the AS/400 world. Refer to 1 as I explain the difference between the two parameters.
Mr. Pelkie states, in his article "Sorting It Out" (MC, September 1992), "...From the description of the OVRDBF command in the Command Reference, I am unable to understand the difference between the NBRRCDS and SEQONLY parameters...." I, too, have searched the IBM manuals for an answer to this question. The answer was provided by John Sears, a true guru of the AS/400 world. Refer to Figure 1 as I explain the difference between the two parameters.
When data is read from a file, either two or three movements occur, depending upon the language used. RPG requires three movements; COBOL, two movements. The three steps are:
1. Data is moved from auxiliary storage to a main storage I/O buffer. The NBRRCDS parameter controls the amount of data moved. The maximum amount moved is 32K. If the system detects sequential processing, two I/O buffers are used.
2. Data is moved from the I/O buffer to the job buffer in the program's open data path (ODP). The SEQONLY parameter controls the amount of data moved. A COBOL program can now access the data in the file description.
3. The data is moved from the job buffer to the input area of the program (input fields for RPG). Data is moved one record at a time as requested by the program.
The above steps occur in reverse logical order when data is written to a file. Data added or changed is not available to other jobs until the data is transferred to the I/O buffer. This fact explains why NBRRCDS is allowed in all file open modes (input, update or output) and SEQONLY is allowed only for files opened for input or, under certain conditions, output.
You may use either or both the NBRRCDS parameter and the SEQONLY parameter. The system will default both parameters and the defaults should generally provide adequate performance. 2 summarizes the defaults when processing a physical file or a logical file over one physical file.
You may use either or both the NBRRCDS parameter and the SEQONLY parameter. The system will default both parameters and the defaults should generally provide adequate performance. Figure 2 summarizes the defaults when processing a physical file or a logical file over one physical file.
TechTalk: Insight into File I/O
Figure 1 What happens when you read a file
Figure 1: What Happens When You Read a File Auxiliary Storage Main Storage Physical File I/O Buffer 1 ----------------------- Step 1 --------------------- R1 R2 R3 R4 R5 -------------> R1 R2 R3 R4 Step 2 R6 R7 R8 R9. . . || --------------------- ------ ----------------------- || I/O Buffer 2 || --------------------- -------> R5 R6 R7 R8 | --------------------- | PAG | --------------------- | Job Buffer | --------------------- | -------- R1 R2 R3 R4 <------- || ------------------- || Input Field || ------------------- -------> R1 -------------------- OVRBDF SEQONLY(*YES 4) NBRRCDS(4) File opened for input, sequential access.
TechTalk: Insight into File I/O
Figure 2 Using SEQONLY and NBRRCDS
Figure 2: Using SEQONLY and NBRRCDS Open Type and Access Method Parameter Defaults and Notes Input, Sequential SEQONLY defaults to the number of records that will fit into a 4K buffer. NBRRCDS defaults to the number of records specified or defaulted on the SEQONLY parameter. Two I/O buffers will be used. Input, Sequential by key SEQONLY defaults to the number of records that will fit into a 4K buffer. NBRRCDS defaults to 1. If the order of the physical file is the same as the keys, the programmer should specify a value for NBRRCDS. Input, Random SEQONLY is not allowed. NBRRCDS defaults to 1. Update, Sequential SEQONLY is not allowed. NBRRCDS defaults to 1. The programmer should specify a value for NBRRCDS. Update, Sequential by key SEQONLY is not allowed. NBRRCDS defaults to 1. If the order of the physical file is the same as the keys, the programmer should specify a value for NBRRCDS. Update, Random SEQONLY is not allowed. NBRRCDS defaults to 1. Output If the file does not require unique keys and no indexed logical files exists over the physical file, SEQONLY defaults to the number of records that will fit into a 4K buffer. NBRRCDS defaults to the number of records specified or defaulted on the SEQONLY parameter. Two I/O buffers will be used.
LATEST COMMENTS
MC Press Online