Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

5.3.6 The #INCLUDE Statement

Use the #INCLUDE statement to merge source lines from another file into the source code you are working on at the position of the #INCLUDE statement. The line number of the original statement is replaced with the line number of the statement that results from an operation, such as MOVE.

The #INCLUDE statement is analogous to the COPY statement. The compiler copies the contents of the 'included file-name' into the program at the point where the statement occurs. The contents of the file are treated as additional program source.

The difference between the #INCLUDE and COPY statements relate to the fact that PowerCOBOL uses a preprocessor to turn your program code into an actual COBOL program. #INCLUDE statements are processed by the preprocessor, immediately (during preprocess time), while COPY statements are ignored by the preprocessor and passed onto the COBOL compiler to deal with.

5.3.6.1 Syntax

 #INCLUDE "INCLUDE FILE-NAME"

5.3.6.2 Syntax and Usage Rules

5.3.6.3 General Rules

5.3.6.4 Example

DATA DIVISION.                                                 
  WORKING-STORAGE SECTION.                                     
  * Get the #INCLUDE file to the data control                     
  #INCLUDE "NUMDATA.COB".                                      
  PROCEDURE DIVISION.                                          
    MOVE WK-1 TO POW-FONTSIZE OF LABEL1.                       
     :                                                         
                                                               
  +--- The contents of NUMDATA.COB file  -------------------+  
  |                                                         |  
  |000100 01 WK-G.                                          |  
  |000200   02 WK-D1 PICTURE IS S9(4) USAGE IS DISPLAY.     |  
  |000300   02 WK-D2 PICTURE IS S9(4) USAGE IS DISPLAY.     |  
  |000400 02 WK-1 PICTURE IS S9(9) USAGE IS BINARY.         |  
  |000500 02 WK-2 PICTURE IS S9(9) USAGE IS PACKED-DECIMAL. |  
  |                                                         |  
  +---------------------------------------------------------+