Updating segments: REPL, DLET, ISRT, and FLD
You can use REPL
, DLET
, ISRT
, and
Field (FLD
) calls to update a Data entry database (DEDB) or a Main storage database
(MSDB). A single FLD
call does what a Get Hold call and a REPL
call do in two calls. FLD
calls are unique to DEDBs and MSDBs.
You can issue REPL
, DLET
, and ISRT
calls to
non-terminal-related MSDBs (without terminal-related keys) or DEDBs. You can issue
REPL
calls to related or nonrelated MSDBs. Before issuing these calls, you must
issue a Get Hold call for the segment that you want to update.
Alternatively, you can use a FLD call to access and change field contents within a segment.
The FLD
call has two types. FLD/VERIFY compares a target
segment field value to the value that you supply in a field search argument (FSA).
FLD/CHANGE changes the target segment field value to your specifications in the
FSA. A FLD/CHANGE
call succeeds only if the previous FLD/VERIFY
call succeeds.
FLD
calls can simplify some operations. For example, consider how to address the
following scenario, which is based on the ACCOUNT segment that is described in Database hierarchy examples. A bank must perform the following process to determine whether a
customer can withdraw a requested amount from their account:
- Retrieve the customer's account segment.
- Verify that the customer's account balance is greater than the requested withdrawal amount.
- Update the balance to reflect the withdrawal if the starting balance is greater than the requested withdrawal amount.
If you do not use FLD
calls, you must write a program to issue a
GU
call to retrieve the segment, verify its contents with program logic, and then
issue a REPL
call to update the balance to reflect the withdrawal.
If you issue FLD
calls with a root segment search argument (SSA), you can
retrieve, compare, and change the customer segment. Use a FLD/VERIFY
call to
compare the BALANCE field with the requested withdrawal amount. If the comparison is satisfactory,
use a FLD/CHANGE
call to update the BALANCE field.
The FLD
call SSA has the same format as SSAs for other calls. If no SSA exists,
the first segment in the DEDB or MSDB is retrieved.
The segment retrieved by a FLD
call is the same as the segment that can be
retrieved by a GHU
call. After the FLD
call, the position is lost.
An unqualified GN
call after a FLD
call returns the next segment
in the current area.
FLD
call cannot change the length of a compressed segment, even
if the segment is variable length. To make changes, you must issue a REPL
call.Sync point processing (SYNC
call) will fail if a FLD
call
that changes segment length is issued to a DEDB segment type that has a compression routine
specified. If the FLD
call is issued from a BMP region, the SYNC
call fails with status code FV
. If the FLD
call is issued from an
MPP or IFP region, the SYNC
call will ABEND U799 with RC 3.
FLD
call to any DEDB AREAGU
call with VIEW=MSDB or VIEW=MSDBL to Root Only DEDB AREA
GN
call.