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
  • Verified Answer

    Place the common code required by both MAIN.cbl and SUB.cbl in a copybook and include it in each program using a COPY statement.

    e.g. COPY COMMONCODE.CPY.

    If the common code contains EXEC SQL statements you will need to include it rather than copy it to make it available to the SQL pre-compiler.

    e.g. EXEC SQL INCLUDE COMMONCODE.CPY END-EXEC.

Reply
  • Verified Answer

    Place the common code required by both MAIN.cbl and SUB.cbl in a copybook and include it in each program using a COPY statement.

    e.g. COPY COMMONCODE.CPY.

    If the common code contains EXEC SQL statements you will need to include it rather than copy it to make it available to the SQL pre-compiler.

    e.g. EXEC SQL INCLUDE COMMONCODE.CPY END-EXEC.

Children
No Data