Hilmas User's Guide
Back Language Basics Next

Basic Input/Output.

With Basic Input/Output we mean the one that in Unix is called standard input or standard output, and that in mainframe environment can be terminal I/O in line mode or in batch can be SYSIN and SYSOUT. Similarities with Unix end here: there isn't a pipe, a standard error or a simple redirection in mainframe world.
There are two instruction that in Hilmas can do this: SAY, to write a line to standard output and INPUT to accept a line from standard input.

SAY can be used to display variables and constants, in this way, for example:

SAY var1,const1,var2,(var3,length),const2,....

All constants or variables, strings or numbers, are displayed on the same line, optionally specifying a length that modifies the defined length of a string or a predefined length of an edited number; for example:

SAY 'Number I is equal to: ',(I,6),' - and MyString variable is ',MYSTRING

SAY can be used also to write the line directly on a open file, with FILE=  parameter, or to write the line into a string variable, with VAR= parameter; see Language Reference for details.

Instead, INPUT instruction reads a line from standard input and divides it into words, assigning these to the variables specified as parameters:

INPUT string1,string2,string3,...

First word is assigned to variable string1, second word to string2 and so on; if words are more than specified variables, the last variable contains remaining words; if is specified only one variable, this contains all the line. INPUT don't admit numeric variables: if a number must be read, first is accepted in a string variable, then can be converted in a true number with EDIT2NUM statement.

Let's view some environment related features:

Interactive environment (CMS, TSO, CICS)

INPUT statement read a line written by user on a terminal; input position in TSO and CICS is the next line in the screen, after the last written line; in CMS is always the input field at the bottom of the screen.

SAY writes a line on the screen at the cursor position; at every SAY statement a line is skipped up to the last line at the bottom of the screen; at this point TSO stops output with a "***" and CMS stops with a "MORE..." : user must press Clear to continue. In CICS instead no stop occurs and writing wraps at the top of the screen, so program should count lines written and manage output stop.

In CICS (and only in CICS) is possible to write into a specific line using parameter ROW=line-number.

In every interactive environment is possible to hilight output using variables like these:

HI    DC  X'1DF8'  for HiLight (use MOVE to initialize variable in CICS)
LO    DC  X'1DF0'  
for return to normal

for example:
SAY  ' ----- ',HI,' Main Menu ',LO,' ------'

In interactive environment can be used PAGE=NEW parameter, that do a clear screen before the line output.

 

Batch environment (MVS and DOS/VSE).

In MVS batch SAY writes a record on SYSOUT, a sequential file that is transparently opened by PROGRAM statement (so a SYSOUT DD must be present in JCL) and in DOS batch SAY writes on SYSLST. In batch environment can be used PAGE=NEW parameter, that do a page skip, writing a '1' ASA character in column one. If a program want to have a complete control of ASA character in column 1, with CC=var. parameter is specified a variable name that contains the wanted ASA character.

In MVS INPUT read a record from SYSIN, that is transparently opened by PROGRAM statement, too; in DOS a record is read from SYSRDR.

 


Back Start Next
Subroutines Top Functions