1.0 Product overview

Mocha TN5250 is a 5250 emulator written in java, which makes it possible from a java enabled browser, to connect an AS/400 server. The AS/400 - also called the "IBM iSeries," is a midrange server from IBM, designed for the business world.

1.1 Functionality

1.2 Clipboard

Use the mouse to select an area, or 2 x click a word on the screen. Use ALT+C to copy, ALT+V to paste. ALT+A to select all. CTRL+C+V and X can also be used.

1.3 Connect

It is possible to connect to a host from the File menu. A pop-up window is shown. Enter a host name and a port number . The port number for TN5250 is default 23, and SSL/TLS 992.

Another solution is to give the ip and port address in the HTML file loading the TN5250 applet.

1.4 Function keys

Function keys can be used from the keyboard, or the toolbar

1.5 Focus

If keyboard focus, the cursor will be shown. On some browsers, focus must be clicked after a dialog box, such as the connect dialog has been closed.

1.6 Status line

1.7 Known problems with Applets

2.0 Parameters

Parameters to Mocha TN5250 is given in the HTML file loading the java application. Nothing is stored on the users workstation.

2.1 HTML page

An applet is defined in a HTML page with label <APPLET>. See other source of information for how to write HTML. An example of a HTML page:
            <TITLE> Mocha TN5250 example </TITLE>
            <APPLET CODE="tn5250.class" ARCHIVE="tn5250.jar"
                WIDTH="800" HEIGHT="500" scriptable="true">
            <param name="host" value="myas400">
            <param name="port" value="23">
            <param name="ssl" value="false">
            <param name="27x132" value="true">
            <param name="ebcdic" value="37">
            <param name="autoconnect" value="false">
            <param name="keylayout" value="">
            <param name="user" value="">
            <param name="password" value="">
            <param name="license" value="">
            <param name="license_key" value="">
            <param name="hotspots" value="true">
            <param name="font" value="Courier New">
            <param name="fontstyle" value="Plain">
            <param name="margin" value="36">
            <param name="tool_bar" value="true">
            <param name="menu_bar" value="true">
            <param name="show_fxx" value="true">
            <param name="negotiate" value="false">
            <param name="debug" value="false">
            <param name="color_bg" value="#000000">
            <param name="color_cursor" value="#FFFFFF">
            <param name="color_select" value="#808080">
            <param name="color_red" value="#FF0000">
            <param name="color_blue" value="#5E98FE">
            <param name="color_pink" value="#FF00FF">
            <param name="color_green" value="#00FF00">
            <param name="color_turquoise" value="#00FFFF">
            <param name="color_yellow" value="#FFFF00">
            <param name="color_white" value="#FFFFFF">
            <param name="keylayout" value="default">
            <param name="keepalive" value="false">
            <param name="show-f1-f12" value="true">
            <param name="show-f13-f24" value="false">
            <param name="show-extra" value="true">
            <param name="2xclick" value="false">
            <param name="nodialog" value="false">
            <param name="ignorexhelp" value="true">
            <param name="fieldexit" value="false">
            <param name="beep" value="true">
            <param name="hideviewmenu" value="false">
            <param name="hideoptionmenu" value="false">
            <param name="smallconnectdialog" value="false">
            <param name="separator" value="true">
            <param name="devicename" value="">
CODE parameter must always be "TN5250.class". It is the name of the master file for the binary Mocha TN5250 product. To use the full width use "100%"

Each parameter is build of a name and a value. In the example above parameter host is given value myas400. It is very important to remember <> around each line, and the value must be surrounded with "".

As to give keyboard focus to the applet when loaded add a small script:

            <script type="text/javascript">
            onload = function()
            document.getElementsByTagName( "APPLET" )[0].focus();

2.2 Parameter keylayout

It is possible to define a keyboard mapping, such as what shift + f5 should do in a customized file. If "default" is used, a default file included in the jar file will be used. If a filename as "keys52" is given, this file must exist in the same folder on the Web server, as the TN5250.jar file.


  name=keylayout value="<a file name>"

2.3 Parameter license

Name of the company using Mocha TN5250. Should only be included together with parameter "license_key".


  name=license value="<name of a company>"

2.4 Parameter license_key

When ordering Mocha TN5250, an encrypted license code will be received. Use this together with parameter "license" to remove the time limit for a session. The license key for the Java version start with "E". A license key for another MochaSoft product cannot be used.


  name=license_key value="<encrypted key>"

2.5 Parameter user and password

