Support This Project Get i5/OS Programmer's Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads

Interact with Users Using EMI's UIM Builtins

When we need to interact with users from 5250 terminals, there are three ways we can choice:

IBM introduced UIM as the following

Using the user interface manager (UIM) can improve user and
application programmer productivity.

The UIM controls the panel’s appearance and assures consistency with
panels developed by IBM. This gives an application a consistent user
interface which increases user productivity.

Application programmer productivity is increased by using the UIM to
create panels. The application programmer can describe the contents of
a panel without specifying all the details. The format of the panel’s
elements is handled automatically by the UIM.  Using the UIM language
tags allows the application programmer to ′′link′′ an option number or
function key to a specific command or program. Then, when a user
selects an option or presses a function key, the UIM automatically
handles running the command or program. The UIM also handles scrolling
through a multiple-page panel. The Major Command Groups menu is an
example of a multiple-page panel.

Remarks:
See Chapter 15. Improving Productivity with User Interface Manager of Application display programming
EMI provides programming supports for UIM with a set of UIM builtins. Here're examples of using EMI's UIM builtins.

A Hello World Example of Using EMI's UIM Builtins

Here we have a simple panel group uu.pnlgrp and a EMI program which drives the panel group uu.emi.

Sources

.*
.* @file uu.pnlgrp
.*
.* panel group UU
.*

:pnlgrp.

:class name=a20
       basetype='char 20'
       .
:eclass.
:class name=u10
       basetype='graphic 10 13488'
       width=20
       .
:eclass.

:var name=title
     class=a20
     .

:var name=word
     class=u10
     .

:varrcd name=rt
        vars='title'
        .

:varrcd name=rw
        vars='word'
        .

:keyl name=klmain.
:keyi key=f12
      help='hlp'
      action='exit noset'
      .F12=byebye
:keyi key=enter
      help='hlp'
      action=enter
      .
:ekeyl.

:panel name=pp
       title=title
       keyl=klmain
       help='hlp'
       enter='return 100'
       .
:data depth=2
      layout=1
      .

:datacol width=20.
:datacol width='*'.

:datai var=word
       help='hlp'
       usage=out
       .yuyu

:edata.
:epanel.

:help name='hlp'.
What can I help?
:ehelp.

:epnlgrp.
.* eof uu.pnlgrp
/* *
 * @file uu.emi
 *
 * Display panel-group LSBIN/UU
 */

entry i-main ext                ;

dcl dd apph char(8) auto        ;
dcl dd pnlgrp char(20) auto
        init("UU        LSBIN") ;

        /* init emi-qusec */
        cpynv emi-ec-bytes-in, emi-qusec-len ;

        /* open UIM display application */
        cpybla apph, %uim-opnda(
          pnlgrp,       /* panel-group name */
          -1,           /* application scope: program level  */
          0,            /* exit program interface */
          'N',          /* do NOT show full screen help info */
          emi-qusec     /* error code */
        );

        /* set panel title */
        %uim-putv(
          apph,         /* application handle returned by %uim-opnda */
          title,        /* program variable */
          20,           /* length of program variable */
          "RT",         /* variable record name */
          emi-qusec     /* error code */
        );
dcl dd word char(20) auto                          ;
        /* set panel UIM variable WORD */
        cpybrep word, x'00'       ;
        cpybla  word, x'4F60597D' ; /* UCS-2 chinese string: '你好' */
        %uim-putv(apph, word, 20, "RW", emi-qusec);

        /* display panel IDXATTR */
        %uim-dspp(
          apph,         /* application handle */
          "PP",         /* panel name */
          'Y',          /* redisplay option */
          emi-qusec     /* error code */
        );

        /* close UIM application */
        %uim-cloa(apph, 'M', emi-qusec);

brk "RTN"                       ;
        rtx *                   ;

/include qusec.emi              ;

pend                            ;
/* eof - uu.emi */

Compilation *PNLGRP UU and Program UU

Run Program UU

When we run *PGM UU, we should see the following.
mi-eg-uim-1.png

Another Simple UIM Example

CL command DSPIDXD is a member of i5/OS Programmer's Toolkit. The DSPIDXD command displays attributes of a user index (*USRIDX) object whose MI object type and subtype is hex 0E0A. See CL Command DSPIDXD (Display User Index Description) for details.

Sources of the DSPIDXD command is another simple example of EMI's UIM builtins.


Support This Project
Generated on Mon Aug 1 22:50:22 2011 for i5/OS Programmer's Toolkit: MIC - The Machine Instruction Language Compiler by  doxygen 1.5.9