Using Function Key Descriptions to Condition RAMP Buttons

This example shows how to match function key descriptions on 5250 screens:

RAMP2620

With RAMP buttons and function keys

This example uses JavaScript function SHARED.apply5250FunctionKeyPatterns which is designed to look for Fn=xxxxxx patterns on specified screen lines and then use these patterns to condition the RAMP-TS buttons and function keys to match.

Note that the matching does not include the text portion of the pattern. Normally in RAMP-TS the button captions are defined independently of the 5250 screen in RAMP-Tools.    

To try out this example, copy and paste the functions in SHARED.apply5250FunctionKeyPatterns into your SHARED script object,  file UF_SY420_RTS.JS. The logic in the functions is:

 

Invoking the Function

Invoke the function from your destination screens arrival script - like this example:

   vHandle_ARRIVE: function(oPayload, oPreviousForm)

   {

     var bReturn = true;

     SHARED.apply5250FunctionKeyPatterns(22,23); /* Must be before SHOW_CURRENT_FORM() */

     SHOW_CURRENT_FORM(true); /* Show the form in the framework and show VLF buttons */

     HIDE_5250_BUTTONS();     /* Hide any 5250 style buttons displayed               */

     GET_FORM_MESSAGE(22);    /* Extract messages and hide the message line          */

     SETBUSY(false);          /* Last thing done - turn off the busy state           */

This says to check on lines 22 and 23 of this arriving screen for Fn=xxxx text patterns and attempt to match the RAMP-TS buttons and function keys with them. Remember they are just text patterns and programmatically have nothing precisely to do with what function keys are actually enabled by the 5250 screen.  The text patterns are put on the 5250 screens for humans to read - not computer programs. 

   

Parameters

The function has these parameters:

Start Line Number

Mandatory. Integer. The first line to be searched for Fn=xxxx patterns.

End Line Number

Optional. Integer. The last line to be searched for Fn=xxxxx patterns. The default value is the same value as the start line number.

Keys/Buttons to always be enabled 

Optional. Array of function key identifiers. For example [KeyEnter,KeyF11]

Keys /Buttons to always be disabled.

Optional. Array of function key identifiers. For example [ KeyF12, KeyF3 ]

 

 

For example:

     SHARED.apply5250FunctionKeyPatterns(22, 23, [KeyEnter,KeyF1], [KeyF12] );

says to check screen lines 22 to 23, always enable Enter and F1, and always disable F12.

If you wanted to unconditionally enable the page up and down keys, which will not have matching text patterns to enable them you would do this:

    SHARED.apply5250FunctionKeyPatterns(22, 23, [ KeyPageUp, KeyPageDown ] );

You could also do this permanently in the SHARED function.

Also see Questions about the Function.