Questions about the Function
What should you do if SHARED.apply5250FunctionKeyPatterns does not work as expected?
Always try executing the screen with application level tracing turned on and examine the results.
Also check that extra buttons that always appear when executing in design mode (eg: Probe Screen) are not clouding the issue. The real test is to execute the logic in UF_EXEC (end-user) mode.
The destination screen’s caption for the button may be clouding the issue. The text pattern on the 5250 screen might say F7=Hop, but the screen’s definition in RAMP tools might say that the F7 key is to have a button that is captioned “Skip”.
Can you change the SHARED.apply5250FunctionKeyPatterns logic?
Yes. This code is provided as an example for you to use in your SHARED object.
It is your code to change and maintain as you see fit.
For example, you might decide that you want to enable all the function keys initially. This is a possible solution when you have F24=More Keys style screens, because it is impossible to work out which function keys are actually enabled from the current screen only. To do this you would change this line:
for (var i = 0; i < oForm.vFKERTS.length; i++) { if (oForm.vFKERTS.charAt(i) != "0") oForm.vFKERTS = InsertString(oForm.vFKERTS,"0",i); }
To this:
for (var i = 0; i < oForm.vFKERTS.length; i++) { if (oForm.vFKERTS.charAt(i) != "1") oForm.vFKERTS = InsertString(oForm.vFKERTS,"1",i); }
You might decide that you always want to enable Enter and F1 without the caller always having to specify this - so you could add this to the end of SHARED.apply5250FunctionKeyPatterns:
SETKEYENABLED(GLOBAL_oCurrentTSform.symbolicName,KeyEnter,true,true);
SETKEYENABLED(GLOBAL_oCurrentTSform.symbolicName,KeyF1,true,true);
You might also decide to hook up the xxxxx text portion of Fn=xxxxx strings with the button caption in some way. This is also possible by using the second key match element fkeyMatch[2] and the standard RAMP-TS OVERRIDE_KEY_CAPTION_SCREEN function.
You can probably now see that we could not possibly cover of all the options and combinations automatically and efficiently by having specialized RAMP-Tools options. There would be so many check boxes and options that no one would understand what they meant or did. Using a generic scripted approach like this is simpler and it allows you to to tailor the approach to your exact needs.
What if you want to put SHARED.apply5250FunctionKeyPatterns into every arrival script?
You will have to add it to existing scripts individually - unless you are already calling something in the SHARED object that you can hook into.
You can also change your arrival script skeleton so that SHARED.apply5250FunctionKeyPatterns is automatically generated into all new scripts. Search for “Script Skeletons” in the RAMP-TS guide (lansa050.chm).