RFC 1646

TN3270 Extensions for LUname and Printer Selection

πŸ“… published July 1994, from ietf

RFC 1646: TN3270 Extensions for LUname and Printer Selection πŸŽ€

okay bestie, this one is from the Network Working Group πŸ’… It was written by C. Graves, T. Butts, and M. Angel, all from Open Connect Systems, and it came out in July 1994 🌸. The category is Informational, so it's giving "here's some info for the community," not an Internet standard. The header doesn't list anything it obsoletes or updates 🧚.

Status of This Memo πŸ’–

This memo gives information to the Internet community. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited ✨.

Abstract πŸ¦‹

Okay so this doc describes protocol extensions to TN3270, and there are two of them πŸ‘‘. The first lets a TN3270 client request a specific device (an LUname) from a TN3270 server. The second is how a TN3270 printer device can be requested by a client, plus how the 3270 printer status info gets sent back to the server πŸ–¨οΈ. Ideas and suggestions for improving these should go to the TN3270E Working Group mailing list, TN3270E@list.nih.gov πŸ“¬. These extensions are called TN3287 in this document. It's meant for anyone in the Internet community who wants to support the 3287 data stream inside the TELNET protocol 🫢.

1. INTRODUCTION ✨

Talking to IBM mainframe systems comes with a bunch of unique requirements πŸ“. This document handles those needs on a TCP/IP network.

IBM terminals are generically called 3270s. That covers a wide range of devices, and not all of them actually start with 327x, so don't be fooled πŸ™ˆ.

The 3270 terminals and the IBM mainframe apps are VERY closely coupled 😭. The way 3270s and the apps interact is exactly why this doc needs to exist. It gives the TCP/IP world a consistent way to work with 3270 applications on the mainframe.

Mainframe apps have been around for almost two decades and serve tens of thousands of users every day πŸ’…. That's why a mainframe environment usually wants TCP/IP support WITHOUT having to write brand new apps for the TCP network. The TN3270 series of docs covers how to do that while staying compatible with those mainframe apps 🧚.

3270 terminals have a really iconic trait: they send status info in an out-of-band data flow πŸ”₯. Apps use that status for error recovery and conflict resolution. Examples are a printer being out of paper, or a terminal being powered up πŸ’€. Terminals also run half duplex and in block mode, so they need to communicate when blocks are being sent, when they end, and when they can't be sent 🌈. This doc describes all of that in IBM VTAM/SNA terms. Some VM mainframe app systems don't use VTAM, so those terms don't apply to them. For any system that does use VTAM, the terms apply and get handled somehow by the TCP/IP to VTAM interface πŸ’–.

VTAM/SNA is a hierarchical network, and some of that hierarchy has to be dealt with by the TCP network attaching to it. Otherwise the apps can't keep giving the 3270 terminals the same support they always had ⭐.

The 3270 terminal setup is a terminal controller with terminals attached to it. In VTAM/SNA, the controller is called a PU (Physical Unit) and the terminals are called LUs (Logical Units) πŸŽ€. The PU sends management info to the VTAM/SNA system, and the LU is how the app talks to the terminal. VTAM/SNA gives every LU and PU a unique name in the network. Those names are called LUnames and PUnames, and they're how the network gets managed and how apps figure out which terminals they're talking to πŸ¦‹. The actual connection between a terminal and an app is called a session, and that session carries both in-band and out-of-band info between the app and the terminal 🫢.

Okay here's the wild part: VTAM/SNA 3270 terminals actually have two sessions going at once when they talk to an app 😭. One is directly connected to the app. The other is directly connected to VTAM. The VTAM one (also called the SSCP) carries the out-of-band flows. It's called the SSCP-LU session. The app one is called the LU-LU session, because in VTAM an app is just another Logical Unit πŸ’….

One of those out-of-band flows is the LUSTAT message. It tells the app that the terminal's status has changed. It's how a printer or screen says "I'm ready" or "I'm not ready" to take data πŸ–¨οΈ.

Some flows also have to travel in the LU-LU session to help apps control the terminal ✨. A block of info sent in a session is called an RU (Request Unit). The RU says what kind of data is in the block, how long it is, and whether more RUs are coming along 🌸. This is a super simplified take on what RUs are and do, but it should help you get why they show up in the TN3270 docs 🧚. Some VTAM/SNA terms for what an RU is asking for are:

  • Chains/chaining, which tell a session partner whether another RU is being sent in this transmission or not.
  • Brackets, which show that a unit of work is complete, like when a printout of a file is finished πŸ’–.

