Previous Topic: BIND PROCEDURENext Topic: Managing Queued Resources


ACCEPT PROCEDURE CONTROL LOCATION

You can use the ACCEPT PROCEDURE CONTROL LOCATION statement to return a copy of the data bound to a database procedure to a specified location in program variable storage. A BIND PROCEDURE statement previously placed information into this block; this information may have been subsequently updated by the procedure.

ACCEPT PROCEDURE CONTROL LOCATION should be used by programs running under, but in a different region/partition from, the central version.

Example of Communicating With a Database Procedure

The program excerpt below shows the use of the BIND PROCEDURE and the ACCEPT PROCEDURE CONTROL LOCATION statements.

The BIND PROCEDURE statement is issued only once; the ACCEPT PROCEDURE CONTROL LOCATION statement is issued after STORE processing to return information from the user-written procedure. The database procedure itself is transparent to your application.

 DATA DIVISION
 WORKING-STORAGE SECTION.
 01  CHECKID                 PIC X(8)     VALUE 'CHECKID'.
 01  CHECKID-CTRL.
     05 CHECKID-DATE         PIC X(8).
     05 CHECKID-USER         PIC X(32).
     05 CHECKID-INFO         PIC X(216).
 PROCEDURE DIVISION.
          .
          .
     READ NEW-EMP-FILE-IN.
          AT END MOVE 'Y' TO EOF-SW.
*** ESTABLISH COMMUNICATION AND TRANSFER INFO TO ***
*** THE APPLICATION PROGRAM INFORMATION BLOCK    ***
     BIND PROCEDURE FOR CHECKID TO CHECKID-CTRL.
   PERFORM A300-STORE-EMP THRU 0300-EXIT
                        UNTIL END-OF-FILE.
*** MOVE DATA FROM THE PROCEDURE TO ***
*** PROGRAM VARIABLE STORAGE        ***
     ACCEPT CHECKID-CTRL FROM CHECKID PROCEDURE.
   PERFORM U100-WRITE-PROC-INFO.
     FINISH.
     GOBACK.
 A300-STORE-EMP.
          .
*** ESTABLISHING CURRENCY AND INITIALIZATION FOR STORE ***
          .
     STORE EMPLOYEE.
     PERFORM IDMS-STATUS.
     PERFORM U500-WRITE-NEW-EMP-REPORT.
 A300-GET-NEXT.
     READ NEW-EMP-FILE-IN
          AT END MOVE 'Y' TO EOF-SW.
 A300-EXIT.
     EXIT.
 U100-WRITE-PROC-INFO.
     DISPLAY '**** STORE PROCEDURE INFORMATION ****'
             'DATE ' CHECKID-DATE
             'USER'  CHECKID-USER
             'INFO FOLLOWS: ' CHECKID-INFO.