Using the Library Routine Type Definitions and Call Prototypes

Two copyfiles are supplied with this system; one contains data items used by the library routines specified as type definitions, or TYPEDEFs, while the other contains call prototypes for the library routines. These can be used in your COBOL programs to enable the Compiler to validate all calls to these routines.

We provide the file cbltypes.cpy, which contains all types required by the system library routines. In order to avoid conflict with data-names contained within your program, all TYPEDEF names include the prefix CBLT-. Where the types are not elementary items, any subordinate elements have the prefix CBLTE-.

We also provide the file cblproto.cpy, which contains all prototypes of the system library routines. In some cases, these prototypes have parameters declared as ANY; this is usually when variable length data is required as input.

In the descriptions of the parameters for the library routines, references to the system-defined USAGE types have the prefix CBLT-, while subordinate items have the prefix CBLTE-. If you declare variables using the new USAGE types, you do not declare the subordinate items; you can, however, use the subordinate items anywhere that variable usage is allowed. If you declare more than one variable of the same type which contains subordinate items, then you must use qualification in order to tell the compiler which variable you intend to reference, as each group variable will have subordinate items of the same name. If, for whatever reason, you decide not to use the new USAGE types defined in cbltypes.cpy, you must declare a group item and all the listed subordinate variables explicitly; in this case you can give the subordinate variables any name you want.

In your programs, you need only specify the copyfile cblproto.cpy; you must specify it before the Identification Division of your program. You do not need to specify the copyfile cbltypes.cpy, as this is included in cblproto.cpy.

For an extended example of using call prototypes, see Call Prototypes.

Note:

The call prototypes apply only to call-by-name routines (those of the form CBL_name_name), not to the call-by-number routines (those of the form X"NN").

Below is an example of the use of these prototypes in a program. If the file mymain.cbl exists the program displays its size:

 copy "cblproto.cpy".
 
 program-id. MYMAIN.
 working-storage section.
 01  .
     05  file-details    cblt-fileexist-buf.
 procedure division.
     call 'CBL_CHECK_FILE_EXIST' using 'mymain.cbl '
                                       file-details
     if  return-code not = 0
       display 'File mymain.cbl does not exist (or error)'
     else
       display 'File mymain.cbl size is '
               cblte-fe-filesize of file-details
     end-if
 end program MYMAIN.