Which parts of VTAM/SNA (like brackets and chaining) get used is decided by VTAM tables called LOGMODE tables πŸ‘‘. These tables get selected when an LU-LU session starts, and they set things like bracket and/or chaining protocols. They also set the type of terminal data in the RUs. That could be printer data without screen formatting (LU type 1), 3270 screen formatted data (LU type 2), or 3270 screen formatted data for a printer (LU type 3) πŸ¦‹. LOGMODE tables also hold the size of the RU to send and receive. They communicate screen sizes for 3270 terminals too, like 24X80 (Model 2) and 27X132 (Model 5), and so on πŸ“. Each LU has a LOGMODE table entry hard-assigned to it as part of the VTAM configuration (often called a GEN) πŸŽ€. The terminal LU or PU can't control which table entry gets picked. Only the user can pick it at connection or logon time, or the app can pick it when the connection gets set up πŸ™ˆ. The actual LOGMODE entries used in a session are sent at session logon time, inside a special RU called a BIND πŸ”₯. Once the BIND has been sent, the rules for using the session are set. They can't be changed, and they must be followed 😀.

The point of the TN3287 protocol is to give a general IBM 3270 host printer communications facility πŸ–¨οΈ. Its main goal is a way to connect printer devices and printer-oriented processes to each other ✨. This protocol lets a TN3270 Client process 3287 print data streams πŸ’….

This memo supplements and extends STD 8, RFC 854, TELNET Protocol Specification 🌈. It also presents an example of correct implementation 🫢.

2. GENERAL CONSIDERATIONS 🌸

A TELNET connection is a Transmission Control Protocol (TCP) connection. It's used to send data with TELNET control info interspersed in it πŸ’–.

For more on the TELNET commands, codes, and code sequences this spec refers to, check out the companion doc, STD 8, RFC 854 -- "TELNET Protocol Specification" πŸ“–.

3. CLIENT-SERVER NEGOTIATION πŸ’…

The TN3270 Client and Server need a specific negotiation protocol 🀝. Once negotiation is complete, everything sent between the Client and Server is in TELNET Binary format, with a TELNET "End-Of-Record(EOR)" sequence at the end of each data stream πŸ¦‹.

For the client and server to support the TN3287 data stream, both sides need to:

  • A. Be able to exchange binary data.
  • B. Be able to agree on the terminal type that will be used.
  • C. Agree to use the TELNET IAC EOR as a delimiter for inbound and outbound TN3287 data streams πŸŽ€.

This implementation requires the options TERMINAL-TYPE and BINARY to be successfully negotiated between the Client and Server before any print data streams get processed πŸ”₯.

This implementation supports host apps that can mix LU 1 and LU 3 type data in the same data stream πŸ‘‘.

3.1 TN3287 SERVER πŸ–₯️

The max RU size is up to the server, but it should not exceed 4 kilobytes ✨.

The LU type comes from the BIND sent by the mainframe app. Once bound, the server must remember whether it's LU 1 or LU 3 type 🧚.

The server will automatically unbind the session when it receives a TELNET CLOSE command. Until a new TELNET connection gets set up, VTAM will see the printer as powered down πŸ’€.

3.2 TN3287 CLIENT πŸ–¨οΈ

The TN3287 Client is a TN3270 client made specifically to print mainframe 3270 print data 🌸. It emulates the IBM device type it identifies itself as to the TN3270 server. In this case, that's an IBM 3287 model 1 type printer πŸ’–. The design of this printer protocol matches how printing happens on the IBM host and how 3270 printers work ⭐.

These printer extensions DO NOT support a 3270 printer client that can't accept both LU 1 and LU 3 printer streams πŸ™…β€β™€οΈ. No IBM printer works that way, so no TN3270 server could work properly with mainframe apps if it didn't allow mixing LU 1 and LU 3 data streams 😭.

The common way this happens is printer sharing between multiple IBM host apps, like CICS and JES πŸ¦‹. Since there's no restriction, JES can be set up to output LU 1 data streams, while CICS can be set up for LU 3 data streams πŸ“. So the server figures out which LU type the current app connected to it is using. If that type is LU 1, then ALL message records sent to the Client get a single byte of binary zeros (0x00) in front of them πŸ”₯. If the first byte isn't zeros, that byte is a valid LU type 3 Write-Command-Code (WCC), and a WCC can NEVER be zeros πŸ‘‘. That means the client can tell the LU type of the data as each record arrives 🫢.

