PERFORM a paragraph in other file ?

Hi everybody.

I have 2 files as below :

1. MAIN.cbl 

2. SUB.cbl

In MAIN.cbl :

CALL 'SUB'.

PERFORM  HELLO-PAR.

   HELLO-PAR.

   display 'HELLO EVERYBODY'.

In SUB.cbl : I want use HELLO-PAR paragraph and don't want code again it. I try to PERFORM HELLO-PAR but have error.

How do this ? Plz show me. Thanks !  

Parents
  • Thanks for your reply.

    By the way, I have other example.

    My project have many files (MAIN.cbl, SUB1.cbl ...) which use COBOL interact with DB2. In each file, must check error sql as below :  

              CHECK-SQL-ERROR-PAR.

              IF (sqlcode not = 0)

                   DISPLAY "Error: SQL error"

                   DISPLAY sqlcode

              END-IF.

    If write this code in SUB2, how to call SUB2 and pass sqlcode from MAIN or SUB1 ?

Reply
  • Thanks for your reply.

    By the way, I have other example.

    My project have many files (MAIN.cbl, SUB1.cbl ...) which use COBOL interact with DB2. In each file, must check error sql as below :  

              CHECK-SQL-ERROR-PAR.

              IF (sqlcode not = 0)

                   DISPLAY "Error: SQL error"

                   DISPLAY sqlcode

              END-IF.

    If write this code in SUB2, how to call SUB2 and pass sqlcode from MAIN or SUB1 ?

Children
No Data