Menu Definition
This chapter introduces menu definition and its components, and describes how to use a menu definition to access a logical screen.
1. Menu Definition
A menu definition is a PDS member that defines fields to be displayed in a logical screen. A menu definition is written as a text file, but it can be compiled with a compilation tool, tsomapgen, and saved as a binary file named in the format, menuname .map (the name of a menu definition file to be compiled.map). It is then accessed by an IPF program when the menu information is needed.
2. Menu Definition Components
2.1. Attribute Definition
Attribute definition is used to add or change an attribute character or to specify options on an attribute. If you are using only the standard attribute characters, you can omit attribute definition. An attribute definition begins with <ATTR> and ends with <END>.
The following describes the standard attribute characters and attribute symbols.
-
Standard attribute characters
Parameter Description ^
Indicates an input field. This field is not visible.
%
Indicates an input field. This field is highlighted.
|
Indicates an input field. This field is shadowed.
&
Indicates a text field. This field is highlighted.
₩ (Won sign)
Indicates an text field. This field is shadowed.
#
Indicates an output field. This field is highlighted.
@
Indicates an output field. This field is shadowed.
-
Attribute symbols
Parameter Description A
Retains data when the screen is refreshed.
B
Enables screen flicker.
D
Indicates an invisible field.
E
Deletes data when the screen is refreshed.
H
Indicates a highlighted field.
I
Indicates an input field.
J
Right-aligns the field.
N
Indicates an integer-only field.
O
Overlines the field.
P
Indicates an read-only field.
R
Shadows the in-field area and highlights the out-field area.
U
Underlines the field.
V
Displays a vertical line in the field.
The following methods can be used to specify attribute definitions. You can use various formats to define attributes across multiple lines.
-
Method 1
-
Format
Random character = Standard attribute character [+ attribute symbol];
This format releases attributes associated with the standard attribute character and assigns the attributes to the random character. Other attributes can be added if necessary. Note that because the standard attribute character has its attributes released, you can use the character as a common data character.
-
Example
<ATTR> X = % + OUV; <END>
In this example, X is defined as an attribute character. The example releases the attribute associated with % from it, assigns the attribute to X, and adds overline (O), underline (U), and vertical line (V) attributes. Then, you cannot use % as an attribute character.
-
-
Method 2
-
Format
Standard attribute character =+ Attribute symbol;
This syntax adds attributes specified by attribute symbols to those of a standard attribute character.
-
Example
<ATTR> @ =+ JN; <END>
This example assigns right-alignment attribute (J) and integer-only field attribute (N) to the standard attribute character @.
-
-
Method 3
-
Format
Random character =+ attribute symbol;
This syntax assigns the random character with the attribute of an attribute symbol. The random character now serves as an attribute character and thus cannot be used as common data character in a menu prototype.
-
Example
<ATTR> Y =+ IOUV; <END>
This example assigns the input field (I), overline (O), underline (U), and vertical line (V) attributes to a new attribute character Y.
-
2.2. Menu Prototype
A menu prototype is comprised of an attribute character, text data and parameters (field names), and the menu prototype is the actual display screen. An attribute character is one byte long and defines the field paragraph and the field attribute that follows.
Text data can be specified right where you want it to be displayed in the menu prototype. The physical screen displays the text data as you positioned it in the menu prototype. Parameters (field names) can be specified in the data input and output fields that allow the data to be passed between the screen and an application. Further details about the input and output fields are provided in the next section about action definition.
The following is a list of some menu prototype features.
-
A menu prototype is a set of fields.
-
A row can contain multiple fields, but a field cannot span multiple rows.
-
A field is defined as the character string between one attribute character and the next attribute character.
-
A character string in a field can be either text data or parameter name (field name) and an associated blank string.
-
Displayed data falls into a one-byte character string, two-byte Japanese character string, or a combination of one-byte and two-byte character strings.
-
A parameter name is specified in an action definition, and a field name is specified in the FIELD operand of an action definition.
2.3. Action Definition
An action definition is used to define detailed attributes for input and output field parameters specified in the menu prototype. The input and output field parameters can be specified in the MDA parameter described by an application. If no parameter is specified, the input and output field parameters may be omitted. An action definition begins with <ATTR> and ends with <END>.
The following shows the syntax of an action definition.
parameter number {parameter name*} {CHAR(n) | NCHAR(n) | FIXED(n) | DEC(n[,pos])} [LIST(d1) RETURN(d2)] [INIT(initial value | \PARMn)] [FIELD(field name)] [CURSOR] [IMAGE] [/* Comment */]
The following describes each operand of an action definition.
Parameter | Description |
---|---|
parameter number |
Number assigned to each parameter in a menu definition. The number begins with 1. This operand specifies the order in which data is passed from an application irrespective of the parameter sequence in the menu definition. |
parameter name |
Name assigned to each parameter in a menu definition. The specified parameter is paired with a field with the same name in the menu prototype. |
* |
Declares in asterisks (*) the data that is neither input nor output data when the MDA parameter values and data are paired. |
CHAR(n) |
n-byte character line field. |
NCHAR(n) |
2-byte Japanese data field. n specifies the number of Japanese characters. The length of the field is 2n bytes. |
FIXED(n) |
Signed or unsigned integer field. The field is limited to 15, 16, 31, or 32 digits (n). 15 and 31 are signed, and 16 and 32 are unsigned. |
DEC(n[,pos]) |
Signed fixed-decimal number. The field is limited to 15 and 7 digits (n). pos refers to the position of the decimal point specified as the nth digit from the rightmost byte. If this option is omitted, it is set to 0 by default. |
LIST(d1) RETURN(d2) |
Returns d2 specified in RETURN to an application if d1 specified in LIST is entered. |
INIT |
Sets data to the following values if there is no data to display.
|
FIELD |
Specifies a field name to be used for a field instead of a parameter name in the menu definition. Used for syntax check only in OpenFrame. |
CURSOR |
Field in which the cursor is to be located. If omitted, the cursor is located in the first input field. |
IMAGE |
You can choose a format to display numeric data for parameters defined by FIXED or DEC by using the following character strings:
|
Comment |
Comments in the action definition. A comment is enclosed by '/* and' '*/', which cannot be included in the content of comment. |
3. tsomapgen
tsomapgen is a tool that parses and compiles the initial menu definition text file, which is then saved as a binary file. The information in the binary file is accessed by TSOMGR or IPF subroutines that reference the menu definition.
-
Syntax
The following is the syntax of using tsomapgen.
uasage : tsomapgen [options] menuname
-
[options]
Option Description -m program
Specifies the type of a menu definition to be compiled. This option is required for compilation. tsomapgen can compile either an IPF map.
[-l pdsname ]
Specifies the location where the compiled map file is to be saved. The map file is saved as a PDS member. If this option is omitted, it is set to the current directory where the compilation command is executed.
[-c]
Compares the menu field length of the parameter specified in DEC and the image data length of the action field. If the lengths are not equal, a warning message is displayed.
[-d]
Compiles in debug mode. This option displays information saved in the structure of the compiled map file.
-v mapfile
Displays the version information of the compiled map file. This option is not referenced during compilation.
[-h]
Displays the tsomapgen syntax.
-
Input Parameter
Parameter Description menuname
Name of the menu definition to be compiled. A compiled map file is saved as {menuname}.map.
-