Use these two options to perform auto login, when the applet is loaded. Of course it can not be recommended to include a secret login and password in a HTML page, as everyone can read the source from a browser.

  name=user value=<userid>
  name=password value=<password>


  name=user value="joe"
  name=password value="password"

2.6 Parameter ebcdic

The EBCDIC codepage should be the same as on the AS/400. Following values are supported


  name=ebcdic value="codepage number"


  name=ebcdic value="277"

2.7 Parameter hotspots

If it should be possible to click on keys displayed on the screen, such as F3=exit. Also URLS starting with www. , http:// or https:// can be clicked


  name=hotspots value="true | false"

 Default is false.

2.8 Parameter show-f1-f12

If toolbar should include keys f1 - f12


  name=show-f1-f12 value="true | false"

 Default is true.

2.9 Parameter show-f13-f24

If toolbar should include keys f13 - f24


  name=show-f13-f24 value="true | false"

 Default is false. Press shift and f1-f12 becomes f13-f24.

2.10 Parameter show-extra

If toolbar should include extra 5250 keys, such as page up/down


  name=show-extra value="true | false"

 Default is true.

2.11 Parameter 2xclick

A double click put the cursor at the position, and send a 5250 ENTER command to the server.


  name=2xclick value="true | false"

 Default is true.

2.12 Parameter nodialog

A click on menu - connect or toolbar connect icon, will not display the dialog for the IP address and other information, but a new session is started to the as/400 using the IP address from the HTML page.


  name=nodialog value="true | false"

 Default is false.

2.13 Parameter ignorexhelp

If 5250 should accept pre-help state. If this is the case, the user must press help or reset to continue the session


  name=ignorexhelp value="true | false"

 Default is true.

2.14 Parameter fieldexit

If tn5250 should require field+/- to be used, when the AS/400 program request it.


  name=fieldexit value="true | false"

 Default is false.

2.15 Parameter beep

if messages and bell function should give a sound.


  name=beep value="true | false"

 Default is true.

2.16 Parameter hideviewmenu

If the menu bar element "view" should be displayed.


  name=hideviewmenu value="true | false"

 Default is false.

2.17 Parameter hideoptionmenu

If the menu bar element "options" should be displayed.


  name=hideoptionmenu value="true | false"

 Default is false.

2.18 Parameter smallconnectdialog

If the connect dialog should only have ip, port and ssl/tls option displayed


  name=smallconnectdialog value="true | false"

 Default is false.

2.19 Parameter tool_bar

Defines if the toolbar below the menu bar should be shown.


  name=tool_bar value="true | false"

 Default is true.

2.20 Parameter menu_bar

Defines if the menu bar should be shown.


  name=menu_bar value="true | false"

 Default is true.

2.21 Parameter show_fxx

Defines if the f1 - f24 and extra keys keys should be in the tool bar.


  name=show_fxx value="true | false"

 Default is true.

2.22 Parameter color_bg

The color of the background can be defined with this parameter.


  name=color_bg value="#rrggbb"


The syntax is the same as used in the HTML language.


  name=color_bg value="#20f030"

2.23 Parameter color_xxx

The colors the as/400 program request, can be defined with this parameter.

  name=color_red value="#rrggbb"
   name=color_blue value="#rrggbb"
   name=color_pink value="#rrggbb"
   name=color_green value="#rrggbb"
   name=color_turquoise value="#rrggbb"
   name=color_yellow value="#rrggbb"
   name=color_white value="#rrggbb"


The syntax is the same as used in the HTML language.

2.24 Parameter color_select

The color used to mark an area for clipboard copy can be defined with this parameter.


  name=color_select value="#rrggbb"


The syntax is the same as used in the HTML language.

2.25 Parameter color_cursor

The color of the cursor can be defined with this parameter.


  name=color_cursor value="#rrggbb"

The syntax is the same as used in the HTML language.

2.26 Parameters host and port

These parameters defines which host to connect, when the applet is loaded. The default port number for TN5250 is 23 and SSL/TLS 992.

  name=host value=<a host name>
  name=port value=<number>

The host name can either be a name or an Internet address as There is not a real server at this address!

2.27 Parameter SSL

Mocha TN5250 can use SSL/TLS layer from the SUN Java layer. SSL/TLS can only be used, if the AS/400 certificate is not using MD5. A self signed certificate may use MD5.


  name=SSL= value="true | false"

 Default is false

2.28 Parameter autoconnect

Mocha TN5250 can make a connection when the applet has been loaded.


  name=autoconnect= value="true | false"

 Default is false

