HPDREAD
Reads, edits, and transforms data, and returns the information to the
application.
Syntax
HPDREAD globalpak, returnpak, readpak, readitems, cursorposition,
datadescrpt, databuf, fieldlist
Parameter Descriptions
globalpak A compound parameter that passes information
between intrinsics. For a complete description
of this parameter, see "Global Parameters" in
Chapter 3.
returnpak A compound parameter that passes information
back from the intrinsic to the application.
For a complete description of this parameter,
see "Global Parameters" in Chapter 3.
readpak A compound parameter that modifies the default
operations of HPDREAD. It is made up of the
following subparameters:
readtime A four-byte integer
that tells HPDREAD
how many seconds to
allow for a read.
The values you can
use are:
0 = do not time the
read
>0 = time the read
and report an
exception if a
timeout occurs
enablereformat A four-byte integer
used by the
application to tell
HPDREAD to reformat
the data after it is
collected and edited,
and before it is
returned to your
application. Data is
reformatted according
to the specifications
embedded in the form.
Reformatting does not
include data type
conversions. You can
use the following
values:
0 = ignore, do not
reformat data
1 = reformat data
doreread A four-byte integer
that is used by the
application to
indicate that this
read is a consecutive
or follow-up read.
You can supply the
following values:
0 = ignore
1 = automatically
read the terminal.
The read termination
item will always be
identified as the
ENTER key.
bypassfeature A four-byte integer
that will be used for
future Hi-Li
implementations. At
that time, you must
supply the globalpak
subparameter,
expectedvuf, with a
value equal to or
greater than A.00.10.
For this release of
Hi-Li software, set
bypassfeature to
zero.
readitems A compound parameter used by the application to
define valid read termination items, (keys and
fields), and the tasks HPDREAD is to perform
following the termination of the physical read.
This information is used as input to HPDREAD.
It is made up of the following subparameters:
itemcnt A four-byte integer
that indicates the
number of active
termination item
entries. Setting
itemcnt to zero tells
HPDREAD to use
implicit read key
definitions, that is,
read, edit, and
report errors on key
0, and interrupt only
on function keys 1
through n and fields
1 through n. This is
the same as options 2
and 0, respectively,
of the readopt
subparameter
discussed later under
the HPDREAD
intrinsic.
itementry Identifies a table
defined in your
application that
contains termination
item types,
termination items,
and read options.
itemtype A four-byte integer
that indicates the
termination item
type, a key or field.
The values you can
use are:
0 = key
1 = field
itemident A four-byte integer
that identifies a
termination item. If
you have defined
itemtype as a key,
the ENTER key is 0,
function key 1 is 1,
and so on.
If you have defined
itemtype as field, a
positive number
indicates a field
number and a negative
number indicates
screen order.
readopt A four-byte integer
that tells HPDREAD
which read option you
want to use. You can
use the following
values:
-1 = no read
This option returns
an exception to the
application, and is
the implicit entry of
all items (keys and
fields) that are not
defined in the table
identified by
itementry.
0 = interrupt only
1 = unedited read
2 = read and edit -
report errors OR
return data
3 = read and edit -
report errors AND
return data
Note: If you specify
option 3 and data
editing errors occur,
you will get an error
when type conversions
are performed. Use
option 3 when you are
not doing type
conversions.
cursorposition A four-byte integer or 36-byte character array
that is reserved for a feature not yet
implemented. Set this parameter to zero or
spaces.
datadescrpt A compound parameter that tells HPDREAD how
data is to be mapped when it is moved between
data fields on the form and your application.
There are six ways to map data. The first and
simplest way is shown below.
-1 = do not transfer data
0 = moves concatenated string of data to
databuf.
The number of bytes moved is equal to the sum
of the lengths of all the fields in the form.
All data is moved as type CHAR. See Chapter 4
for a description of each of the other five
mapping methods.
databuf A record that represents the application area
that receives the data copied from fields on
the form. It is passed as output from the
intrinsic.
fieldlist A compound parameter that allows your
application to get a list of the fields that
are flagged in error. This parameter is both
input to and output from HPDREAD. It is
compatible with the HPDPROMPT fieldlist
parameter, and is made up of the following
subparameters:
listtype A four-byte integer
used by your
application to
indicate how HPDREAD
should identify
fields in the list.
You can use the
following values:
0 = do not generate a
list
1 = identify by field
number
2 = identify by
screen order
3 = identify by field
name
allocnt A four-byte integer
used by your
application to
indicate the number
of entries that are
allocated for the
returned list.
actualcnt A four-byte integer
that is the number of
defined entries in
the list. This value
is set by HPDREAD. If
no fields are flagged
in error, and the
value of the allocnt
parameter is greater
than zero, HPDREAD
sets actualcnt to
zero.
listentry Identifies a table
defined in your
application that will
receive the list of
fields in error.
Note: This table is
sorted by field
number in the order
the fields were
created. This is
true regardless of
the field ID method
you use (listtype).
fieldident If you supplied a
value of 1 or 2 for
listtype, this is a
four-byte integer.
If you supplied 1,
fields are identified
by number. If you
supplied 2, fields
are identified by
screen order.
If you supplied a
value of 3 for
listtype, this is a
32-byte character
array. Fields are
identified with a
USASCII character
name.
Discussion
HPDREAD is one of the three core intrinsics that make up the screen
management intrinsics. It lets you read a device, such as a terminal,
and edit and reformat the data according to the processing specifications
in the form. It then returns this information to your application.
Parameters that are not required by your application can be compacted and
passed as abbreviated parameters.
Examples
COBOL:
01 readitems.
05 itemcnt pic s9(8) comp.
05 itementry occurs 9 times.
10 itemtype pic s9(8) comp.
10 itemident pic s9(8) comp.
10 readopt pic s9(8) comp.
01 fieldlist
05 listtype pic s9(8) comp.
05 allocnt pic s9(8) comp.
05 actualcnt pic s9(8) comp.
05 listentry occurs 5 times.
10 fieldid pic s9(8) comp.
FORTRAN:
INTEGER*4 READITEMS(28)
INTEGER*4 ITEMCNT
EQUIVALENCE (READITEMS(1), ITEMCNT)
INTEGER*4 ITEMTYPE(3,9)
INTEGER*4 ITEMIDENT(3,9)
INTEGER*4 READOPT(3,9)
EQUIVALENCE (READITEMS(2), ITEMTYPE),
+ (READITEMS(2), ITEMIDENT),
+ (READITEMS(2),READOPT)
For an example of how a record structure can be manipulated in FORTRAN,
see the COLLECT_TXNS subroutine in the FORTRAN example program in
Appendix C.
INTEGER*4 FIELDLIST(8)
INTEGER*4 LISTTYPE
INTEGER*4 ALLOCNT
INTEGER*4 ACTUALCNT
EQUIVALENCE (FIELDLIST(1), LISTTYPE),
+ (FIELDLIST(2), ALLOCNT),
+ (FIELDLIST(3), ACTUALCNT)*j*Q
EQUIVALENCE (FIELDLIST(4), FIELDID)
For an example of how a record structure can be manipulated in FORTRAN,
see the COLLECT_TXNS subroutine in the FORTRAN example program in
Appendix C.
Pascal:
type
itementry_rec = record
itemtype : integer;
itemident : integer;
readopt : integer;
end;
readitems_rec = record
itemcnt : integer;
itementry : array [1..9] of
itementry_rec;
end;
var
readitems : readitems_rec;
type
fieldlist_rec = record
listtype : integer;
allocnt : integer;
actualcnt : integer;
fieldid : array [1..5] of integer;
end;
var
fieldlist : fieldlist_rec;