Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
PL1, Run-Time Error Using SMG$CREATE_MENU From A PL1 Program
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Digital Equipment Corporation 1989. All rights reserved
LAYERED PRODUCT: PL1 V3.2     OP/SYS: VMS V5.0

SOURCE:     Digital Customer Support Center



OVERVIEW:

This article discusses a restriction using SMG$CREATE_MENU with PL1.
The program example below gives a way to work around this restriction.

ANALYSIS:

Prior to V5.2 VMS, SMG$CREATE_MENU's 2nd argument (an array of contiguous
fixed-length strings that are the menu choices) must be passed as CLASS_A.
By default, PL1 builds this kind of array with a CLASS_NCA (Non-Contiguous
Array - which is more generic).  Therefore, for systems running a version
of VMS earlier than V5.2, it's necessary to build the required descriptor
block in the program, then pass its address as the argument to
SMG$CREATE_MENU.

See the VMS V5.0 (April 1988) "Programming, Volume 3, Introduction to
Systems Routines," pages 2-22 and following, for the definition of CLASS_A.

The restriction was removed in V5.2 VMS.  A CLASS_NCA Descriptor, the PL1
default, will work for the SMG$CREATE_MENU Choices argument on systems
running V5.2 or higher.


*** CAUTION ***

This sample program has been tested using PL1 V3.3 on VMS V5.0.  However,
we cannot guarantee its effectiveness because of the possibility of errors
in transmitting or implementing it.  It is meant to be used as a template
for writing your own program, and it may require modification for use on
your system.


PROGRAM NOTES:

Note the need to use the REVERSE built-in function to put the bit string
of flags in the correct order (the ar_aflags field in the descriptor block).


PROGRAM:

cm: procedure options(main);

    %include $stsdef;
    %include $dscdef;
    %include $smgdef;
    %include smg$create_pasteboard;
    %include smg$create_virtual_keyboard;
    %include smg$create_virtual_display;
    %include smg$paste_virtual_display;
    %include smg$create_menu;
    %include smg$select_from_menu;
    %include smg$put_chars;

    dcl (pbid,dpid,dpid2,kbid,pbrow,pbcol)      fixed bin(31);
    dcl choice fixed bin(15), disp_line char(30) var;
    dcl menu(3) char(9) static
            init('Choice 1:','Choice 2:','Choice 3:');
    dcl 1 ar_dsc,
            2 ar_len    fixed bin(15) init(9),  /* length of each element */
            2 ar_typ    fixed bin(7) init(dsc$k_dtype_t),
            2 ar_cls    fixed bin(7) init(dsc$k_class_a),
            2 ar_adr    pointer,                /* address of the array */
            2 ar_scale  fixed bin(7) init(0),
            2 ar_digits fixed bin(7) init(0),
            2 ar_aflags bit(8) init('C0'b4),    /* should be bits 7,8 */
            2 ar_dimct  fixed bin(7) init(1),   /* nbr of dimensions */
            2 ar_siz    fixed bin(31) init(27), /* total array size */
            2 ar_a_a0   fixed bin(31) init(0),
            2 ar_l_m    fixed bin(31) init(9), /* stride to next element */
            2 ar_l_l    fixed bin(31) init(1), /* lower bound of dim 1 */
            2 ar_l_u    fixed bin(31) init(3); /* upper bound */

    ar_adr = addr(menu);
    ar_aflags = reverse(ar_aflags);

/* Establish the Pasteboard, Keyboard and Virtual display */

        sts$value = smg$create_pasteboard(pbid, 'tt:', pbrow, pbcol,);
        if ^sts$success then signal vaxcondition(sts$value);

        sts$value = smg$create_virtual_keyboard(kbid, 'tt:');
        if ^sts$success then signal vaxcondition(sts$value);

        sts$value = smg$create_virtual_display(3, 11, dpid, smg$m_border);
        if ^sts$success then signal vaxcondition(sts$value);

        sts$value = smg$paste_virtual_display(dpid, pbid, 10, 30);
        if ^sts$success then signal vaxcondition(sts$value);

        sts$value = smg$create_menu(dpid,ref(ar_dsc));
        if ^sts$success then signal vaxcondition(sts$value);

        sts$value = smg$select_from_menu(kbid,dpid,choice);
        if ^sts$success then signal vaxcondition(sts$value);

        sts$value = smg$create_virtual_display(1, 20, dpid2, smg$m_border);
        if ^sts$success then signal vaxcondition(sts$value);

        sts$value = smg$paste_virtual_display(dpid2, pbid, 20, 30);
        if ^sts$success then signal vaxcondition(sts$value);

        disp_line = 'Your choice was: ' || trim(char(choice));
        sts$value = smg$put_chars(dpid2,disp_line,1,1);
        if ^sts$success then signal vaxcondition(sts$value);

end cm;




buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms