Output & Input control

To ensure that the output of your program goes to the screen regardless of the current target for STDOUT, use

 
  call lineOut "CON",,
    "This output always goes to the screen!"

  /* or */

    /* print a string to the screen */
  call LineOut "SCREEN$",,
    "This output goes to the screen"

To print messages to STDOUT or STDERR you can use these names for the output device. For example:

 
    /* print a string to STDERR */
  call LineOut "STDERR",,
    "This output goes to STDERR"

    /* print a string to STDOUT */
  call LineOut "STDOUT",,
    "This output goes to STDOUT"

To ensure that the input for your program comes from the keyboard regardless of the current source for STDIN use

 
  userInput = lineIn( "CON" )
  /* or */
  userInput = lineIn( "KBD$" )

Important: The functions LINEOUT and LINEIN use normal file handles for the output and input devices! Therefore, close the device with the STREAM function after using it! Note further that there's no way to print to the handles numbered 3 to 9 in REXX (at least I haven't found a way to do this).