The Silicon Graphics 3270 high-level language application program interface (HLLAPI) provides a programming environment and tools to create 3270 HLLAPI applications that communicate with IBM mainframe applications. SNA, TCP, and 5080 modes are supported. The Silicon Graphics 3270 HLLAPI supports one session in SNA, TCP, and 5080 mode. Model 2, 3, 4, and 5 terminals are supported.
The Silicon Graphics 3270 HLLAPI also supports 3270 structured field data flows when using an SNA, TCP, or 5080 connection.
Silicon Graphics 3270 HLLAPI applications allow you to:
create your own customized 3270 user interface for displaying and processing keyboard information
automate repetitive sequences and run dialogues between the IRIS and IBM host unattended
achieve faster throughput using structured field and Silicon Graphics Message Mode capabilities
The Silicon Graphics 3270 HLLAPI provides HLLAPI functionality equivalent to IBM 3270 PC application program interface (API) as specified in the IBM PC 3270 Emulation Program, Version 3.00, Application Program Interface and Host Reference manual, document version SC23-0960-0.
Input and return information is passed in a C structure rather than in registers. The values and meaning of returned codes are left unaltered. The number and type of the input structure members have also been maintained except for modifications introduced to support Silicon Graphics 3270 HLLAPI enhancements.
This chapter assumes that you understand the information contained in the IRIS 3270 Emulator User's Guide on using and configuring the IRIS 3270 Emulator.
The following five changes map IBM PC Assembler implementation of HLLAPI to Silicon Graphics HLLAPI using C language:
A one-to-one mapping between service requests and C subroutine calls eliminates the need to map the information in registers AH, AL, BH, BL, CX, and DX. This mapping also eliminates the need for the “system return code” that indicates improper values in these registers.
The pointer to the parameter list (registers DX and ES) is replaced by a pointer to a structure.
All instances of segment address/offset address in a parameter list are mapped onto pointers.
All instances of “Must be zero/Unchanged” or “Reserved/Reserved” in the parameter list format definition are not implemented in the equivalent C structure.
All elements of each C structure are aligned on 32-bit word boundaries. This protects the user against future changes (a byte field can be expanded to 2 bytes or a short word expanded to a long word).
Three subdirectories under /var/opt/3270/example provide detailed examples of how to use the Silicon Graphics 3270 HLLAPI. All data structures used by the Silicon Graphics HLLAPI are defined in /usr/include/sys/hl_user_struct.h. All constants used as input values or returned values are defined in /usr/include/sys/hl_user_define.h. A short description of the contents of each subdirectory is provided below.
| Case 1 | provides an example of using hl_entry_point to create a filter routine within the Silicon Graphics-supplied t3279 program. In this case, the keyboard and display processing is done by Silicon Graphics-supplied routines. | ||||
| Case 2 | is obsolete. | ||||
| Case 3 | provides an example of a 3270 emulation with prespecified input and no display processing. The screen descriptors supply the input. A comment file contains the output generated and processes the screen descriptors. To view this file, enter:
You can also view a trace file by entering:
and then entering:
|
![]() | Note: All code may be copied and used in your development effort. |
The capabilities of Version 7.0 of the Silicon Graphics 3270 HLLAPI are listed here. The features listed in italic type are not provided by the IBM 3270-PC API.
Determine the session ID
Determine the value of the session parameters
Determine the current cursor position
Connect to the 3270 Presentation Space
Disable keyboard input during HLLAPI activity
Simulate keyboard data entry, that is, write data to the host application
Enable keyboard input when HLLAPI activity is completed
Disconnect from the 3270 Presentation Space
Copy between the 3270 Presentation Space and an application data
Read OIA group status
Reinitialize Silicon Graphics 3270 HLLAPI after a UNIX® exec call while preserving the host session (for SNA, TCP, and 5080 modes only)
Determine if the 3270 Presentation Space has been updated without a status line change
Copy the status line from the 3270 Presentation Space into an application data area
Start and stop Silicon Graphics Message Mode
Read and write Silicon Graphics Message Mode Protocol Data Units
Read and write 3270 structured fields
Trace all data passing through the Silicon Graphics 3270 HLLAPI code
Each description in this section explains the purpose of the subroutine, how it interacts with other Silicon Graphics 3270 HLLAPI subroutines, and the possible values for each element of the structure passed to the called routine. See /usr/include/sys/hl_user_struct.h for the precise definition of each structure used by the service request subroutines. Appendix B lists the error messages that might be written to /var/opt/3270/file/hllapi_log in the event that an error is detected.
| Calling Sequence |
| |
| Purpose | Verify that the specified session is available. | |
| Usage | Call this subroutine once for each desired session at the start of an application using the Silicon Graphics 3270 HLLAPI. |
| session_id | 0x01—indicating a request to connect to Session 1 | |
| link_type | 0x1—indicating a 5080 connection | |
0x04—indicating SNA data over a leased line | ||
0x05—indicating a TCP/IP connection | ||
| lu_name | reserved |
| session_ret | 0x00—indicating success | |
0x02—if Session ID is invalid | ||
0x2b—indicating a 3270 HLLAPI start up problem | ||
0x38—indicating that shared memory used by the Silicon Graphics HLLAPI could not be allocated | ||
0x39—indicating that the maximum number of sessions are already running | ||
| shmid | shared memory ID, used for t3279/ps3279 communication |
| Calling Sequence |
| |
| Purpose | Initialize the Silicon Graphics 3270 code at startup time. | |
| Usage | Call this subroutine once, each time the Silicon Graphics 3270 HLLAPI application is started. |
| session_id | 0x00—for first time initialization unique session number after an exec call command | |
| command | 0x01—indicates a first time initialization request | |
0x02—indicates an initialization request after an exec call | ||
| config_name | full path name of configuration file | |
| host_name | TCP/IP hostname for SGI gateway or IBM host | |
| terminal_pool | LU name used only by SNA | |
| signal_rtn | signal catching routine for SIGPOLL |
| Calling Sequence |
| |
| Purpose | Determine the values of session characteristics that affect the operation of a Silicon Graphics 3270 HLLAPI application. | |
| Usage | This subroutine can be called at any time after the Session ID has been determined. The Silicon Graphics 3270 HLLAPI deviates from the IBM 3270-PC API in that alternate screen sizes are supported. Extended Attributes are supported. Programmed Symbols are not supported. |
| session_type | 0x02—is always returned | |
| session_char | 0x00—if no extended attributes and no programmed symbols | |
0x40—if programmed symbols, but no extended attributes | ||
0x80—if extended attributes, but no programmed symbols | ||
0xc0—if extended attributes and programmed symbols | ||
| session_rows | number of rows in session's Presentation Space | |
| session_cols | number of columns in session's Presentation Space | |
| session_ret | 0x00—if successful | |
0x02—if Session ID is invalid |
| Calling Sequence |
| |
| Purpose | Determine the current cursor position and type. | |
| Usage | This subroutine must be called whenever the Silicon Graphics 3270 HLLAPI application needs to determine the current cursor position and type. Row and column addresses start at 0, not 1. |
| cursor_type | 0x00—if underscore cursor, always returned | |
| cursor_row | current row address of cursor | |
| cursor_col | current column address of cursor | |
| cursor_pos | returned address, as offset | |
| status | 0x00—does not display cursor | |
0x01—displays cursor | ||
| session_ret | 0x00—if successful |
| Calling Sequence |
| |
| Purpose | Connect a Silicon Graphics 3270 HLLAPI application to an active 3270 Presentation Space. | |
| Usage | This subroutine serializes access to keyboard and copy services. The routine must be called at the start of an Silicon Graphics 3270 HLLAPI application and normally is followed by a call to hl_reserve, which locks the keyboard, preventing operator input. |
| session_id | unique session number | |
| query_reply | reserved | |
| query_reply_len | reserved |
| Calling Sequence |
| |
| Purpose | Causes 3270 emulator to disable keyboard input. | |
| Usage | Normally, this subroutine is called immediately after hl_connect to prevent the intermingling of operator- and application-generated keyboard input. |
| Calling Sequence |
| |
| Purpose | Sends keystroke data from an Silicon Graphics 3270 HLLAPI application as an operator would enter it from a keyboard. | |
| Usage | Used whenever the Silicon Graphics 3270 HLLAPI application wishes to send data to a host program. The Silicon Graphics 3270 HLLAPI deviates from the IBM specification by allowing an unlimited number of keystrokes to be encoded in the keystroke list. |
![]() | Note: 3270 Buffer Code format is supported for all values of CHAR_SET. ASCII scan codes are supported only if CHAR_SET = US_ENGLISH in your configuration file. |
n keystrokes
Scan | Shift |
| Scan | Shift |
Each scan code and shift state is an 8-bit quantity. See Appendix B, “Scan Code and Buffer Code Tables” for scan code shift state definitions.
| session_id | unique session number | |
| char_set | character set in use (possible values for char_set are defined in hl_user_define.h; they range from HL_FRENCH to HL_KATAKANA_ENGLISH) |
![]() | Note: For Katakana applications, CHAR_SET = HL_KATAKANA implies that Katakana characters will be displayed. If English characters should be displayed, set CHAR_SET = HL_KATAKANA_ENGLISH. |
| keystroke_ptr | pointer to list of scan code/shift state pairs | |
| total_keys | total number of keystrokes to be sent to the host |
| keyboard_ret | 0x00—if successful and no AID generated | |
0x02—if Session ID is invalid | ||
0x04—if session not connected for keyboard services | ||
0x10—if invalid scan code or input inhibited condition | ||
0x12—if successful and AID generated | ||
0x37—if char_set invalid | ||
| keys_sent | number of keys sent before processing ended |
| Calling Sequence |
| |
| Purpose | Causes 3270 emulator to enable operator keyboard input. | |
| Usage | If hl_reserve has been called, hl_release can be called to reenable keyboard input. The hl_disconnect subroutine also reenables keyboard input automatically. |
| Calling Sequence |
| |
| Purpose | Disconnect a Silicon Graphics 3270 HLLAPI application from an active 3270 Presentation Space. | |
| Usage | This subroutine serializes access to keyboard and copy string services. It must always be called prior to exiting the Silicon Graphics 3270 HLLAPI application code. |
| Calling Sequence |
| |
| Purpose | Copy part or all of the data from the 3270 Presentation Space to the Silicon Graphics 3270 HLLAPI application data area or vice versa. | |
| Usage | Called whenever data must be moved from the 3270 Presentation Space to the application data area. It is also used to update the 3270 Presentation Space. Only the 3270 device buffer format is supported. |
| source_id | 0x00—(application to 3270) | |
unique session number (3270 to application) | ||
| source_ptr | 0x00—(3270 to application) | |
pointer to application data area (application to 3270) | ||
| source_beg | offset to first source character to be copied | |
| source_end | offset to last source character to be copied (both directions) | |
| target_id | 0x00—(3270 to application) | |
unique session number (application to 3270) | ||
| target_ptr | 0x00—(3270 to application) | |
pointer to application data area (application to 3270) | ||
| target_beg | offset to starting copy position in target buffer | |
| copy_mode | 0x00—3270 field attributes not copied (both directions) | |
0x40—3270 field attributes copied (3270 to application) |
| copy_ret | 0x00—if successful | |
0x02—if Session ID is invalid | ||
0x03—if target is input inhibited | ||
0x06—if invalid source definition | ||
0x07—if invalid target definition | ||
0x09—if truncation occurred | ||
0x0e—if some or all of the target is protected | ||
0x0f—if copy of field attributes not allowed |
| Calling Sequence |
| |
| Purpose | Determine the current input inhibited state. | |
| Usage | This subroutine determines when the 3270 Presentation Space is ready to accept input. It is designed to be used in a polled mode or blocked mode with a timeout. Each unit of time represents 10 milliseconds. |
| session_id | unique session number | |
| mode | 0x01—if polling mode desired | |
0x02—if blocked mode with timeout desired | ||
| timeout | 1 - 6000—if read_mode = 2; 0 otherwise |
| Calling Sequence |
| |
| Purpose | Determine if any location on the screen has been updated. | |
| Usage | This subroutine determines when the 3270 Presentation Space or Status Line has been updated. It eliminates the need to call hl_read_oiag and hl_copy_data to determine if any location on the screen has been updated. It also provides a flag that indicates that a structured field has been received from the host and is waiting to be read by the user application. Each unit of time represents 10 milliseconds. |
| session_id | unique session number | |
| mode | 0x01—if polling mode desired | |
0x02—if blocked mode with timeout desired | ||
| timeout | 1 - 6000—if read_mode = 2; 0 otherwise |
| screen_ret | 0x00—if screen has been updated | |
0x02—if Session ID is invalid | ||
0x23—if time out value not between 1 and 6000 | ||
0x24—if the screen has not been updated | ||
0x25—if Unix has detected an error (error code is in errno) | ||
| line_change | 44 bytes, one for each line, 0 = unchanged and 1 | |
| sf_pending | 1—if a structured field is waiting to be read, 0 otherwise | |
| write_cmd | 1—if screen updated by Erase Write or Erase Write Alternate command; 0 otherwise | |
| partition | reserved | |
| filexfr_active | reserved |
| Calling Sequence |
| |
| Purpose | Provides the Silicon Graphics 3270 HLLAPI application with the ability to display and/or analyze all fields of the 3270 status line. | |
| Usage | Used in error recovery or when the terminal display program is customer-supplied. If HL_NO_COPY is specified, the target_ptr is not used and it is assumed that stat_pointer from the map data structure will be used to point to the status line. If HL_COPY_TO_APPL is used, target_ptr must be defined. |
| session_id | unique session number | |
| mode | HL_NO_COPY and HL_COPY_TO_APPL | |
| target_ptr | pointer to application data area (size >= 80 bytes) |
| Calling Sequence |
| |
| Purpose | Allows the Silicon Graphics 3270 HLLAPI application to start Silicon Graphics Message Mode. | |
| Usage | This subroutine must be invoked once prior to calling hl_read_msg or hl_write_msg. (CUT mode only) |
| Calling Sequence |
| |
| Purpose | Allows the Silicon Graphics 3270 HLLAPI application to terminate Silicon Graphics Message Mode. | |
| Usage | Can be used to switch out of Silicon Graphics Message Mode. It need not be called when disconnecting, since hl_disconnect terminates Silicon Graphics Message Mode automatically. |
| Calling Sequence |
| |
| Purpose | Read a Silicon Graphics Message Mode Protocol Data Units sent by the host. | |
| Usage | This subroutine is typically called when the application expects the host to send Message Mode data rather then normal 3270 data. All returned data is encoded in 3270 Buffer Code. It is assumed that each screen is written using the 3270 Erase Write command and that each screen in “unformatted”. Each Set Buffer Address (0,0) is marked by an 0xff character inserted into the data stream. If HL_NO_COPY is specified, the data_ptr is not used. Instead, the mba_ptr from the map data structure is used into point to the 64 Kb Message Mode ring buffer. The map data pointer is initialized by calling hl_map_data. The application must manage its own offset into the ring buffer after initialization. If HL_COPY_TO_APPL is used, data_ptr must be defined. |
| session_id | unique session number | |
| mode | HL_NO_COPY and HL_COPY_TO_APPL | |
| data_ptr | pointer to application data area | |
| data_size | size of the application data area |
| message_ret | 0x00—if successful | |
0x02—if Session ID is invalid | ||
0x04—if session not connected for keyboard services | ||
0x21—if the receive time out value has been exceeded | ||
0x26—if the application data size < received data size | ||
0x28—if Silicon Graphics Message Mode has not been invoked | ||
| data_count | number of bytes stored in application data area |
| Calling Sequence |
| |
| Purpose | Read a 3270 Structured Field that has been sent by the host. | |
| Usage | This subroutine is called whenever an Silicon Graphics 3270 HLLAPI application expects a Structured Field from the host other than the Read Partition Query and Outbound 3270DS. The application need not call this routine unless it has already detected a structured field pending using the flag word provided by hl_screen_status. Each call to hl_read_sf returns the contents of a Structured Field. (SDLC) |
| session_id | unique session number | |
| data_ptr | pointer to application data area | |
| data_size | size of the application data area |
| Calling Sequence |
| |
| Purpose | Send a 3270 Structured Field to the host. | |
| Usage | This subroutine is called whenever the Silicon Graphics 3270 HLLAPI application must send a 3270 Structured Field to the host other than Query Reply and Inbound 3270DS. The Structured Field can contain up to 4K bytes of data. (DFT mode only) |
| session_id | unique session number | |
| data_ptr | pointer to application data area | |
| data_count | number of bytes stored in application data area |
| Calling Sequence |
| |
| Purpose | Trace keyboard input and host output. | |
| Usage | This routine is called whenever the Silicon Graphics 3270 HLLAPI application wants to trace all data passing through the Silicon Graphics 3270 HLLAPI. The trace data can be displayed by invoking /opt/3270/bin/display_3270trace. |
| Calling Sequence |
| |
| Purpose | Eliminate need to copy data from Silicon Graphics Presentation Space image into a local buffer provided by the Silicon Graphics 3270 HLLAPI application. | |
| Usage | To minimize data copies and allow for different 3270 Presentation Space images, call once for each session at initialization time. |
| session_id | unique session number | |
| ps_ptr | pointer to start of the 3270 Presentation Space | |
| stat_ptr | pointer to start of the status line | |
| mba_ptr | pointer to start of the Silicon Graphics Message Mode circular buffer | |
| ea_ptr | pointer to start of the 3270 Extended Attribute Buffer | |
| ps_rows_ptr | pointer to location containing number of rows | |
| ps_cols_ptr | pointer to location containing number of columns |
| Calling Sequence |
| |
| Purpose | Provide an entry point for user-supplied code enhancements to the IRIS 3270 Emulator. | |
| Usage | This routine is called each time through the main processing loop for the IRIS 3270 Emulator. It is designed to provide an inline filter capability for user-specific needs allowing the filter routine to specify when the 3270 Presentation Space should be displayed for user viewing. |