Understanding Host Screen Formats [ SNA IMF Programmer's Reference Manual ] MPE/iX 5.0 Documentation
SNA IMF Programmer's Reference Manual
Understanding Host Screen Formats
When you write an HP 3000 program designed to communicate with a host
application that will not be modified, you need to know what the host
screen formatsare and how the host program works. You must know when the
host program requires input, when it sends data, and how to determine
when the host has finished sending a particular internal screen image.
You should also know if a single screen of data will be transmitted in
more than one data transmission.
You can use the automatic print feature in Pass Thruto show when and how
the host program writes to your screen. Start Pass Thru specifying
format = 3 in the info string of the RUN command, and manually access
your host program. Your internal screen image will be printed after
every call to either the TRAN3270 or the RECV3270 intrinsic. The printed
screen images show you the screens sent by the host, with attribute and
null characters differentiated from blank characters. If the host sends
a single screen in more than one transmission, you will be able to
determine that from the printed images. See Using SNA IMF Pass Thru for
more information on Pass Thru and its automatic print feature.
Because your HP program emulates a 3278 display station or 3287 printer,
you must design your program to respond to the host program whenever it
modifies your internal screen image. Your program must know what the
host system will do in a particular situation. If the host may do one of
several things at a particular time, your program must be written to
handle variable situations.
When you can modify existing host applications, or when you can write
local and host applications in tandem, you have the opportunity to write
simpler programs. Screens do not need operator instructions or even much
structure. In fact, you can use an unformatted screenwith no fields at
all. Unformatted screens are often more efficient for new applications.
You can write the programs to suit your local needs, possibly with the HP
3000 application controlling the host program.
IBM 3278 Screen Layout
On an IBM 3278 display station, data fields extend horizontally across
the screen and are separated from one another by an attribute character.
Data fields may occupy one or more contiguous lines on the screen. SNA
IMF intrinsics read a screen one row at a time, beginning at the upper
left corner and moving along each row from left to right, looking for a
field attribute character. The first field attribute character found
causes the following field to be labeled field number one; the field
following the next attribute character is labeled field number two, and
so on as SNA IMF scans down the screen. If an attribute character is not
in the very first character position on the screen, then the first
characters of data belong to the last field on the screen; that is, the
last field wraps the screen.
SNA IMF intrinsics number rows in the screen 0 through 23 and columns 0
through 79. The IBM screen layout numbers rows 1 through 24 and columns
1 through 80.Figure 2-1 compares the way SNA IMF and IBM number the rows
and columns on a screen.
Figure 2-1. Comparing SNA IMF and IBM Screen Layouts
An attribute is not considered part of the data field. The
field-oriented intrinsics never return the attribute when they return
field data. The data field begins with the first position following the
attribute character. This position is defined as the location of the
first data character in the field; here, offset = 0. When the READFIELD
intrinsic returns data from a field, embedded and leading null characters
are returned with data characters, but trailing null characters are not
returned. This means that the actual field length parameter count does
not include trailing null characters.
Intrinsic Calling Sequences
The order in which you call
SNA IMF intrinsics depends on whether your device or the host system will
be the first to send data after a communication path is opened. If the
host has a screen of data waiting for you, the host will want to send the
screen before allowing you to send any data. If the host system requires
you to log on or start the host application, your device must send the
first screen of data to the host system.
You can simplify your program by developing routines that consist of
commonly used sequences of intrinsics. Be sure these routines check the
value returned in the result parameter of each intrinsic. Appendix F
contains complete sample programs.
Following are suggested intrinsic sequences, presented to help you get
started writing your programs. You may want to run Pass Thru with the
format parameter in the info string set to three or four (the automatic
print option), to verify the correct intrinsic calling sequence. See
Using SNA IMF Pass Thru for more information.
Host Transmits Data First
If you expect the host to send data to your device first, use intrinsics
in a sequence like this:
Establishing communications with the host:
OPEN3270
Establish communications with the host system.
RECV3270
Check to see if the data has been received.
RECV3270
Accept an initial screen of data from the host.
SCREENATTR
Determine the number of fields in the screen and update the cursor
variables containing the coordinates of the cursor position.
Reading data, from a specified field:
FIELDATTR
Determine the attribute values for a specified field.
READFIELD
Read data from a specified field in the screen.
(Repeat the FIELDATTR/READFIELD sequence as many times as necessary.)
Reading data, from part or all of the screen:
ATTRLIST
Return the locations of the attribute characters.
READSCREEN
Read data from part or all of the screen.
Writing data, into one field at a time:
WRITEFIELD
Write data into an unprotected field.
Writing data, into several fields at a time:
SCREENATTR
Update the cursor (row/column) variables again.
STREAM3270
Write data into several fields at one time.
TRAN3270
Send a data screen to the host system.
Receiving another screen of data from the host:
RECV3270
Accept a new data screen from the host.
SCREENATTR
Determine the number of fields in the screen and update the cursor
variables containing the coordinates of the cursor position.
FIELDATTR
Determine the attributes of the fields specified.
Closing a session with the host:
CLOSE3270
Disassociate your terminal from an SSCP-LU session.
Terminal Transmits Data First
If you expect to send data to the host system first, use the intrinsics
in a sequence like this:
Sending data to the host first:
OPEN3270
Establish communications with the host.
RECV3270
Accept the SNA IMF banner message.
TRAN3270
Send the SYS REQ key, which puts you into the LU-SSCP session and allows
you to send data to the host.
RECV3270
Receive a blank SSCP-LU screen.
WRITEFIELD
Write to the LU-SSCP screen.
TRAN3270
Send the data screen to the host.
RECV3270
Accept a new screen of data from the host.
SCREENATTR
Determine the number of fields in the screen and update the variables
containing the coordinates of the cursor position.
Reading data, from a specified field:
FIELDATTR
Determine the field attribute values for a specified field.
READFIELD
Read data from a specified field in the screen.
(Repeat the FIELDATTR/READFIELD sequence as many times as necessary.)
Reading data, from part or all of the screen:
ATTRLIST
Return the locations of the attribute characters.
READSCREEN
Read data from part or all of the screen.
Closing a session with the host:
CLOSE3270
End communications with the host.
NOTE Be sure to log off from the host application you are using before
you issue the CLOSE3270 intrinsic. The CLOSE3270 intrinsic
terminates your session with the host system, but it does not
terminate the host application.If you call CLOSE3270 before you log
off from the host application, the host application is left
running, and you have no way of terminating it, because your
session has been closed.
For complete example programs, in non-transparent and transparent mode,
see appendix F, "Sample Programs."
MPE/iX 5.0 Documentation