public class DataStream5250 extends Object
The complete list of 5250 terminal types is maintained in the Assigned Numbers RFC and includes the following:
. IBM-5555-C01 24 x 80 Double-Byte Character Set color display . IBM-5555-B01 24 x 80 Double-Byte Character Set (DBCS) (*) IBM-3477-FC 27 x 132 color display (*) IBM-3477-FG 27 x 132 monochrome display (*) IBM-3180-2 27 x 132 monochrome display (*) IBM-3179-2 24 x 80 color display (*) IBM-3196-A1 24 x 80 monochrome display (*) IBM-5292-2 24 x 80 color display (*) IBM-5291-1 24 x 80 monochrome display (*) IBM-5251-11 24 x 80 monochrome display
The supported terminal types are marked with (*) above. To determin if the terminal type is of 27 x 132 type, the terminal name must contain "3477-" or "3180-".
This section is intended to be used as an addendum to the IBM 5250 Information Display System, Functions Reference Manual. Described here are enhancements to the 5250 data stream which are not yet documented in the current version of that manual. The current version of that manual at the time of this writing has the IBM publication number SA21-9247-6. Also described in this section are corrections to erroneous information contained in SA21-9247-6.
Listed below are the specific corrections and enhancements, with an approximate page number reference to the above manual.
The Insert Cursor (IC) order on pages 2-136 and 2-137 is incorrectly listed with a value of Hex 03; the correct value is Hex 13. On page 2-137, the listed "Restrictions" for the Insert Cursor, Repeat to Address, and Set Buffer Address orders should be updated to describe how Row and Column values must be valid for the current display screen size (either 24 x 80 or 27 x 132).
A new flag is added to the second byte of the Control Character on page 2-40. This flag is used to specify whether the cursor should be moved or not moved at the end of the Write to Display processing. Bit 1 of the second byte, which was previously reserved, will now be used for this flag. If bit 1 is a 0, the cursor continues to be moved to the system IC address on a Lock-to-Unlock keyboard transition. If bit 1 is a 1, the cursor is not moved.
A new Field Control Word (FCW) will be added on page 2-65 to indicate an entry field contains transparent data. This means the entry field contents are sent from the display screen directly to the host at read time with no formatting. Therefore, an entry field can contain any values (Hex 00 to Hex FF). A transparent field is indicated by a Hex 84xx FCW, where xx is any value. Note: unpredictable results will occur if a field is defined as both signed numeric and a transparent field.
The Read Immediate, Read Input Fields, and Read MDT Fields commands have been enhanced to include support for transparent fields (page 2-5). If a transparent FCW is found for an input field, the field data is not formatted (for example, nulls are not converted to blanks).
The restriction listed for the Set Buffer Address (SBA) order (page 2-138) on the column address equal to zero is no longer always the case. A reference to Start of Field (SF) row 1/column 1 field support should be made. A note should be added in SF to describe Row 1/Column 1 field support. A Row 1/Column 1 field is defined by a SBA of row 1/column 0, followed by an SF. For a Row 1/Column 1 input field, the first input-capable position is row 1/column 1. If the SF defines an input field, the screen attribute is not allowed to be nondisplay. Writing of the screen attribute is suppressed for a Row 1/Column 1 field and the attribute discarded.
The Read MDT Fields Alternate input command has been added. It is
the same as the Read MDT Fields command except:
- The command is indicated by a X'82'
- Leading and embedded nulls within the field remain as nulls
The Read MDT Fields Immediate Alternate input command has been added.
It is the same as the Read MDT Fields Alternate command except:
- The command is indicated by a X'83'
- The command is an immediate read command like Read Immediate;
therefore, no control characters follow the command byte,
field data is returned immediately, and the aid code is X'00'.
The Move Cursor order (MC) has been added (page 2-137). The MC order moves the cursor to the location specified by the two bytes following the order. Byte 1 gives the row address and byte 2 gives the column address. The MC order is useful when the cursor is to be moved without affecting the system IC address. The MC order is unaffected by the Write to Display control character values including the "Leave Cursor" flag (CC1 bit 1). If more than one MC or IC are found in the data stream, the cursor will move to the address specified in the last MC or IC.
Restrictions:
A parameter error will be posted when:
- There are fewer then two bytes following the order.
- The row address is zero or greater than the number of
rows on the display screen.
- The column address is zero or greater than the number of
columns on the display screen.
Format:
Move Cursor Order Byte 1 Byte 2 X'14' Row Address Column AddressResults:
The Transparent Data order (TD) has been added (page 2-137). The TD order is followed by two length bytes and transparent data. The transparent data is written to the display screen at the current display address; any values (Hex 00 to Hex FF) are allowed in the transparent data. All length values are valid as long as the end of the display screen is not overwritten.
Restrictions:
A parameter error will be posted when:
- There are fewer then two bytes following the order.
- There are fewer bytes in the data stream then specified in the
length field.
- Attempting to write beyond the end of the display screen.
Format:
TD Order Bytes 1 and 2 Bytes 3 to ? X'10' Length of transparent Transparent data data (not counting length bytes)Results:
The Query command is a new input command (page 2-5) and is used by the server to obtain information on the functional capabilities of the client 5250 display. When the client receives a Query command, the client sends a Query Reply describing its capabilities back to the server.
The Query command must follow an Escape ('04'X) and Write Structured Field command ('F3'X). The format of the Query command is as follows:
Byte Value Description ====== ======= ======================== 0-1 X'0005' Length of command 2 X'D9' Command Class 3 X'70' Command Type - Query 4 X'00' Flag Byte Bit 0: B'0' - Query Command Bit 1-7: - Reserved (set to zero)The format of the Query Reply is as follows:
Byte Value Description ====== ======== =================================== 0-1 X'0000' Cursor Row/Column (set to zero) 2 X'88' Inbound Write Structured Field Aid 3-4 X'003A' Length of Query Reply 5 X'D9' Command Class 6 X'70' Command Type - Query 7 X'80' Flag Byte Bit 0: B'1' - Query Reply Bit 1-7: - Reserved (set to zero) 8-9 Controller Hardware Class X'0001' - Local Twinax Controller X'0061' - Local ASCII Controller X'0101' - SDLC/X.21/X.25 Twinax Controller (5394 emulating a 5294) X'0103' - SDLC/X.21/X.25 Twinax Controller (5394) X'0200' - PC DOS non-DBCS WSF X'0300' - OS/2 non-DBCS WSF X'0400' - PC DOS DBCS WSF X'0500' - OS/2 DBCS WSF X'0600' - Other WSF or any other 5250 Emulator 10-12 Controller Code Level X'010300' - For example, Version 1 Rel 3.0 13-28 X'00' Reserved (set to zero) 29 Device Type X'01' - 5250 Display or 5250 Emulation 30-33 C'cccc' Device Type (e.g. 3180 for 3180 Mod 2) 34-36 C'ccc' Device Model (e.g. 002 for 3180 Mod 2) 37 Keyboard ID X'02' - Standard Keyboard X'82' - G Keyboard 38 X'00' Extended Keyboard ID 39 X'00' Reserved 40-43 X'xxxxxxxx' Display Serial Number 44-45 Maximum number of input fields X'0100' - Typically = 256 input fields 46-48 X'00' Reserved (set to zero) 49-53 Controller/Display Capability Bit 0-1: B'00' - No Row 1/Col 1 support B'01' - Row 1/Col 1 support Bit 2: B'0' - No Read MDT Alternate Command support B'1' - Read MDT Alternate Command support Bit 3: B'0' - Display does not have PA1/PA2 support B'1' - Display does have PA1/PA2 support Bit 4: B'0' - Display does not have PA3 support B'1' - Display does have PA3 support Bit 5: B'0' - Display does not have Cursor Select support B'1' - Display does have Cursor Select support Bit 6: B'0' - Display does not have Move Cursor Order support B'1' - Display does have Move Cursor Order support Bit 7: B'0' - No Read MDT Immediate Alt Command support B'1' - Read MDT Immediate Alt Command support 50 Bit 0-3: B'0001' - 24 x 80 Screen Size B'0011' - Capable of 24 x 80 and 27 x 132 Bit 4: B'0' - No light pen support B'1' - Light pen support Bit 5: B'0' - No Mag Stripe Reader support B'1' - Mag Stripe Reader support Bit 6-7: B'00' - Mono display B'01' - 5292/3179 style color, including color PCs 51 X'00' - Reserved 52 Bit 0-2: B'000' - No Double Byte Character Set (DBCS) capability B'001' - Presentation screen DBCS capability only Bit 3-7: B'00000' - Reserved 53 Bit 0-2: B'000' - No graphics capability B'001' - 5292-2 style graphics Bit 3-7: B'00000' - Reserved 54-60 X'00' Reserved (set to zero)
Modifier and Type | Field and Description |
---|---|
static int |
AID_CLEAR |
static int |
AID_ENTER |
static int |
AID_F1 |
static int |
AID_F10 |
static int |
AID_F11 |
static int |
AID_F12 |
static int |
AID_F13 |
static int |
AID_F14 |
static int |
AID_F15 |
static int |
AID_F16 |
static int |
AID_F17 |
static int |
AID_F18 |
static int |
AID_F19 |
static int |
AID_F2 |
static int |
AID_F20 |
static int |
AID_F21 |
static int |
AID_F22 |
static int |
AID_F23 |
static int |
AID_F24 |
static int |
AID_F3 |
static int |
AID_F4 |
static int |
AID_F5 |
static int |
AID_F6 |
static int |
AID_F7 |
static int |
AID_F8 |
static int |
AID_F9 |
static int |
AID_FORWARD_EDGE_AUTO_ENTER |
static int |
AID_HELP |
static int |
AID_PA1 |
static int |
AID_PA2 |
static int |
AID_PA3 |
static int |
AID_PGDN |
static int |
AID_PGUP |
static int |
AID_PRINT |
static int |
AID_RECORD_BACKSPACE |
static int |
CMD_CLEAR_FORMAT_TABLE |
static int |
CMD_CLEAR_UNIT |
static int |
CMD_CLEAR_UNIT_ALTERNATE |
static int |
CMD_ESCAPE |
static int |
CMD_READ_IMMEDIATE |
static int |
CMD_READ_INPUT_FIELDS |
static int |
CMD_READ_MDT_FIELDS |
static int |
CMD_READ_SCREEN |
static int |
CMD_RESTORE_SCREEN |
static int |
CMD_ROLL |
static int |
CMD_SAVE_SCREEN |
static int |
CMD_WRITE_ERROR_CODE |
static int |
CMD_WRITE_STRUCTURED_FIELD |
static int |
CMD_WRITE_TO_DISPLAY |
static int |
ORDER_EA |
static int |
ORDER_ESC |
static int |
ORDER_IC |
static int |
ORDER_MC |
static int |
ORDER_RA |
static int |
ORDER_SBA |
static int |
ORDER_SF |
static int |
ORDER_SOH |
static int |
ORDER_TD |
static int |
ORDER_WEA |
Constructor and Description |
---|
DataStream5250(HostSession5250 hs,
Display5250 d)
Creates the 5250 data stream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkInputFields()
Checks all input fields for valid content.
|
boolean |
checkInputFields(boolean isEnterKey)
Checks all input fields for valid content.
|
byte |
convertCharToEBCDIC(char c)
Converts a single character to EBCDIC byte.
|
char |
convertEBCDICToChar(byte b)
Converts a single EBCDIC byte to character.
|
static String |
getAddressString(Display5250 display,
int addr)
Gets the address string as "ADDR = addr, X/Y = x/y".
|
String |
getAddressString(int addr)
Gets the address string as "ADDR = addr, X/Y = x/y".
|
String |
getAddressString(int x,
int y)
Gets the address string as "ADDR = addr, X/Y = x/y".
|
Field |
getFieldFromAddress(int addr)
Locates a field from an address.
|
Field |
getFieldFromAddress(int x,
int y)
Locates a field from an address.
|
FormatTable |
getFormatTable()
Gets a reference to the format table.
|
int |
getHomeAddress()
Gets the cursor home address.
|
String |
getTerminalType()
Gets the terminal type.
|
boolean |
isAttribute(int ch)
Checks if a character is an attribute.
|
boolean |
isPrintable(int ch)
Checks if a character value is printable in EBCDIC.
|
boolean |
pageDown()
Performs the page down function.
|
boolean |
pageUp()
Performs the page up function.
|
void |
processData(short[] buf,
int buflen)
Processes an incoming 5250 data stream packet.
|
void |
requestHelp(int errorCode)
Request error help description from the AS/400.
|
boolean |
sendAttention()
Sends the attention key.
|
boolean |
sendEnter()
Sends the Enter key.
|
boolean |
sendHelp(boolean inErrorState)
Sends the Help key.
|
boolean |
sendPA(int nn)
Sends a PA 1-3 key.
|
boolean |
sendPF(int nn)
Sends a PF 1-24 key.
|
void |
sendRecordBackspace()
Record Backspace Function.
|
void |
sendSystemRequest(String text)
Sends the system request string to the AS/400.
|
boolean |
sendTestRequest()
When the 5494 is enabled to access CSU or concurrent diagnostic information
the 5494 operator and service personnel use the Test Request key sequence to
access CSU and diagnostic routines.
|
void |
setTerminalType(String terminal)
The accepted terminal type.
|
public static final int CMD_CLEAR_UNIT
public static final int CMD_CLEAR_UNIT_ALTERNATE
public static final int CMD_CLEAR_FORMAT_TABLE
public static final int CMD_WRITE_TO_DISPLAY
public static final int CMD_WRITE_ERROR_CODE
public static final int CMD_READ_INPUT_FIELDS
public static final int CMD_READ_MDT_FIELDS
public static final int CMD_READ_SCREEN
public static final int CMD_READ_IMMEDIATE
public static final int CMD_SAVE_SCREEN
public static final int CMD_RESTORE_SCREEN
public static final int CMD_ROLL
public static final int CMD_WRITE_STRUCTURED_FIELD
public static final int CMD_ESCAPE
public static final int ORDER_SBA
public static final int ORDER_SF
public static final int ORDER_SOH
public static final int ORDER_RA
public static final int ORDER_EA
public static final int ORDER_IC
public static final int ORDER_MC
public static final int ORDER_ESC
public static final int ORDER_WEA
public static final int ORDER_TD
public static final int AID_F1
public static final int AID_F2
public static final int AID_F3
public static final int AID_F4
public static final int AID_F5
public static final int AID_F6
public static final int AID_F7
public static final int AID_F8
public static final int AID_F9
public static final int AID_F10
public static final int AID_F11
public static final int AID_F12
public static final int AID_F13
public static final int AID_F14
public static final int AID_F15
public static final int AID_F16
public static final int AID_F17
public static final int AID_F18
public static final int AID_F19
public static final int AID_F20
public static final int AID_F21
public static final int AID_F22
public static final int AID_F23
public static final int AID_F24
public static final int AID_CLEAR
public static final int AID_ENTER
public static final int AID_HELP
public static final int AID_PGUP
public static final int AID_PGDN
public static final int AID_PRINT
public static final int AID_RECORD_BACKSPACE
public static final int AID_FORWARD_EDGE_AUTO_ENTER
public static final int AID_PA1
public static final int AID_PA2
public static final int AID_PA3
public DataStream5250(HostSession5250 hs, Display5250 d)
public void setTerminalType(String terminal)
public String getTerminalType()
public void requestHelp(int errorCode)
public void sendSystemRequest(String text)
public boolean sendAttention() throws IOException
IOException
- if a data stream problem occurs.public boolean sendTestRequest() throws IOException
For specific Test Request key sequences, refer to the IBM 5494 Remote Control Unit User's Guide.
IOException
- if a data stream problem occurs.public Field getFieldFromAddress(int addr)
public Field getFieldFromAddress(int x, int y)
public boolean sendPF(int nn) throws IOException
IOException
- if a data stream problem occurs.public boolean sendPA(int nn) throws IOException
IOException
- if a data stream problem occurs.public boolean sendEnter() throws IOException
IOException
- if a data stream problem occurs.public boolean pageUp() throws IOException
IOException
- if a data stream problem occurs.public boolean pageDown() throws IOException
IOException
- if a data stream problem occurs.public void sendRecordBackspace() throws IOException
When the Home key is pressed with the cursor already at the home position, a record backspace is requested; the keyboard is locked and the AID code (X'F8') and cursor address are sent to the AS/400 system. The AS/400 system should respond by repeating the writing of the previous record to the display.
IOException
- if a data stream problem occurs.public boolean sendHelp(boolean inErrorState) throws IOException
If the display is not in an operator-error state and the workstation operator presses the Help key, the workstation issues an X'F3' AID byte to the AS/400 system. If, however, the workstation operator presses the Help key after pressing the Cmd key or the Sys Req key, an error results.
IOException
- if a data stream problem occurs.public void processData(short[] buf, int buflen)
Data Stream Format:
The actual data stream that is exchanged between the client and server is composed of a header followed by the 5250 work station data stream. For information about the 5250 work station data stream refer to the IBM 5250 Information Display System, Functions Reference Manual (SA21-9247). The header which prefixes the 5250 data stream was originally designed for the 5250 Display Station Pass-Through (DSPT) application. 5250 DSPT is an application similar to Telnet which runs on the IBM AS/400, System/36, and System/38 over an SNA network. This header is designed to be variable in length and is composed of two parts. The first, fixed part is always 6 bytes long and has the following format:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Logical Record Length | Record Type | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Logical Record Length: 16 bits
This field indicates the length, in bytes, of this logical record including the header length. The length is specified with the most significant byte first. For example, a length of 36 (decimal) would be specified as '0024'X.
Record Type: 16 bits
This field indicates the SNA record type. It should always be set to '12A0'X to indicate the General Data Stream (GDS) record type.
Reserved: 16 bits
This field is currently not used.
The second part of the header is designed to be variable in length. The length of this variable part is specified in the first byte. Currently this portion of the header will always be 4 bytes long and has the following format:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |E|A| | | |S|T|H| | | | Var Hdr Len |R|T| | | |R|R|L| | Opcode | | |R|N| | | |Q|Q|P| | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Var Hdr Len: 8 bits
The length, in bytes, of the variable portion of the header. Currently this is always '04'X.
Flags: 16 bits
Bit 0: ERR This bit is set to indicate a data stream output error. The negative response code is sent as data following the opcode field. Bit 1: ATN This bit is set to indicate that the 5250 attention key was pressed. Bits 2-4: * These bits are reserved (set to zero). Bit 5: SRQ This bit is set to indicate that the 5250 System Request key was pressed. Bit 6: TRQ This bit is set to indicate that the 5250 Test Request key was pressed. Bit 7: HLP This bit is set to indicate the Help in Error State function. The error code is sent as data following the header and is a four digit packed decimal number. For example, an error code of '0005'X indicates the operator attempted to type in an area of the display that is not enabled for input. Bits 8-15: * These bits are reserved (set to zero).
Opcode: 8 bits
This field contains the operation code. It is set to indicate the type of operation requested by the sender. The following are the valid values:
'00'X: No Operation '01'X: Invite Operation '02'X: Output Only '03'X: Put/Get Operation '04'X: Save Screen Operation '05'X: Restore Screen Operation '06'X: Read Immediate Operation '07'X: Reserved '08'X: Read Screen Operation '09'X: Reserved '0A'X: Cancel Invite Operation '0B'X: Turn On Message Light '0C'X: Turn Off Message LightThe actual 5250 work station data stream will immediately follow the opcode field in the header and will be terminated by the IAC EOR pair (not included in the buffer).
For some operations the header will be immediately followed by an IAC EOR without any 5250 work station data stream in between.
For example, the following request to turn on the message light could be sent by the server:
000A 12A0 0000 0400 000B FFEF | | | | | | | | | | | | | End Of Record marker | | | | | | | | | | | Opcode = Turn On Message Light ('0B'X) | | | | | | | | | Flags = '0000'X | | | | | | | Variable Header Length = '04'X | | | | | Reserved - Set to '0000'X | | | Record Type = General Data Stream ('12A0'X) | Logical Record Length = '000A'X for this recordIn this example the requested operation is indicated by the opcode and there is no associated work station data stream.
public boolean isPrintable(int ch)
public char convertEBCDICToChar(byte b)
public byte convertCharToEBCDIC(char c)
public boolean isAttribute(int ch)
public FormatTable getFormatTable()
public boolean checkInputFields()
public boolean checkInputFields(boolean isEnterKey)
public int getHomeAddress()
public String getAddressString(int addr)
public static String getAddressString(Display5250 display, int addr)
public String getAddressString(int x, int y)
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.