jlang(4) DEVICES AND NETWORK INTERFACES jlang(4)
NAME
jlang - EXPRESS HLLAPI user program for automating simple
interactions with a host
SYNOPSIS
jlang ScriptFileName SessionShortName
DESCRIPTION
jlang is an HLLAPI user program that can be used to automate
simple interactions with an IBM host for EXPRESS TN3270-C.
Essentially, jlang sends and receives strings, and can con-
ditionally execute commands based on the content of the
strings. The jlang program is invoked when a host session is
activated via tn3270c(1).
ARGUMENTS
ScriptFileName
is a text file containing jlang script commands. These
commands can be used to automate logon or other simple
procedures.
SessionShortName
is the short name for the host session that will use
the jlang script.
AUTOMATIC LOGON
EXPRESS TN3270-C has special built-in support for the use of
jlang to perform automatic logon to host sessions.
There are two methods of invoking jlang for automatic logon.
One method uses the Session Group configuration file
(*.sdf). In the file, use the LoginScript statement to
access the script, specifying the full pathname to the file
containing the script. See tn3270c(4) for more information.
The second method is to save the jlang script with the fol-
lowing file name:
Logon_SessionShortName.jl
Where SessionShortName is the single-character name defined
for the host session that will use the jlang script. In this
case, tn3270c(1) searches directories for the jlang script
in the following order:
1. Your current directory
2. $HOME/Express/tn3270c directory
3. $COMMLINK/$LOGNAME directory
Last change: 4/13/95 1
jlang(4) DEVICES AND NETWORK INTERFACES jlang(4)
4. $COMMLINK directory
GENERAL PURPOSE USE OF jlang
jlang is also useful as a simple, though limited, scripting
language. Of course, you can invoke jlang by typing a jlang
command line from an EXPRESS TN3270-C shell escape, but a
better technique is to specify the jlang command as the Com-
mand in the Session Group file for a local session. This
makes it possible to execute the jlang script by pressing
KM_SELECT followed by the session short name. This technique
effectively uses the local sessions as macros with single-
character names.
jlang SCRIPT COMMANDS
For convenience, jlang will accept a normal ASCII TAB char-
acter in its script file, and perform the 3270 TAB function.
SEND: Send the String on the following line. The
string may contain IBM-defined escape sequences
(part of the HLLAPI standard) which are inter-
nally translated into the proper characters or
actions. For example, to put a TAB character
into a string you are sending to the emulation,
you could specify the two characters "@T".
These two characters would perform the tab
function, advancing the cursor to the next
field. Do not use the escape sequences that
send AID keys or unexpected conditions may
result. This occurs because jlang automatically
sends the Enter key after each line of SEND:
input. A complete list of these escape
sequences can be found in the EXPRESS HLLAPI
Programmer's Guide, but the following list con-
tains the most common sequences used with a
jlang script:
@T Tab
@B BackTab
@0 Home ("at zero", not "at Oh".)
@U Up Arrow
@V Down Arrow
@Z Right Arrow
@< Left Arrow (or Backspace)
@I Insert
Last change: 4/13/95 2
jlang(4) DEVICES AND NETWORK INTERFACES jlang(4)
@R Reset
@P Print
@F Erase to end of field
@D Delete Character
RECEIVE: Wait to receive the String on the following
line from the host. The string must be received
in one field.
TIMEOUT n: The following RECEIVE or SRECEIVE commands will
time out after waiting n seconds. If the
appropriate string is not received from the
host in the specified period, the program
exits.
SLEEP n: Sleep for n seconds.
SWITCH: Allows a logon script to function differently
based on what the host sends to the session.
SWITCH causes jlang to check messages from the
host against all SRECEIVE strings. If a partic-
ular SRECEIVE string is received, all commands
that follow that SRECEIVE command are executed
until the next SRECEIVE command or ENDSWITCH.
SWITCH statements may not be nested.
SRECEIVE: Wait to receive the String on following line
from the host. The string must be received in
one field. The SRECEIVE command can only be
used as a SWITCH case.
ENDSWITCH: Ends a SWITCH (Required).
ENDSCRIPT: Ends a script file (Required).
EXAMPLES
Following are two examples of logon scripts. In the first
example, a logon script waits for the string "PLEASE ENTER
LOGON", sends the string "logon", waits for the string
"ENTER LOGON ID", and then sends an id/password string.
# Set timeout to 30 seconds
TIMEOUT 30:
# Wait to receive "PLEASE ENTER LOGON"
RECEIVE:
PLEASE ENTER LOGON
# Send "logon"
SEND:
Last change: 4/13/95 3
jlang(4) DEVICES AND NETWORK INTERFACES jlang(4)
logon
# Wait to receive "ENTER LOGON ID"
RECEIVE:
ENTER LOGON ID
# Send "cXXXXXX/password"
SEND:
cXXXXXX/password
# Sleep for 3 seconds before relinquishing control
SLEEP 3:
# End of script, this keyword is required.
ENDSCRIPT:
The second example illustrates how to use the SWITCH com-
mand. Two id/password strings can be used to acess ISPF on a
host. If a logon is attempted with an id/password string
that is already being used, the host rejects the logon and
issues an "ID IN USE" message. Using the SWITCH command, a
logon script can be created that then sends the second
id/password string.
# Receive the prompt
RECEIVE:
ENTER LOGON ID
SEND:
ID1/password
# Enter switch case, waiting for either ID
IN USE or LOGON SUCCESSFUL
# Note difference between RECEIVE
# and SRECEIVE commands.
SWITCH:
SRECEIVE:
ID IN USE
SEND:
ID2/password
RECEIVE:
LOGON SUCCESSFUL
SEND:
ispf
SRECEIVE:
LOGON SUCCESSFUL
SEND:
ispf
ENDSWITCH:
FILES
$COMMLINK/bin/3270/jlang
SEE ALSO
tn3270c(1), tn3270c(4), EXPRESS TN3270-C User's Guide
Last change: 4/13/95 4