Top
PowerCOBOL V11.0 Reference
FUJITSU Software

5.82.1 Example of the RewriteRecord Method

The code below shows how to access a table whose structure is:

"JOB_ID" S9(3)<= Specified as the key field
"FUNCTION" X(30)

 DATA			DIVISION.
 WORKING-STORAGE	SECTION.
 01 ReturnValue		PIC S9(9) COMP-5.
 PROCEDURE		DIVISION.
*> Connect with the database.
*> The return value of the method is stored in ReturnValue.
	INVOKE CmDb1 "OpenDB" RETURNING ReturnValue.
*> Process the return value.
	:
*> Set "JOB_ID" to 500. (key field)
*> Set "FUNCTION" to "DRIVER".
	MOVE 500      TO "JOB_ID"    OF CmDb1.
	MOVE "DRIVER" TO "FUNCTION" OF CmDb1.
*> If "JOB_ID" field of the record is 500, "FUNCTION" field of the 
*>  record is set to "DRIVER".
	INVOKE CmDb1 "RewriteRecord" RETURNING ReturnValue.
*> Process the return value.
	:
*> Release the database connection.
	INVOKE CmDb1 "CloseDB".