HP 3000 Manuals

Writing to $STDLIST [ Accessing Files Programmer's Guide ] MPE/iX 5.0 Documentation


Accessing Files Programmer's Guide

Writing to $STDLIST 

You can write data from your program to your program's standard list
device $STDLIST using two intrinsics:

   *   PRINT

   *   FWRITE

Normally, $STDLIST for jobs is a line printer and for sessions a
terminal.  You can write a string of ASCII characters from an array in
your program to $STDLIST with the PRINT intrinsic.  You do not need to
use HPFOPEN/FOPEN to open the standard list device in order to use PRINT.


NOTE The PRINT intrinsic is limited in its usefulness in that FILE commands are not allowed. In addition, you cannot use the FCHECK intrinsic to determine error conditions encountered by PRINT. You may find it more convenient (and a better programming practice) to use the HPFOPEN/FOPEN intrinsic to open the file $STDLIST, then write to this file using FWRITE.
You can also use the FWRITE intrinsic to write data from your program to the standard list device $STDLIST, if you opened $STDLIST with HPFOPEN/FOPEN. In this case, the HPFOPEN/FOPEN call returns a file number that identifies $STDLIST. You would then write to $STDLIST sequentially using FWRITE. For more information about opening $STDLIST, refer to chapter 5, "Opening a File". Example 8-3 is an HP Pascal/iX code segment that contains a PRINT intrinsic call that transmits a message to $STDLIST. Example 8-3. Writing to $STDLIST Using PRINT : var message : packed array [1..72] of char; {declare PRINT parm} message_length : shortint; {declare PRINT parm} controlcode : 0..65535; {declare PRINT parm} : message := 'WRITING A MESSAGE TO THE STANDARD LIST DEVICE.'; message_length := -46 {message is 46 bytes long } control_code := 0; PRINT ( message, {message written to $STDLIST } message_length, {number of bytes in message } controlcode {set to default } ); : For more information about PRINT parameters, refer to the MPE/iX Intrinsics Reference Manual (32650-90028). In appendix A, "HP Pascal Program Examples," example A-2 uses the PRINT intrinsic to write messages to $STDLIST.


MPE/iX 5.0 Documentation