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

The HELLO program

Here are the steps to make a program that displays the character string "Hello!" on your computer screen.

1. Create the source program
Create a file, HELLO.PLI, with the following PL/I statements.
  Hello: proc options(main);
         display('Hello!');
  end Hello;

Leave the first space of every line blank: by default, the compiler only recognizes characters in columns 2-72. (For additional information, see MARGINS.)

Save the file to disk.

2. Compile the program
In a window or full-screen session, go to the directory that contains the HELLO.PLI file and enter the following command:
  pli hello

The compiler displays information about the compilation on your screen, and creates the object file (HELLO.OBJ) in the current directory.

3. Link the program
Without changing directories, enter the following command:
  ilink hello.obj

This combines the file HELLO.OBJ with needed library files (as specified by the LIBS compile-time option), producing the file HELLO.EXE (the executable program) in the same directory.

Since no parameters are specified with the link command, the defaults are used. (The options available with the link command are described in Linking your program.)

4. Run the program
Without changing directories, enter the following command:
  hello

This invokes the HELLO.EXE program, which displays Hello! on your monitor.

To make things easier, programmers often put the commands for compile, link, and run together in a command (CMD) file.


Terms of use | Feedback

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