如何使用CBL_EXEC_RUN_UNIT

时间:2013-10-04 14:57:15

标签: cobol

我们试图从程序A异步调用程序B. 当我们尝试使用CBL_EXEC_RUN_UNIT从prog A调用prog B时,它会给出以下错误

error code: 203, pc=43, call=1, seg=0
203     CALL parameter not supplied
Prog A:
       procedure division.
       00.
           display "INSIDE PROGRAM CALLPRG".
           string w-prog-name delimited by size
                  " " delimited size
                  w-a w-b delimited by size
                       into w-work
           initialize flags run-unit-id stack-size
           call "CBL_EXEC_RUN_UNIT" using w-work
                                     by value 11
                         by reference run-unit-id
                         by value stack-size flags
                                returning status-code
prog B:
       working-storage section.
       01 C pic 9(03).
       linkage section.
       01 A pic 9(02).
       01 B pic 9(02).
       procedure division using a b.
       00.
           display "INSIDE PROGRAM ADDTWO".
           display a.
           display b.
           add a b giving C.
           display "SUM IS ".
           display c.
           display "EXITING PROGRAM ADDTWO".
       ex.  exit.

我们正在使用微焦点COBOL。

2 个答案:

答案 0 :(得分:1)

203消息告诉您尚未正确使用PROCEDURE DIVISION上的项目。实际调用ADDTWO程序时,缺少一个或两个参数。

我不知道您是否在“命令行”中提供了两个参数,我不知道您是否正确提供它们以便能够调用ADDTWO。 ADDTWO将被认为是一个主程序。如何在运行环境(操作系统和Mi​​cro Focus的运行时)中为主COBOL程序提供多个参数值。

我不确定你应该以这种方式指定命令行的长度。文档中有不同的建议。

答案 1 :(得分:1)

尝试使用START语句进行多线程处理。

您可以在BASE\DEMO\MTHREAD\MTHREAD.CBL下的Cobol MicroFocus安装目录中找到示例。

使用START语句,您的代码将如下所示:

   IDENTIFICATION DIVISION.
   PROGRAM-ID.    PROGA.
   WORKING-STORAGE SECTION.

   01  THREAD-HANDLE              usage thread-pointer.

   77  W77-ACCEPT-KEY PIC X.

   01  W01-NUMBERS.
   03  Num1 Pic s9(005).
   03  Num2 Pic s9(005).

   PROCEDURE DIVISION.
   0000-MAIN SECTION.
   0000.
       MOVE 1 TO Num1.
       MOVE 2 TO Num2.

       START "PROGB"  USING W01-NUMBERS
                      IDENTIFIED BY THREAD-HANDLE.


       DISPLAY "Press any key to end me...".
       ACCEPT W77-ACCEPT-KEY.

       PERFORM 9999-FINISH-IT.
   0000-EXIT.
        EXIT.

   9999-FINISH-IT SECTION.
   9999.
       EXIT PROGRAM.
       STOP RUN.
   9999-EXIT.
        EXIT.

   END PROGRAM PROGA.

   IDENTIFICATION DIVISION.
   PROGRAM-ID.    PROGB.
   WORKING-STORAGE SECTION.

   77  W77-RESULT PIC S9(006).
   LINKAGE SECTION.

   01  W01-NUMBERS.
       03 Num1 Pic s9(005).
       03 Num2 Pic s9(005).

   PROCEDURE DIVISION USING W01-NUMBERS.
   0000-MAIN SECTION.
   0000.
       compute W77-RESULT = Num1 + Num2.
       DISPLAY "Hello from ProgB".
       Display "Result is: " W77-RESULT.

       PERFORM 9999-FINISH-IT.
   0000-EXIT.
        EXIT.

   9999-FINISH-IT SECTION.
   9999.
       EXIT PROGRAM.
       STOP RUN.
   9999-EXIT.
        EXIT.

   END PROGRAM PROGB.