Defining Virtual Terminals Dynamically

If you have a large number of virtual terminals to allocate, using VSM DEF commands to create and maintain the necessary pools might involve a great deal of work. To simplify the task, you can create virtual terminals dynamically, as users sign on, by using a physical-to-virtual terminal one-to-one mapping technique. Each virtual terminal name is derived from a specific physical terminal ID or user ID.

This example dynamically adds a virtual terminal to the pool as the user logs on. The advantage of this technique is that you don't have to issue VSM commands to maintain virtual terminal pools, and you save on ACB storage. Each virtual terminal name in this example consists of the last four characters of the physical terminal name. For example, physical terminal ID C12AZ0A3 maps to virtual terminal ID Z0A3.

  1. Create dummy virtual terminal pools in &rhilev.RLSCMDS member KLS$VSMS. For example,

    VSM DEF PASSPOOL DUMMY LOGMODE(&DEFLMODE) DEFER PASS -

    NODE='&VIRTTERM'

    VSM DEF NOPASS DUMMY LOGMODE(&DEFLMODE) DEFER -

    NODE='&VIRTTERM'

  2. Create a dialog in your &rhilev.RLSPNLS with the following dialog code:

)OPTIONS LEVEL (1)
)INIT
SET VIRTTERM '&SUBSTR('&SYSTERM',4,4)'
COMMAND('AS ''*SYSVLG*'' VSM DEF PASSPOOL &VIRTTERM DEFER')
COMMAND('AS ''*SYSVLG*'' VSM DEF NOPASS &VIRTTERM DEFER')

In this code, AS '*SYSVLG*' issues the commands on behalf of the VIEWLOG operator. The command replies are then recorded in the VIEWLOG dataset.

This dialog needs to be specified as a profile initial dialog so that it executes during a user's initialization after entry validation.

Note: This technique still requires that each virtual terminal is defined in SYS1.VTAMLST(newname) and that VIEWLOG is enabled.

Optional: To close a virtual terminal that has been dynamically allocated, review example codes in KLSEACB, KLSEACB1, KLSEACB2 and KLSEACB3 in &rhilev.RLSSAMP. The examples explain how to close ACBs that you dynamically allocated and prevent the virtual terminals from taking up extra storage.