Making batch data updates in IMS Universal DL/I driver applications
Use the batchUpdate method in the PCB interface to update multiple existing segments in the database with one call.
Procedure
- Obtain an SSAList instance from the PCB instance representing the database.
-
Optionally, you can add qualification statements to the SSAList method. See
Specifying segment search arguments using the SSAList interface
for more information. - Get a Path instance by using the SSAList instance from the previous steps and calling the getPathForBatchUpdate method.
- Using the Path instance from the step above, set the field values to update for the segments.
- Call the batchUpdate method to update the segments.
The following code fragment illustrates how to use the batchUpdate method to modify a
patient's name. The SSAList instance is set to update only records where the
patient name is ANDREA SMITH
, the ward name is SURG
, and the hospital name is
ALEXANDRIA
. The getPathForBatchUpdate method is called to obtain a Path
containing the PATIENT segment and its child segments. Finally, the batchUpdate
method is called to change the value of the patient name field to ANDREA TAYLOR
.
SSAList ssaList = pcb.getSSAList("HOSPITAL","PATIENT");
ssaList.addInitialQualification("HOSPITAL","HOSPNAME",SSAList.EQUALS,"ALEXANDRIA");
ssaList.addInitialQualification("WARD","WARDNAME",SSAList.EQUALS,"SURG");
ssaList.addInitialQualification("PATIENT","PATNAME",SSAList.EQUALS,"ANDREA SMITH");
Path path = ssaList.getPathForBatchUpdate("PATIENT");
path.setString("PATNAME", "ANDREA TAYLOR");
pcb.batchUpdate(path, ssaList);
Important: To persist changes made to the database, your application must call
the commit method prior to deallocating the PSB, otherwise the
changes are rolled back up to the last point the commit method was
called.