2.29 Parameter 27x132

Mocha TN5250 screen size can be 24x80 or 27x132. TN5250 will always start in 24x80 mode, but an AS/400 application can request for 27x132 mode, if this parameter is true.


  name=27x132 value="true | false"

 Default is false

2.30 Parameter font and font style

Possible to define the display font

  name=font value="font name"
  name=fontstyle value="style"

Default is Courier. To see the font names possible to use, start mocha TN5250 in a browser, and select menu - settings - font.

Possible font styles are :Plain,Bold, Italic and Bold Italic.

2.31 Parameter keepalive

TN5250 can send keep alive frames at 10 second intervals.


  name=keepalive= value="true | false"

 Default is true

2.32 Parameter margin

Margin to be used around a screen print


  name=margin= value="36"

 Default is 36

2.33 Parameter devicename

Device name for the session. In most cases this parameter should not be used, as an AS/400 only allows one session with a given device name


  name=devicename value="<a devicename in upper case>"

2.34 Parameter separator

If TN5250 should display the separator attribute


  name=separator= value="true | false"

 Default is true

3.0 Keyboard mapping

As it is individual how to map the keyboard, all function keys has been made changeable. If parameter "keylayout" is not used or defined as default, a standard keyboard mapping file from the TN5250.jar file will be used. See 3.1

The package includes an example keyboard file keys52, which can be used with parameter "keylayout".

Syntax for file "keys52":

Following keys can be defined:

The pc-key's are:
fxx : xx is 1 .. 24 (function key f1 - f12)
Fxx : xx is 1 .. 24 (shift + function key f1 - f12)
cfxx : xx is 1 .. 24 (ctrl + function key f1 - f12)
CFxx : xx is 1 .. 24 (shift + ctrl + function key f1 - f12)

The 5250 keys are:

pf1 - pf24
erase (erase all input fields)
record (record Backspace (Home)
pgup (roll down)
pgdn (roll up)
help (send help request to the host)
clear (send clear request to the host)
reset (reset keyboard)

Example of a "keys" file:

            # TN5250  keymap
            # f1 = f1 key , F1 = shift F1
            # cf1 = f1 + ctrl  CF1 = shift f1 + ctrl
            # <pc - key>  <5250 key>
            f1   pf1
            f2   pf2
            f3   pf3
            f4   pf4
            f5   pf5

3.1 Default keyboard

The default file "keys52", contains following mapping of the keyboard:

            pc-Key       5250-key       pc-key              5250-key
            -----------------------      -----------------------------
            f1              PF1          crtl f1              FIELD-
            f2              PF2          ctrl f2              FIELD+
            f3              PF3          ctrl f3              -
            f4              PF4          ctrl f4              ATTN
            f5              PF5          ctrl f5              SYSREQ
            f6              PF6          ctrl f6              INSERT
            f7              PF7          ctrl f7              ERASE INPUT
            f8              PF8          ctrl f8              DUP
            f9              PF9          ctrl f9              -
            f10             PF10         ctrl f10             -
            f11             PF11         ctrl f11             -
            f12             PF12         ctrl f12             -
            pc-Key       5250-key       pc-key              5250-key
            -----------------------      -----------------------------
            shift f1        PF13         crtl shift f1        HELP
            shift f2        PF14         ctrl shift f2        CLEAR
            shift f3        PF15         ctrl shift f3        RESET
            shift f4        PF16         ctrl shift f4        -
            shift f5        PF17         ctrl shift f5        -
            shift f6        PF18         ctrl shift f6        -
            shift f7        PF19         ctrl shift f7        -
            shift f8        PF20         ctrl shift f8        -
            shift f9        PF21         ctrl shift f9        -
            shift f10       PF22         ctrl shift f10       -
            shift f11       PF23         ctrl shift f11       -
            shift f12       PF24         ctrl shift f12       -

            pc-Key       5250-key
            HOME         RECORD
            END          FIELDEXIT
            PGUP         PGUP
            PGDN         PGDN
            ESC          RESET KEYBOARD
            RETURN       ENTER
            CTRL         RESET
            KEYPAD PLUS  FIELD+

4.0 License System

The license system for Mocha TN5250 is very user friendly. The encrypted parameter "license_key", together with parameter "license" gives a check for legal use. It is not possible to change the company name in "license", without requesting a new key from MochaSoft.

If parameter "license_key" is not given, the program will run in Demo mode, and a session is restricted to 180 seconds