Scripting from 5250 terminal

As Green Screens Terminal is web based and support 5250 remote commands, some new interesting options become possible. One of them is to call JavaScript from 5250 application or CL program.

See for short demonstration in following video first.


Before we start, it is mandatory to initialize remote command feature with STRPCO.

Now, for example we can show notify or blocking popup informational message like in following examples.

Blocking Prompt

STRPCCMD PCCMD('script:Tn5250.Prompts.message(''Info'', ''Houston we have a problem'')')
         PAUSE(*NO)                                                      

Notify message

STRPCCMD PCCMD('script:Tn5250.Prompts.notify(''Houston we have a problem'')') 
         PAUSE(*NO)

Autostart printer

Web terminal supports spool to web pdf printing through remote OUTQ writer. To ease end client signing in we can add CL program to be called after users sign in. CL program will start printer session automatically.

STRPCCMD PCCMD('script:Tn5250.Application.startPrinter(''PRT01'')')
         PAUSE(*NO) 

UI Customization

There are many new possibilities like screen customization and scripting. For example,
we can make screen to blink and trigger beep sound directly from CL program in a case of program error.

STRPCCMD PCCMD('script:$(".tnview").fadeIn(50).fadeOut(50).fadeIn(50).fadeOut(50).fadeIn(50);Tn5250.OIA.beep();')                    

Disabling features

Green Screens Web Administration have customization option where we can add our custom CSS styling and scripts which applies to all workstations. Even there are options to call custom script for specific workstation or specific user, sometimes it is required that those functions are called from STRRMTCMD. Let's say that we have telnet initialization CL program which can call web terminal functions based on some system data.

Let us show two different approaches for disabling key bar.

Open web admin console, click on Customization icon on top bar and in tab Footer add following:

<script>
$(window).on('greenscreens', function() {
Tn5250.KeyBar.toggle();
});
</script>

Similar effect we can get by adding following to our CL program started when user signs on.

STRPCO
STRPCCMD PCCMD('script:Tn5250.KeyBar.toggle()') PAUSE(*NO)

Difference is that first example is applied for all host configurations, while second example will work only for system on which this script is executed.

Conclusion

There are many options for scripting. To simplify tasks, any client can create it's own set of JavaScript functions and make them available as custom injectable scripts inside web terminal. Those custom scripts can be triggered from 5250 application (CL, RPG, COBOL etc..)

Even shown scripts are simple, more complex code and automation scripts can be created to simplify data entry or to automate integration etc.