How to set the cursor location from various fields when a text is found in a MAI logon script?

Document ID : KB000014925
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

How to set the cursor location from various fields when a text is found in a MAI logon script?

 

Answer:

The purpose of the MAI logon script is to search for a text from the panel and set the cursor at a specific location when it is found.

In a simple case where the input field is unique (i.e.: 1 input field for the searched text), the cursor location is fixed and can be determined in advance.

In a complex case where the string to search refers to multiple input fields, a specific search is required to determine the corresponding input field to be used.

 

Example:

It is now possible to support passphrase and Multi-Factor Authentication for Netmaster and Solve products if the appropriate fixes are applied.

The password setting can be done when the following statement is true:

&MAIFIND PASSWORD

 

For Netmaster or Solve products having the fixes for the passphrase support, the Password text is on the same line as the Userid and the input field containing the passphrase is on the next line.

For Netmaster or Solve products not having the fixes for the passphrase support, the Password text and the input field containing the password are on the same line.

If the same MAI script is used for both cases, how to set the appropriate cursor location?

The solution consists of detecting the 3270 datastream in hex corresponding to the location of the passphrase field using the following sample statements:

 

&MAIFIND HEX 1D4C3C070B -* WITH PASSPHRASE

&IF &RETCODE EQ 0 &THEN +

   &DO
     &LROWS = 22
     &LCOLS = 24
   &DOEND


 &ELSE +

 &DO

    &MAIFIND HEX 1D4C3C0687 -* NO PASSPHRASE

    &IF &RETCODE EQ 0 &THEN +

     &DO
       &LROWS = 21
       &LCOLS = 64
     &DOEND
  &DOEND


&MAIPUT ROW=21              COL=40             &USERID 
&MAIPUT ROW=&LROWS COL=&LCOLS &USERPW


The hex value can be determined using the sample MAISCR02 script supplied from hlq.DL67.CC2DSAMP to display each datastream flowing between the SLU and the application (PLU).

 

Additional Information:

CA Solve:Access Session Management - Network Control Language Reference Guide 5.0