REXX – PANEL Definition
Each panel definition section begins with a statement that indicates the section being defined. There are seven statements, one for the start of each of the sections. The statements are:
)ATTR
attribute section
)BODY
body section
)INIT
initialization section
)REINIT
reinitialization section
)PROC
processing session
)MODEL
model section (table displays only)
)END
end of panel definition
We will discuss one by one section below.
-
Attribute section defines the special characters used in the body of the panel definition to represent attribute (start-of-field) bytes, such as high intensity, low intensity, and input field.
)ATTR
* TYPE(TEXT) INTENS(HIGH) COLOR(WHITE) CAPS(OFF)
# TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)
? TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(USCORE)
@ TYPE(TEXT) INTENS(LOW) COLOR(BLUE)
TYPE – TEXT/INPUT/OUTPUT – If it is constant, input or output field
INTENS – HIGH/LOW – Sets the Intensity
COLOR – Basic colours are white, blue, turq, yellow, red, green
HILITE(REVERSE) – To highlight the data
HILITE(USCORE) – To underline the data
The default attribute characters are
% – Text (protected) field, high intensity
+ – Text (protected) field, low intensity
_ – Input (unprotected) field, high intensity
-
Body section defines the format of the panel as seen by the user, and defines the name of each variable field on the panel.
Syntax
)BODY WIDTH() EXPAND() CMD() LMSG() SMSG() WINDOW(width,depth)
WIDTH() | Indicates the window width |
EXPAND(xy) | Repeat a character field based on delimiters x and y |
CMD() | Identifies the panel field (variable name) to be treated as the command field. You can specify that you do not want a command field by using CMD(). |
LMSG() | Identifies the panel field (variable name) where the long message, if any, is to be placed |
SMSG() | Identifies the panel field (variable name) where the short message, if any, is to be placed |
WINDOW() | Supplies constant window width and height |
Draw the input field in BODY section staring with input attribute character and ending with ‘+’ character.
)BODY
ENTER YOUR NAME:_NAME +
-
Initialization section specifies the processing that will occur before the panel is displayed. You usually use this section to define how variables are to be initialized.
The input fields are automatically stored into the corresponding dialog variables immediately following display and prior to processing the )PROC section
The INIT section is also used to prepare list of Z variable names.
The Z vars can only be defined in the INIT section
It begins with the )INIT header statement and ends with either the )REINIT, )PROC, )HELP, or )END header statement.
Using Z variables for input field
)ATTR
_ TYPE(INPUT) INTENS(HIGH)
)BODY
ENTER YOUR NAME:_Z + EMP ID:_Z +
DESIGNATION:_Z +
)INIT
.ZVARS='(NAME,EMPID,DESIG)’
)END
As you can see above, you can use Z variables in the BODY section, and define the variables in the INIT section.
- Reinitialization section specifies the processing that will occur before redisplay of a panel.
Processed if the .MSG control variable is nonblank
The Main purpose of this section is to hilite the errors that user has made with different color or by blinking the field before redisplaying the screen.
The difference between the INIT and REINIT section is that the former is executed when the panel is newly loaded into memory while the later is executed when the display panel command is given when the panel is already present in the memory
-
Processing section specifies the processing that will occur after the panel is displayed. You usually use this section to define how variables are verified and translated.
It is ttriggered whenever the user presses an AID / RETURN key.
)PROC
IF (&COUNTRY = ‘INDIA’)
&POST = ‘DOMESTIC’
)END
Adding IF-ELSE Control logic in the panel
The IF-ELSE statement control depends on the indentation of the IF and ELSE statements. The rules are:
- All statements to the RIGHT of IF statement and before the ELSE statement is executed when the IF condition is TRUE
- The ELSE statements should be column aligned with the IF statement
- All statements after the ELSE statement and to the right of ELSE statement are executed when the IF condition fails
THE VER COMMAND
VER command is used to validate the input field passed through the panel input. And an error message is thrown based on the validation.
Example:
VER (&AGE,LEN,’=’,2) – verifies if the length is of 2 bytes
VER (&NAME,ALPHA) – verifies if the NAME is alphabetic
VER (&AGE,NUM) – verifies if the age is numeric
VER (&EMPSER,NONBLANK,PICT,NNNNNN)
VER (&PHNUM,PICT,NNN-NNNN)
VER (&ALKBLK,RANGE,0,32760)
PFKEY
System Variable .PFKEY: This command is used to capture the AID key pressed by the user
Example:
)PROC
&KEYPRESS = .PFKEY
)END
-
Model section (required for table display only; not allowed for other types of panels) specifies the format for displaying each row of the table.
Specifies the format in which the columns in the table need to be displayed.
Table
- TBCREATE Creates a new table and opens it for processing
- TBCLOSE Closes a table and saves a permanent copy if the table was opened
- TBEND Closes a table without saving
- TBERASE Deletes a permanent table from the table output file
- TBOPEN Opens an existing permanent table for processing
- TBSAVE Saves a permanent copy of a table without closing
- TBCREATE Creates a new table and opens it for processing
-
End section consists of only the )END statement. ISPF ignores any data that appears on lines following the )END statement. It is a mandatory section.
You might also like to look at:
REXX – READ, CREATE AND WRITE DATA TO A DATASET
REXX TOOL TO SUBSTITUTE SYMBOLICS IN A PROC
——————————————————————————————————–
In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog
——————————————————————————————————–
You may also like to look at:
Working on Mainframes – Is Change to a different technology necessary |