Top
PowerCOBOL V11.0 Reference
FUJITSU Software

5.42.1 Example of the ExecuteDDECommand Method

This example shows how to use the ExecuteDDECommand method to open another Excel spreadsheet.

Assume that the properties currently set in the DDE control (CmDDE1), are:

	DDEServiceName: EXCEL
	DDETopicName:	  SYSTEM
	DDEItemName:      R1C1:R2C2
	DDEFormatName:  CF_TEXT
	DDELinkStyle:	   2 - Warm-Link

Place the following code in the form's Opened event procedure to be executed once to start the DDE session with Excel:

 	 ENVIRONMENT     DIVISION.
	 DATA            DIVISION.
	 WORKING-STORAGE SECTION.
	 PROCEDURE       DIVISION.
	     INVOKE CmDDE1 "Execute" USING "Excel c:\exceldde97.xls"
	                                   POW-SWSHOWNORMAL  
	                         RETURNING ReturnValue
	     INVOKE CmDDE1 "InitiateDDE" RETURNING ReturnValue

The following code instructs EXCEL to open another spreadsheet:

 	 ENVIRONMENT     DIVISION.
	 DATA            DIVISION.
	 WORKING-STORAGE SECTION.
	 01 Excel-Command	PIC X(128).
	 01 ReturnValue		PIC S9(9) COMP-5.
	 PROCEDURE       DIVISION.
	     MOVE Spaces TO Excel-Command
 	     MOVE "[OPEN(""C:\my.xls"")]" TO Excel-Command
	     INVOKE CmDDE1 "ExecuteDDECommand" USING Excel-Command
 	                                   RETURNING ReturnValue

ExecuteProcedure Method

Description:

Executes the database procedure defined in the TargetName property.

Used in controls:

DB Access

Used in objects:

None.

Parameters:

None.

Return value:

VT_I4 - ReturnValueS9(9) COMP-5

Zero or greater indicates normal completion.
Negative indicates an error.

Example:

See the ExecuteProcedure Example

Backward compatibility
method name:

None.

Example of the ExecuteProcedure Method

The code below shows how to invoke a procedure whose:

Input parameter field name is "ParamIN".
Output parameter field name is "ParamOUT".
Return value field name is "Ret_Val" .

 ENVIRONMENT		DIVISION.
 DATA			DIVISION.
 WORKING-STORAGE	SECTION.
 01 ReturnValue		PIC S9(9)COMP-5.
 01 WorkRetVal		PIC S9(9)COMP-5.
 01 WorkParamOUT	PIC S9(4)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 the input parameter to 1.
	MOVE 1 TO "ParamIN" OF CmDb1.
*> Execute the procedure.
*> The return value of the method is stored in ReturnValue.
	INVOKE CmDb1 "ExecuteProcedure" RETURNING ReturnValue.
*> Process the return value.
	:
*> Save the procedure's return value in WorkRetVal.
	MOVE "Ret_Val" OF CmDb1 TO WorkRetVal.
*> Save the procedure's output parameter in WorkParamOUT.
	MOVE "ParamOUT" OF CmDb1 TO WorkParamOUT.
*> Use WorkRetVal and WorkParamOUT for the application processing.
	:
*> Release the database connection.
	INVOKE CmDb1 "CloseDB".