Action syntax

From The x3270 Wiki

Action syntax is used to specify an action to invoke, along with its parameters. This syntax is used in x3270 keymaps, c3270 keymaps, wc3270 keymaps, macros, scripts and at the x3270> prompt.

There are two forms of action syntax, formal and informal.

Formal syntax

The basic form of formal syntax is:

action-name([parameter[,parameter...]])

Note that the parentheses and commas between the parameters are required.

If nothing is specified between a parenthesis and a comma, or between two commas, it is interpreted as a zero-length parameter.

The basic advantage of formal syntax is that is allows multiple actions to be specified on a single line.

Formal syntax example

Invoke the PF() action with the parameter 1.

PF(1)

Informal syntax

The basic form of informal syntax is:

action-name [parameter...]

Action names are case-insensitive.

Note: Informal syntax cannot be used in x3270 keymaps.

Informal syntax example

Invoke the PF() action with the parameter 1.

PF 1

Quoting

Double-quote characters (") are used to in both forms to surround a parameter that contains a space. In formal syntax, double quotes must also surround parameters that include commas or parentheses.

To include a double-quote in a parameter, put a backslash (\) before it. To end a parameter with a backslash, double the backslash. Backslashes have no other special significance.

Examples

Invoke the String() action with the parameter hello.

String(hello)
String hello

Invoke the Wait() action with the parameters 1 and Seconds.

Wait(1,Seconds)
Wait 1 Seconds

Invoke the String() action with the parameter hello ("hello" followed by a space).

String("hello ")
String "hello "

Invoke the String() action with the parameter hello(foo)there. The double quotes are required with formal syntax because of the ) in the parameter.

String("hello(foo)there")
string hello(foo)there

Invoke the String() action with the parameter hello\n. Note that the parameter passed to the action ends with two the separate characters \ and n, not a single newline character. It is up to the action to interpret this as a newline.

String("hello\n")
String "hello\n"

Invoke the String() action with the parameter my "real" cat.

String("my \"real\" cat")
string "my \"real\" cat"

Invoke the String() action with the parameter say "hi".

String("say \"hi\"")
string "say \"hi\""

Invoke the String() action with the parameter fun\q run\\j ball. Note that the backslashes have no special meaning and are passed to the action unchanged.

String("fun\q run\\j ball")
string("fun\q run\\j ball")

Invoke the String() action with two parameters: an empty string and xxx.

String(,xxx)
string "" xxx

Invoke the String() action and then the Enter() action.

String(xxx) Enter()

Disclaimer

This quoting convention for parameters is painful and logically incomplete. For example, it is impossible to specify a parameter that ends with the two-character sequence \". This was not invented by the authors of the x3270 family -- it was inherited from Xt translation table syntax and then maintained for backwards compatibility.