Previous Topic: @MODIFY Status CodesNext Topic: @MODIFY (LRF)—changes field values of an existing logical-record occurrence


@MODIFY Example

The following example illustrates the steps involved in modifying an occurrence of the EMPLOYEE record. Assume that the employee name is to be changed. The first step is to retrieve the desired EMPLOYEE record and move its contents to variable storage by using the statements shown below:

MVC   EMPID,INEMPID
@OBTAIN CALC,REC='EMPLOYEE'

The next step is to update the value of the EMPLOYEE field by moving the new employee name into the proper location in the EMPLOYEE record:

MVC   EMPNAME,NEWNAME

The final step is to issue an @MODIFY statement to return all data items in the EMPLOYEE record to the database:

@MODIFY REC='EMPLOYEE'