The protocol also lets the client shut down if it doesn't want to support both LU types πŸ›‘. It does this by detecting an invalid data type in a received record. Then it tells the user that the mainframe app sent LU type x print data and should be configured for LU type y printing πŸ’….

4. COMMAND STRUCTURE πŸŽ€

  1. All TELNET commands consist of at least a two-byte sequence: the "Interpret-as-Command(IAC)" escape character, followed by the code for the command ✨.
NOTE: Since the TELNET IAC character (255 decimal) is used as a delimiter (together with EOR) in the inbound and outbound data streams, a data byte in the data stream that has the same value as the IAC command is sent as two bytes (255, 255), and one byte is discarded πŸ™ˆ.

4.1 TELNET COMMANDS πŸŽ€

okay so WILL and DO are the commands you use to ask for permission (and say yes to it πŸ’…) before any subnegotiation happens. Both sides must exchange WILL TERM-TYPE and DO TERM-TYPE before subnegotiation. 🫢

The actual info swap happens inside the option subcommand ✨

Here's the lineup:

  • <IAC DO TERMINAL-TYPE> means the sender is asking the other party to start terminal-type sub-negotiation 🌸
  • <IAC WILL TERMINAL-TYPE> means the sender is down to send terminal-type info in a later sub-negotiation πŸ’–
  • <IAC SB TERMINAL-TYPE SEND IAC SE> means the sender is asking the receiver to send over its terminal-type πŸ¦‹
  • <IAC SB TERM TYPE IS IBM-3287-1 IAC SE> is the sender stating its terminal-type name. The code for <IS> is 0. You can optionally request a specific Logical Unit (LU) by adding a LUname to the TERMINAL-TYPE string below. If you don't give a LUname, the first available 3287 LU gets picked. πŸ‘‘
IAC SB TERM-TYPE IS IBM-3287-1 @ LUNAME IAC SE
  • <IAC DO BINARY> means the sender wants the data sender to start transmitting, or is confirming that the data sender is expected to transmit characters the receiver will read as 8 bits of binary data πŸ”₯
  • <IAC WILL BINARY> means the sender is asking for permission to start transmitting, or confirming it's about to start sending binary data 🌈

An <EOR> gets sent at the end of each SNA Request Unit (RU) end of chain, in either direction. The first byte right after the <EOR> is a Write-Command-Code (WCC) for LU 3 data streams 🧚

An <AO> gets sent at the end of the SNA RU and end of bracket. This is the signal that the IBM host application is done with the print output or file, and it might mean the LU type is changing too πŸ’€


4.2 COMMAND VALUES πŸ’œ

Here are the numbers, the codes, the whole vibe πŸ“

                     TELNET COMMAND                     CODE
                     IAC  Interpret as Command           255
                     DO                                  253
                     WILL                                251
                     SB  SuBnegotiation option           250
                     SE  Subnegotiation End              240
                     TERMINAL-TYPE                        24
                     SEND                                  1
                     IS                                    0
                     EOR  End-Of-Record                   25
                     BINARY                                0
                     AO  Abort Output                    245
                     IP  Interrupt Process               244
                     AYT  Are You There                  246
                     BREAK                               243

NOTE: ⚠️ These codes and code sequences only have their meaning when they come right after an "Interpret as Command (IAC)". Without the IAC in front, they're just numbers, bestie πŸ™ˆ


5. TN3270 Printer Status Message πŸ–¨οΈ

The status message can be sent at any time ✨ It must be sent every time the TN3270 Server sends an End-of-Record (EOR) indicator to the TN3270 Client, or when a printing error happens at the Client. Only the TN3270 Client sends the Printer Status Message. Once the End-Of-Record IAC is processed, the TN3270 Client sends the status message to the server when it's ready for more print data. πŸ’…

      MESSAGE DESCRIPTION:      SOH  %  R  S1  S2  IAC  EOR


                               SOH = 0X01
                               % = 0X6C
                               R = 0XD9
                               S1 = Status/Sense Byte 0
                               S2 = Status/Sense Byte 1
                               IAC = Telnet IAC Character
                               EOR = Telnet EOR Character

5.1 Status/Sense Byte description 🌷

