The following example shows the code that DB/Assist generates for a searched UPDATE statement named UpdateStaff in a SAM named ADMIN.
The sample code for the UpdateStaff statement consists of one action routine named EXECUTE_UpdateStaff.
action EXECUTE_UpdateStaff is
########################################################################
# DO NOT MODIFY THE DB/Assist GENERATED CODE BELOW
# SAM:ADMIN STMT:UpdateStaff 7/22/93 11:12:12
# UPDATE DB2ADMIN.STAFF
# SET ID = :ID_IV, NAME = :NAME_SV, DEPT = :DEPT_IV, JOB = :JOB_SV,
# YEARS = :YEARS_IV, SALARY = :SALARY_FV, COMM = :COMM_FV
# WHERE DB2ADMIN.STAFF.ID = :ID_IV
#
########################################################################
call EDB2Start(ADMINProgramID, Esqlca)
copy EDB2Allocate( 1, 8, 2) to EDB2RtnCode_IV
copy EDB2SetVariable(1, 0, 496, 4, ID_IV, EDB2NULL_IV) to EDB2RtnCode_IV
copy EDB2SetVariable(1, 1, 448, 9, NAME_SV, EDB2NULL_IV) to EDB2RtnCode_IV
copy EDB2SetVariable(1, 2, 496, 4, DEPT_IV, EDB2NULL_IV) to EDB2RtnCode_IV
copy EDB2SetVariable(1, 3, 448, 5, JOB_SV, EDB2NULL_IV) to EDB2RtnCode_IV
copy EDB2SetVariable(1, 4, 496, 4, YEARS_IV, EDB2NULL_IV) to EDB2RtnCode_IV
copy EDB2SetVariable(1, 5, 480, 8, SALARY_FV, EDB2NULL_IV) to EDB2RtnCode_IV
copy EDB2SetVariable(1, 6, 480, 8, COMM_FV, EDB2NULL_IV) to EDB2RtnCode_IV
copy EDB2SetVariable(1, 7, 496, 4, ID_IV, EDB2NULL_IV) to EDB2RtnCode_IV
copy EDB2Call(24, 2, 1, 0) to EDB2RtnCode_IV
if (Esqlca.Sqlcode < 0 ) then
copy true to EDB2Error_BV
call EDB2Stop()
action EDB2WheneverError
else
copy false to EDB2Error_BV
end if
call EDB2Stop()