Basic example: Creating and running “Hello World”

  1. Create the following Fortran program and name the source file hello.f:
          PRINT *, "Hello World!"
          END
    Note: Each line must have six blank spaces before the first text character.
  2. Compile the program:
    • If short invocation commands have been set up, enter the following command:
       xlf hello.f -o hello
    • If short invocation commands have not been set up, enter the following command:
       /opt/ibmcmp/xlf/10.1/bin/xlf hello.f -o hello
  3. Run the program by entering the following command:
      ./hello

    The result should be "Hello World!".

  4. Check the exit code of the program by entering the following command:
      echo $?

    The result should be 0.