Declaration of file reference type host variables in COBOL embedded SQL applications

File reference type host variables that you declare in your embedded COBOL application are treated as if they were declared in a COBOL program. You can use host variables to exchange data between the embedded application and the database manager.

The syntax for declaring file reference host variables in COBOL is:

Read syntax diagramSkip visual syntax diagram01variable-nameUSAGEISSQL TYPE ISBLOB-FILECLOB-FILEDBCLOB-FILE.
  • SQL TYPE IS, BLOB-FILE, CLOB-FILE, DBCLOB-FILE can be either uppercase, lowercase, or mixed.

BLOB file reference example (other LOB types are similar):

Declaring:
    01 MY-FILE USAGE IS SQL TYPE IS BLOB-FILE. 
Results in the generation of the following declaration:
    01 MY-FILE. 
       49 MY-FILE-NAME-LENGTH PIC S9(9) COMP-5. 
       49 MY-FILE-DATA-LENGTH PIC S9(9) COMP-5. 
       49 MY-FILE-FILE-OPTIONS PIC S9(9) COMP-5. 
       49 MY-FILE-NAME PIC X(255).