Document revision date: 15 July 2002 | |
Previous | Contents | Index |
This section briefly describes the options associated with the record
retrieval services (Find and Get), the record insertion service (Put),
the record modification service (Update), and the record deletion
service (Delete).
9.3.1 Record Retrieval Options
The Find and Get services (or the equivalent language statements) can be used to locate and retrieve a record.
The options associated with the Find and Get services are summarized in the following table. These options can be set for each Find or Get service if the program can access the appropriate RAB control block fields. The RAB control block fields are preset by connect-time values or defaults and as a result of previous service calls.
The Put service (or equivalent language statement) adds a record to the file.
The options associated with the Put service are summarized in the following table. These options can be set for each Put service if the program can access the appropriate RAB control block fields. The RAB control block fields are preset by connect-time values or defaults and as a result of previous service calls.
Option | Description |
---|---|
Asynchronous record
processing |
Specifies that record I/O for this record stream is done asynchronously.
|
Key buffer |
Specifies key buffer that must contain the desired record's relative
record number when adding records randomly to a relative file.
|
Key size |
Specifies a field that must have a value of 4 (the default value
provided by RMS) when adding records to a relative file using random
record access.
|
Load buckets |
Fills the buckets to the level specified when the file is created. The
default is that buckets fill completely before a bucket split occurs.
|
Read allowed |
Allows the locked record being written to be read.
|
Record access |
Specifies the way records are added, sequentially according to
ascending key value or relative record number, randomly by key (indexed
files) or by record number (relative files), or randomly by RFA.
|
Record header buffer |
Contains the symbolic address of the record header buffer that contains
the fixed portion of a VFC record. Applies to the Get service only.
|
Record buffer
address |
Specifies the address of the record buffer that contains the record to
be written.
|
Record buffer size |
Specifies the size of the record contained in the record buffer to be
written.
|
Timeout period |
Specifies a timeout period after which an error is returned when you
choose the wait-if-locked option. The number of seconds is specified by
the CONNECT TIMEOUT_PERIOD or the RAB$B_TMO field to eliminate a
potential deadlock.
|
Truncate on Put |
Specifies that the file is truncated at the record being added.
Requires sequential record access and only applies to sequential files.
|
Update-if |
Turns the Put service into an update operation if the record already
exists in the file. Care must be taken when using this option with
shared files and automatic record locking (see Section 8.1). When
using this option with indexed files, note that the file must not allow
duplicates for the primary key. This option can only be used when
random record access has been specified.
|
Write-behind |
Improves performance at the expense of additional memory for I/O
buffers. Requires sequential record access and only applies to
sequential files.
|
The Update service (or equivalent language statement) modifies an existing record in a file. Your program must first locate the appropriate record position and optionally retrieve the record itself by calling the Find or Get service (or equivalent language statement).
The options associated with the Update service are summarized in the following table. These options can be set for each Update service if the program can access the appropriate RAB control block fields. The RAB control block fields are preset by connect-time values or defaults and as a result of previous service calls.
The Delete service (or equivalent language statement) removes a record from the file. You cannot use this service for sequential files; however, a sequential file can be truncated using the Truncate service. Like the Update service, the Delete service must be preceded by a Find or Get service to establish the current record position.
The options associated with the Delete service are summarized in the following table. These options can be set for each Delete service if the program can access the appropriate RAB control block fields. The RAB control block fields are preset by connect-time values or defaults and as a result of previous service calls.
9.4 Run-Time Example
Example 9-2 shows how to invoke the FDL$PARSE and FDL$RELEASE
routines to use the predefined control block values set by an Edit/FDL
utility editing session.
Example 9-2 Using the FDL$PARSE and FDL$RELEASE Routines |
---|
; ; This program calls the FDL utility routines FDL$PARSE and ; FDL$RELEASE. First, FDL$PARSE parses the FDL specification ; PART.FDL. Then the data file named in PART.FDL is accessed ; using the primary key. Last, the control blocks allocated ; by FDL$PARSE are released by FDL$RELEASE. ; .TITLE FDLEXAM ; .PSECT DATA,WRT,NOEXE ; MY_FAB: .LONG 0 MY_RAB: .LONG 0 FDL_FILE: .ASCID /PART.FDL/ ; Declare FDL file REC_SIZE=80 LF=10 REC_RESULT: .LONG REC_SIZE .ADDRESS REC_BUFFER REC_BUFFER: .BLKB REC_SIZE HEADING: .ASCID /ID PART SUPPLIER COLOR /[LF] ; .PSECT CODE ; ; Declare the external routines ; .EXTRN FDL$PARSE, - FDL$RELEASE ; .ENTRY FDLEXAM,^M<> ; Set up entry mask PUSHAL MY_RAB ; Get set up for call with PUSHAL MY_FAB ; addresses to receive the PUSHAL FDL_FILE ; FAB and RAB allocated by CALLS #3,G^FDL$PARSE ; FDL$PARSE BLBS R0,KEY0 ; Branch on success BRW ERROR ; Signal error ; KEY0: MOVL MY_FAB,R10 ; Move address of FAB to R10 MOVL MY_RAB,R9 ; Move address of RAB to R9 MOVL #REC_SIZE,RAB$W_USZ(R9) MOVAB REC_BUFFER,RAB$L_UBF(R9) $OPEN FAB=(R10) ; Open the file BLBC R0,F_ERROR $CONNECT RAB=(R9) ; Connect to the RAB BLBC R0,R_ERROR PUSHAQ HEADING ; Display the heading CALLS #1,G^LIB$PUT_OUTPUT BLBC R0,ERROR BRB GET_REC ; Skip error handling ; F_ERROR: BRW FAB_ERROR R_ERROR: BRW RAB_ERROR ; GET_REC: $GET RAB=(R9) ; Get a record CMPL #RMS$_EOF,R0 ; If not end of file, BEQLU CLEAN ; continue BLBC R0,R_ERROR MOVZWL RAB$W_RSZ(R9),REC_RESULT ; Move a record into PUSHAL REC_RESULT ; the buffer CALLS #1,G^LIB$PUT_OUTPUT ; Display the record BLBC R0,ERROR BRB GET_REC ; Get another record ; CLEAN: $CLOSE FAB=(R10) ; Close the FAB BLBC R0,FAB_ERROR PUSHAL MY_RAB ; Push RAB address on stack PUSHAL MY_FAB ; Push FAB address on stack CALLS #2,G^FDL$RELEASE ; Release the control blocks BLBC R0,ERROR BRB FINI ; Successful completion ; FAB_ERROR: PUSHL FAB$L_STV(R10) ; Signal file error PUSHL FAB$L_STS(R10) BRB RMS_ERR ; ERROR: PUSHL R0 ; Signal error CALLS #1,G^LIB$SIGNAL $CLOSE FAB=(R10) BRW FINI ; End program ; RAB_ERROR: PUSHL RAB$L_STV(R9) ; Signal record error PUSHL RAB$L_STS(R9) ; RMS_ERR: CALLS #2,G^LIB$SIGNAL ; FINI: RET .END FDLEXAM |
Previous | Next | Contents | Index |
privacy and legal statement | ||
4506PRO_027.HTML |