Moving from go3270 to go-ibmterm¶
go-ibmterm is the next version of D-Modem/go3270. It serves 3270 and 5250 terminals with one screen model, and its API is different. This page tells how to change a program that uses go3270.
Packages¶
| Old | New |
|---|---|
github.com/D-Modem/go3270 (package go3270) |
github.com/D-Modem/go-ibmterm (package ibmterm): the screen model |
github.com/D-Modem/go-ibmterm/tn3270: the 3270 data stream |
|
github.com/D-Modem/go-ibmterm/tn5250: the 5250 data stream |
Screen, Field, Color, Highlight, Response, ScreenOpts,
ShowScreenOpts, HandleScreen, RunTransactions, Rules and the code
pages are in ibmterm. The telnet negotiation, the query replies, the
graphics and IND$FILE are in tn3270.
Changes¶
- Change
go3270.NegotiateTelnet(conn)totn3270.NegotiateTelnet(conn). It returns atn3270.DevInfo, which is anibmterm.Terminal. - Change
ScreenOpts.AltScreentoScreenOpts.Terminal. The field is necessary.ShowScreenOptsreturnsibmterm.ErrNoTerminalif it is nil. The library writes to the screen ofTerminal.Size(), or to the default screen whenScreenOpts.DefaultScreenis true (see 3270 screen sizes). - You do not have to set
ScreenOpts.Codepage. The library uses the code page of the Terminal. Set it only to use a different code page. - Change
HandleScreenandHandleScreenAltto the newHandleScreen. Its last argument is the Terminal. The optional code page argument is gone. -
Change
Response.AIDtoResponse.Key, and the typeAIDtoKey. Change the AID constants:Old New AIDEnterKeyEnterAIDPF1toAIDPF24KeyF1toKeyF24AIDPA1toAIDPA3KeyPA1toKeyPA3AIDClearKeyClearAIDNoneKeyNoneAIDtoString(aid)key.String()(for example "F3", not "PF3") -
Change
DevInfo.AltDimensions()toTerminal.Size(). - A
Txfunction gets anibmterm.Terminal, not aDevInfo. Use a type assertion totn3270.DevInfofor the features of a 3270 only. ShowScreen()andShowScreenNoResponse()are gone. UseShowScreenOpts().
New¶
Terminal.Kind()tells if the terminal is a 3270 or a 5250.Terminal.Color()tells if the terminal shows colors.Key.HasData()tells if the client sends the fields with a key.KeyPageUp,KeyPageDown,KeyHelp,KeyPrint,KeyAttnandKeySysReqcome from a 5250. A 3270 does not send them.ibmterm.CodepageByID()returns a code page by its IBM number.
Refer to TN5250 for the 5250 data stream.