The MODIFY option of the CA-Datamacs/II interface is designed to modify the data in existing tables. Support is provided to delete and update records consistent with the user security restrictions of the tables, as specified in the CA-DATACOM/DB Security Facility.
To establish exclusive control on the database record prior to issuing an UPDATE or DELETE command, a READ or SCAN command with the HOLD option must be specified.
The following example illustrates using CA-Datamacs/II to delete one record from a single CA-DATACOM/DB database table.
*DM TBLSZE IS 10.
IDENTIFICATION DIVISION.
PROGRAM-ID. Datamacs.
AUTHOR. CA-DATACOM/DB INTERFACE.
REMARKS. MODIFY DESIGN
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
*DM GENERATE ALL RECORDS.
*DM PRINT ALL RECORDS.
*DM DATACOM MODIFY DATABASE NAME IS x------------------------x.
*DM START.
*DM READ AND HOLD EQ EMPLOYEE USING KEY '5286'
*DM NOT-FOUND GO TO FINISH.
*DM DELETE EMPLOYEE.
*
DATA DIVISION.
WORKING-STORAGE SECTION.
*
*DM COPY TABLE NAME IS EMPLOYEE
*DM ELEMENT element-name1,element-name2
*DM KEY-NAME IS EMP-KEY
*DM SUPPRESS.
*DM END-COPY.
*
PROCEDURE DIVISION.
Programming Notes:
If found, the employee record with a key of 5286 will be deleted.
Because no GO TO paragraph-name was coded after the DELETE command and the single key option of the READ command was chosen, the job will end normally after the successful DELETE operation.
| Copyright © 2009 CA. All rights reserved. | Tell Technical Publications how we can improve this information |