Rational Developer for System z
PL/I for Windows, Version 7.6, Programming Guide

Program file structure

A PL/I application can consist of several compilation units. You must compile each compilation unit separately and then build the complete application by linking the resulting object files together.

A compilation unit consists of a main source file and any number of include files. You do not compile the include files separately because they actually become part of the main program during compilation. The compiler does not allow DBCS to be used in source file or include file names

If your program requires %PROCESS or *PROCESS statements, they must be the first lines in your source file. The first line after them that does not consist entirely of blanks or comments must be a PACKAGE or PROCEDURE statement. The last line of your source file that does not consist entirely of blanks or comments must be an END statement matching the PACKAGE or PROCEDURE statement.

The following examples show the correct way to format source files.

Using a PROCEDURE statement with PROCESS:

%PROCESS   ;
%PROCESS   ;
%PROCESS   ;

 /*  optional comments */

 procedure_Name: proc( ... ) options( ... );
   ...
 end procedure_Name;
Using a PACKAGE statement with PROCESS:

*PROCESS  ;
*PROCESS  ;
*PROCESS  ;

 /*  optional comments */

 package_Name: package exports( ... ) options( ... );
   ...
 end package_Name;

The source file in a compilation can contain several programs separated by *PROCESS statements. All but the first set of *PROCESS statements are ignored, and the compiler assumes a PACKAGE EXPORTS(*) statement before the first procedure.

INCLUDE processing

You can include additional PL/I files at specified points in a compilation unit by using %INCLUDE statements. For the %INCLUDE statement syntax, see PL/I Language Reference.

If you specify the file to be included using a string, the compiler searches for the file exactly as named in that string. If you specify an include file using one of the more traditional PL/I methods, however, by either using a ddname and member name or just a member name, the compiler appends a file extension to the member name.

You can specify which file extensions are appended to the member name by using the INCLUDE compiler option. For example, if you specify the INCLUDE option as INCLUDE(EXT(CPY)), when the compiler sees either of the following statements, it tries to include the file member.cpy.

The compiler searches for this file in the following order:

  1. The directories specified in the environment variable IBM.DDNAME, if the %include statement specified a ddname
  2. The directories specified in the environment variable IBM.SYSLIB
  3. The directories specified in the environment variable INCLUDE
  4. The current directory.

If you specify more than one extension in the INCLUDE compiler option, the compiler searches all the directories above using the first extension; then does another pass through all the same directories using the second extension, and so on.

%OPTION directive

The %OPTION directive is used to specify one of a selected subset of compile-time options for a segment of source code. The specified option is then in effect until one of the following occurs:

The compile-time options or directives that can be used with the %OPTION directive include:

See Compile-time option descriptions for option descriptions.

%LINE directive

The %LINE directive specifies that the next line should be treated in messages and in information generated for debugging as if it came from the specified line and file.

The characters '%LINE' must be in columns 1 through 5 of the input line for the directive to be recognized (and conversely, any line starting with these five characters is treated as a %LINE directive). The line-number must be an integral value of seven digits or less and the file-specification must not be enclosed in quotes. Any characters specified after the semicolon are ignored.

An example of what these lines should look like can be obtained by compiling a program with the options PPTRACE MACRO and MDECK.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)