5.1.1. S/S Byte 0:

Here's the layout, high order on the left and low order on the right πŸ¦‹

        High Order                                          Low Order


        _____________________________________________________________
        |                                                           |
        |   0      1      2      3      4      5      6      7      |
        |___________________________________________________________|


          Bit Number:       Bit Definition:

                0           Always Zero

                1           Always Zero
                2           Always Zero

                3           Always Zero

                4           Always Zero

                5           Unit Specify - is set due to an error
                            condition.  The reason for the error
                            condition will be indicated in S/S Byte 1.
                            See Note 1*.

                6           Device End - when this bit sent in response
                            to a data message it indicates the client
                            has successfully processed the data message
                            from the server and notifies the server to
                            send a new data message to the client when
                            available.   See Note 2*.

                7           Always Zero

Note 1* 🚨: A negative response to the Server's data message would be S/S Byte 0 Bit 5 "Unit Specify condition". The possible Unit Specify conditions are listed below. (See Section 3.2 for bit settings for the Unit Specify conditions listed below.)

                Unit Specify Condition:    SNA Sense Code sent to host:

                Command Rejected                     0X10030000
                Intervention Required                0X08020000
                Data Check                           0X10010000
                Operation Check                      0X10050000
                Component Disconnected (LU)          0X08020000

Note 2* 🌈: A positive response to the Server's data message would be the "Device End" bit (S/S Byte 0 Bit 6), which says the client is ready to receive data from the host. This also gets sent after clearing a previous Unit Specify condition of "Intervention Required".

5.1.2. S/S Byte 1:

Byte 1 is where the reasons live πŸ”

         High Order                                           Low Order

       ______________________________________________________________
       |                                                            |
       |    0      1      2      3      4      5      6      7      |
       |____________________________________________________________|


          Bit Number:       Bit Definition:


               0            Always Zero

               1            Always Zero

               2            Command Rejected (CR) -- This bit
                            indicates an invalid 3270 command
                            generated.

               3            Intervention Required - Printer Not Ready.
                            See Note 3*.

               4            Component Disconnected - Printer is powered
                            off or printer cable not connected.  See
                            Note 4*.

               5            Data Check - Invalid print data

               6            Always Zero

               7            Operation Check - An illegal buffer address
                            or incomplete order sequence

Note 3* πŸ–¨οΈ: The Intervention Required condition is cleared by sending an S/S message with the "Device End" bit (Bit 6 of S/S byte 0). The LUSTAT sent to the host is 0X00010000. The IBM host reads this as a "printer now ready" condition. πŸ’–

Note 4* πŸ”Œ: The Component Disconnected condition is cleared by sending an S/S message with the "Device End" bit (Bit 6 of S/S byte 0). The LUSTAT sent to the host is 0X082B0000. The IBM host reads this as a "printer now ready -- presentation space integrity may be lost" condition. 😭


6. The following is an example of the Client-Server negotiation process. πŸ§šβ€β™€οΈ

Here's the whole negotiation play-by-play, start to finish 🎬

      Server:   IAC DO TERMINAL-TYPE
      Client:        IAC WILL TERMINAL-TYPE
      Server:   IAC SB TERMINAL-TYPE SEND IAC SE
      Client:        IAC SB TERMINAL-TYPE IS IBM-3287-1 IAC SE

      Note: To request a specific LU the TERMINAL-TYPE string would be:
      IAC SB TERMINAL-TYPE IS IBM-3287-1 @ LUNAME IAC SE
      (The client has specified its terminal type is an IBM-3287-1)


      Server:   IAC DO END-OF-RECORD
      Client:        IAC WILL END-OF-RECORD
      Server:   IAC WILL END-OF-RECORD
      Client:        IAC DO END-OF-RECORD

      (The Server and Client have both agreed to transmit End-Of-Record
      (EOR)).


      Server:   IAC DO TRANSMIT-BINARY
      Client:        IAC WILL TRANSMIT-BINARY
      Server:   IAC WILL TRANSMIT-BINARY
      Client:        IAC DO TRANSMIT-BINARY
      (The Server and Client have both agreed to use binary
      transmission)


      Server:   0x00 (3270 PRINT DATA)
      Client:        (S/S with DEV END) IAC EOR
      Server:   0x00 (3270 PRINT DATA) IAC EOR

      NOTE:  LU 1 type data is prefaced with a 0x00 character. LU 3
      type data is not prefaced with a special character.  This
      character will precede print data in each chain, and should be
      discarded before the print data is processed.   An <IAC EOR> must
      be received before changing to LU 1 or LU 3 type data.

      Client:        (S/S with IR) IAC EOR (This indicates a paper jam
                    at printer.)
      Client:        (S/S with DE) IAC EOR (This indicates the clearing
                    of above condition.)
      Server:  0x00 (3270 PRINT DATA) (This indicates start of LU 1
               data)

      Server:   (3270 PRINT DATA)
      Server:   (3270 PRINT DATA)
      Server:   (3270 PRINT DATA) IAC EOR
      Client:        (S/S with DE) IAC EOR
      Server:   0x00 (LAST 3270 PRINT DATA) IAC EOR


      Client:        (S/S with DE) IAC EOR
      Server:   IAC AO
      (The Abort Output <AO> signifies the end-of-bracket -- end of
      print job)

