HPlogo Accessing Files Programmer's Guide > Chapter 8 Writing to a File

Writing Messages to the System Console

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 6 ♥
E0692 Edition 5

Two intrinsics are available that allow you to print a character string directly from your program to the system console:
  • PRINTOP transmits an ASCII character string from your program to the system console.

  • PRINTOPREPLY transmits an ASCII character string from your program to the system console, and solicits a reply from the system operator.

Writing a message to the system console


Example 8-4 is an HP Pascal/iX program segment that illustrates how your program can call the PRINTOP intrinsic to transmit a message from a character array in your program to the System Console.

Example 8-4. Writing a Message to the System Console

           .
           .
           .
  var
     message      : packed array [1..56] of char;
     length       : shortint;                 {declare PRINTOP parms}
     controlcode  : 0..65535;
           .
           .
           .
     message      := 'Message to Operator';     {message to transmit}
     length       := -19              {actual length in bytes       }
     controlcode  := 0;               {set to default               }
     PRINTOP ( message,
               length,
               controlcode
              );
           .
           .
           .

The PRINTOP intrinsic transmits a maximum of 56 ASCII characters to the system console. Longer messages are truncated to 56 characters. For more information about PRINTOP intrinsic parameters, refer to the MPE/iX Intrinsics Reference Manual.

Writing a message to the system console and requesting a reply


The PRINTOPREPLY intrinsic can be used to transmit a message from an array in your program to the system console and to request that a reply be returned. The message that you send must be no longer than 50 characters in length. PRINTOPREPLY can return a maximum of 31 ASCII characters to your program. For example, a program could ask the system operator if the line printer contains a certain type of form. If the response is affirmative, the program could then write information on these forms.

Example 8-5 is an HP Pascal/iX code segment containing a PRINTOPREPLY intrinsic call. The program is asking the system operator if the line printer device LP contains the correct forms. The program is requesting that the system operator respond with a simply YES or NO response. The program takes appropriate action based upon the characters returned in reply.

Example 8-5. Writing a Message to the System Console and Requesting a Reply

            .
            .
            .
   var
      message      : packed array [1..50] of char;
      length       : shortint;               {PRINTOREPLY parameters}
      zero         : shortint;
      reply        : packed array [1..31] of char;
      expected_length: shortint;
      counter
            .
            .
            .
      message      :=
        'Does device LP contain the correct forms? [Y/N]';
      length       := -47              {length of message           }
      zero         := 0;
      reply        := '   ';           {initialize reply            }
      expected_length := -3            {expected reply Y/YES/N/NO   }
      PRINTOREPLY ( message,         {message sent to system console}
                    length,        {length of message in range 0..50}
                    zero,          {required, but not used. Set to 0}
                    reply              {reply returned in this array}
                    expected_length  {length of reply in range 0..31}
                  );
            .
            .
            .

The actual length of the System Operator's reply is returned to expected_length. For more information about PRINTOREPLY intrinsic parameters, refer to the MPE/iX Intrinsics Reference Manual.




Writing to $STDLIST


Writing to a Magnetic Tape File