Previous Topic: @MODIFY (LRF) Status CodesNext Topic: #MREQ—determines how data is transferred


@MODIFY (LRF) Example

The sample code shown below illustrates the steps taken to modify an occurrence of the EMPSKLLR logical record. Assume that the department name for department 1200 is to be changed, as well as the maximum salary for a specific job working in this department (job identification number 5051).

  1. Retrieve the desired logical record:
    @OBTAIN FIRST,REC=EMPSKLLR,                              *
          WHERE DEPTID EQ '1200'                             *
          AND JOBID EQ '5051'
    
  2. Update the JOBNAME and MAXSAL fields by moving the new department name and the revised maximum salary to the proper fields in the obtained DEPJOBLR logical record:
    MVC   JOBNAME,NEWNAME
    MVC   MAXSAL,NEWSAL
    
  3. Issue the @MODIFY statement for the update EMPSKLLR logical record:
    @MODIFY REC=EMPSKLLR