Pathway/iTS TCP and Terminal Programming Guide

Writing User Conversion Procedures
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide426751-001
4-5
Screen Input Procedures
USERCODE
is the value given in the USER CONVERSION field characteristic clause. This
parameter can be used to select a particular type of conversion.
ERROR
is both an input and an output parameter. When the procedure is called, the
parameter contains either 0 (indicating no error) or the number of a conversion error
detected during the attempted standard conversion. Refer to the Compaq NonStop
Pathway/iTS SCREEN COBOL Reference Manual for a listing of the possible error
codes.
The value of the ERROR parameter after the call determines whether an error for
the field is reported back to the terminal. If the value is nonzero, that value is used
to select the error message to be displayed. Processing depends on the purpose of
the procedure as follows:
If the user conversion procedure simply performs additional checking on the
input it has received, then the procedure should return immediately if the
ERROR is nonzero: that is, skip the additional checking. This is because having
a nonzero ERROR indicates that an error has already been encountered and
hence it is not necessary to do any further checks. However if the ERROR is
zero, then the procedure should proceed with its own checking and set the
ERROR accordingly.
If the user conversion procedure is performing some conversion, then the
ERROR may have no meaning because you may have entered some values
which will cause the ERROR to be set, but programmatically you would like to
convert the entered value to some value which would be understood by your
application. Hence in these cases, you should ignore the value present in the
ERROR, perform the conversion, and set the ERROR parameter accordingly.
INPUT
contains the string of characters input from the terminal. Alphanumeric input is
stripped of fill characters from the right; numeric input is stripped of fill characters
from both the right and the left.
INPUT^LEN
gives the number of bytes in the input string after the string is stripped of fill
characters. The byte before and the byte after the input string are set to null values.
INTERNAL
contains the result of the standard conversion (if no error occurred) and should
contain the result of the user conversion (unless ERROR is nonzero upon return).
For the numeric procedure, INTERNAL is a FIXED parameter; if necessary,
this value is later converted to the final data type by the TCP. The
INTERNAL^SCALE parameter gives the scale that INTERNAL should have.