TERMINALIO and TERMINALQIO VAX/VMS Terminal Input/Output Routines by Rodrick A. Eldridge Iowa State University - 1 - Overview This paper presents two modules containing routines which implement, in the MLR Macro Language, terminal I/O routines using RMS and QIO. These routines perform single character and line oriented terminal I/O on VAX/VMS. Notice In order to reassemble any of these routines, you must have the MLR Macro Language. The MLR Macro Language is a set of macros which implement structured programming in VAX-11 Macro. - 2 - RMS Terminal I/O Routines TerminalIo This routine initializes the RMS I/O routines. This routine is optional, and if not called explicitly, the other RMS Terminal I/O routines will call this routine implicitly. The TerminalIo routine requires no parameters. Read This routine returns a single character from the input device, i.e. SYS$INPUT. An entire line is read implicitly and kept internally. Each subsequent call to Read, returns the next single character in turn from this input buffer. If the last character of a line has been returned, the next Read will cause another line to be read and the above sequence is repeated. An end-of-file condition indicates that there are no more characters to return. The Read routine requires one parameter: o An address of a byte that will contain the returned character. ReadString This routine returns an entire line from the input device, i.e. SYS$INPUT. An entire line is read and each subsequent call to ReadString causes another line to be read. Any characters remaining in the internal input buffer will be lost. An end-of-file condition indicates that there are no more lines to be read. The ReadString routine requires one parameter: o An address of a string descriptor that will contain the returned string. - 3 - ReadAgain This routine resets the internal input position pointer of the current line being read to allow subsequent calls to Read to return characters from the start of input line. The ReadAgain routine requires no paraemeters. ReadLn This routine causes the remainder of the current input line to be ignored and causes the next input line from the input device, i.e. SYS$INPUT, to be read. Subsequent calls to Read will return characters from the start of this new input line. The ReadLn routine requires no parameters. Write This routine writes a single character to the output device, i.e. SYS$OUTPUT. These characters are placed in an internal output buffer and each subsequent call to Write will append each character to this buffer. To flush the buffer, issue a call to either the WriteLn or WriteString routines. The Write routine requires one parameter: o An address of a byte that contains the character to be written. WriteString This routine writes a line to the output device, i.e. SYS$OUTPUT. Any characters in the internal output buffer are written first. A carriage return and line feed is written prior to writting the output line. The WriteString routine requires one parameter: o An address of a string descriptor containing the string to be written. - 4 - WriteLn This routine flushes the internal output buffer. A carriage return and line feed is written prior to writting the output buffer. The WriteLn routine requires no parameters. - 5 - QIO Terminal I/O Routines TerminalQio This routine initializes the QIO I/O routines. This routine is optional, and if not called explicitly, the other QIO Terminal I/O routines will call this routine implicitly. The TerminalQio routine requires no parameters. Get This routine returns a single character from the input device, i.e. SYS$INPUT. An end-of-file condition indicates that there are no more characters to return. The Get routine requires three parameters: o An address of a word that will contain the QIO function modifiers. If no QIO function modifiers are required, specify either 0 as the value or pass 0 as the address. o An address of a string descriptor that contains the prompt string to be written prior to getting the character. If no prompt is required, pass 0 as the address. o An address of a byte that will contain the character to be returned. GetString This routine returns an entire line from the input device, i.e. SYS$INPUT. An entire line is read and each subsequent call to GetString causes another line to be read. An end-of-file condition indicates that there are no more lines to be read. The GetString routine requires three parameters: o An address of a word containing the QIO function modifier. If no QIO function modifier is required, specify 0 as the value or pass 0 as the address. - 6 - o An address of a string descriptor that will contain the prompt string to be written prior to getting the input string. If no prompt is required, pass 0 as the address. o An address of a string descriptor that will contain the returned string. Put This routine writes a single character to the output device, i.e. SYS$OUTPUT. The Put routine requires two parameters: o An address of a word that contains the QIO function modifier. If no QIO function modifier is equired, specify 0 as the value or pass 0 as the address. o An address of a byte that contains the character to be written. PutString This routine writes a line to the output device, i.e. SYS$OUTPUT. A carriage return and line feed is written prior to writting the output line. The PutString routine requires two parameters: o An address of a word that contains the QIO function modifier. If no QIO function modifier is required, specify 0 as the value or pass 0 as the address. o An address of a string descriptor containing the string to be written. PutLn This routine writes a carriage return and line feed to the output device, i.e. SYS$OUTPUT. The PutLn routine requires no parameters. - 7 - Index Get, 6 ReadLn, 4 GetString, 6 ReadString, 3 Put, 7 TerminalIo, 3 PutLn, 7 TerminalQio, 6 PutString, 7 Write, 4 Read, 3 WriteLn, 5 ReadAgain, 4 WriteString, 4 - 8 -