Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Compiler-directing statements

Several compiler-directing statements and one compiler directive help you to direct the compilation of your program.

These are the compiler-directing statements and directive:

*CONTROL (*CBL) statement
This compiler-directing statement selectively suppresses output or causes output to be produced. The keywords *CONTROL and *CBL are synonymous.
>>CALLINTERFACE directive
This compiler directive specifies the interface convention for calls, including whether argument descriptors are to be generated. The convention specified with >>CALLINTERFACE is in effect until another >>CALLINTERFACE specification is made. >>CALLINT is an abbreviation for >>CALLINTERFACE.

>>CALLINTERFACE can be used only in the PROCEDURE DIVISION.

The syntax and usage of the >>CALLINTERFACE directive are similar to that of the CALLINT compiler option. Exceptions are:

If you specify >>CALLINT with no suboptions, the call convention used is determined by the CALLINT compiler option.

For example, if PROG1 is a COBOL program compiled with the ENTRYINT(OPTLINK) option, you could use the >>CALLINT OPTLINK directive to change the interface only for the PROG1 call:

>>CALLINT OPTLINK DESC
CALL “PROG1” USING PARM1 PARM2.
>>CALLINT
CALL “PROG2” USING PARM1.

The >>CALLINT directive can be specified anywhere that a COBOL procedure statement can be specified. For example, this is valid syntax:

MOVE 3 TO
>>CALLINTERFACE SYSTEM
RETURN-CODE.

The effect of >>CALLINT is limited to the current program. A nested program or a program compiled in the same batch inherits the calling convention specified with the CALLINT compiler option, but not a convention specified with the >>CALLINT compiler directive.

If you are writing a routine that is to be called with >>CALLINT SYSTEM DESCRIPTOR, this is the argument-passing mechanism:

This image shows the CALLINT SYSTEM DESC argument-passing mechanism.
Link to detail.
pointer to descr-n
Points to the descriptor for the specific argument; 0 if no descriptor exists for the argument.
descriptor-ID
Set to COBDESC0 to identify this version of the descriptor, allowing for a possible change to the descriptor entry format in the future.
descType
Set to X'02' (descElmt) for an elementary data item of USAGE DISPLAY with PICTURE X(n) or USAGE DISPLAY-1 with PICTURE G(n) or N(n). For all others (numeric fields, structures, tables), set to X'00'.
dataType
Set as follows:
  • descType = X'00': dataType = X'00'
  • descType = X'02' and the USAGE is DISPLAY: dataType = X'02' (typeChar)
  • descType = X'02' and the USAGE is DISPLAY-1: dataType = X'09' (typeGChar)
descInf1
Always set to X'00'.
descInf2
Set as follows:
  • If descType = X'00'; descInf2 = X'00'
  • If descType = X'02':
    • If the CHAR(EBCDIC) option is in effect and the argument is not defined with the NATIVE option in the USAGE clause: descInf2 = X'40'
    • Else: descInf2 = X'00'
length-1
In the argument descriptor is the length of the argument for a fixed-length argument or the current length for a variable-length item.
length-2
The maximum length of the argument if the argument is a variable-length item. For a fixed-length argument, length-2 is equal to length-1.
 
COPY statement
COPY statement syntax
Read syntax diagramSkip visual syntax diagram>>-COPY-+-text-name-+-+--------------------------+-------------->
        '-literal-1-' '-+-OF-+--+-library-name-+-'  
                        '-IN-'  '-literal-2----'    
 
>--+----------+--+-----------------------------------------+---><
   '-SUPPRESS-'  |            .--------------------------. |  
                 |            V                          | |  
                 '-REPLACING----operand-1--BY--operand-2-+-'  
 

This compiler-directing statement places prewritten text into a COBOL program. You must specify a text-name (the name of a copybook) that contains the prewritten text; for example, COPY my-text. You can qualify text-name with a library-name; for example, COPY my-text of inventory-lib. If text-name is not qualified, a library-name of SYSLIB is assumed. The following affects library-name and text-name:

library-name

If you specify library-name as a literal, the content of the literal is treated as the actual path. If you specify library-name as a user-defined word, the name is used as an environment variable and the value of the environment variable is used for the path to locate the copybook. To specify multiple path names, delimit them with a semicolon (;).

If you do not specify library-name, the path used is as described under text-name.

text-name

If you specify text-name as a user-defined word, processing depends on whether the environment variable that corresponds to text-name is set. If the environment variable is set, the value of the environment variable is used as the file-name, and possibly the path name, for the copybook.

A text-name is treated as an absolute path if all three of these conditions are met:

For example, these are treated as absolute paths:

COPY “\mycpylib\mytext.cpy” or COPY “d:\mycpylib\mytext.cpy”

If the environment variable that corresponds to text-name is not set, the search for the copybook uses the following names:

  1. text-name with extension .cpy
  2. text-name with extension .cbl
  3. text-name with extension .cob
  4. text-name with no extension

For example, COPY MyCopy searches in the following order:

  1. MYCOPY.cpy (in all the specified paths, as described above)
  2. MYCOPY.cbl (in all the specified paths, as described above)
  3. MYCOPY.cob (in all the specified paths, as described above)
  4. MYCOPY (in all the specified paths, as described above)

-I option

For other cases (when neither a library-name nor text-name indicates the path), the search path is dependent on the -I option.

To have COPY A be equivalent to COPY A OF MYLIB, specify -I%MYLIB%.

Based on the above rules, COPY “\X\Y” will be searched in the root directory, and COPY “X\Y” will be searched in the current directory.

COPY A OF SYSLIB is equivalent to COPY A. The -I option does not affect COPY statements with explicit library-name qualifications besides those with the library name of SYSLIB.

If both library-name and text-name are specified, the compiler inserts a path separator (\) between the two values if library-name does not end in a \. For example, COPY MYCOPY OF MYLIB with the settings of:

SET MYCOPY=MYPDS(MYMEMBER)
SET MYLIB=MYFILE

results in MYFILE\MYPDS(MYMEMBER).

PROCESS (CBL) statement
This compiler-directing statement, which you can place before the IDENTIFICATION DIVISION header of an outermost program, specifies compiler options that are to be used during compilation of the program.

related tasks
Changing the header of a source listing
Compiling from the command line
Specifying compiler options with the PROCESS (CBL) statement

related references
cob2 options
Call interface conventions
CALLINTERFACE directive (COBOL for Windows Language Reference)
CBL (PROCESS) statement (COBOL for Windows Language Reference)
*CONTROL (*CBL) statement (COBOL for Windows Language Reference)
COPY statement (COBOL for Windows Language Reference)


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)