7. SECURITY CONSIDERATIONS πŸ”

Okay, this part is serious, bestie 😭 This document does not specify a security methodology to make sure the client asking for a printer LU name is actually allowed to access that LU. Right now, that's left up to each individual server implementation πŸ™ˆ The protocols described here are designed so that encryption and authentication RFCs can be added later. 🫢 Before that can happen, though, certain extensions might be needed to the protocols in this document, or to the encryption and authentication services and protocols. Be careful out there πŸ’œ

8. ERROR CONDITIONS πŸ’…

Okay so once a client and server have successfully finished negotiating, the server can still run into a bunch of error conditions 😭. When that happens, the server has to notify the client and abort the connection. Not ideal, but it's giving responsible 🫢.

When the server detects an error condition, it has to negotiate the client back into NVT mode. It does this by sending a WONT/DONT BINARY TELNET sequence, and the client replies with the appropriate DONT/WONT BINARY TELNET sequence πŸ”.

The server should immediately send the right error message to the client as an ASCII string and then close the connection πŸšͺ. The message should start with a numeric identifier so the client knows exactly what went wrong. The error message should also be routed to the proper console or log so someone can fix it πŸ› οΈ.

Here's the list of error conditions. Each one has a numeric value, the error text, what it means, and how to recover πŸ“‹.

  • "01 No LU's of the type configured"
    • Meaning: The server's configuration doesn't include the LU type that was requested πŸ™ˆ.
    • Recovery: Notify your Systems Administrator, because this is a permanent error condition πŸ’€.
  • "02 Requested LU unavailable"
    • Meaning: The requested LU isn't available right now 😩.
    • Recovery: This might be temporary, so it can be retried periodically πŸ”„. If the condition persists, contact your Systems Administrator πŸ“ž.
  • "03 Requested LU type is inconsistent with configuration"
    • Meaning: The LU that was requested doesn't match the terminal type in the server configuration 🚫.
    • Recovery: Notify your Systems Administrator, because this is a permanent error condition πŸ’€.
  • "04 Requested LU is not configured"
    • Meaning: The LU isn't defined in the server configuration πŸ«₯.
    • Recovery: Notify your Systems Administrator, because this is a permanent error condition πŸ’€.
If a client receives a message that isn't on the list above, the message should be displayed to a console or log, and the connection to the server should be closed. No other recovery should be attempted, because this is most likely a fatal error condition. (Notify your Systems Administrator.) 🚨

9. REFERENCES πŸ“š

  • [1] Postel, J., and J. Reynolds, "TELNET Protocol Specification", STD 8, RFC 854, USC/Information Services Institute, May 1983. 🌸
  • [2] VanBokkeln, J., "TELNET Terminal-Type Option" RFC 1091, FTP Software Inc., February 1989. πŸŽ€
  • [3] Postel, J., and J. Reynolds, "TELNET Binary Transmission", STD 27, RFC 856, USC/Information Services Institute, May 1983. πŸ¦‹

Authors' Addresses 🧚

Cleve Graves
2711 LBJ Freeway
Dallas, Texas  75234

Phone: (214) 484-5200
EMail: cvg@oc.com


Thomas Butts
2711 LBJ Freeway
Dallas, Texas  75234

Phone: (214) 484-5200
EMail: tom@oc.com


Michelle Angel
2711 LBJ Freeway
Dallas, Texas  75234

Phone: (214) 484-5200
EMail: angel@oc.com
πŸ“¦ where this page comes from