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
Example PLI Calling the CLI$ Routines
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 1988. All rights reserved
LAYERED PRODUCT: VAX PLI                   OP/SYS: VMS


SOURCE:     Digital Customer Support Center



OVERVIEW:

The program demonstrates how to call some of the CLI Routines (Command
Definition Utility).


CAUTION:  This sample program has been tested using VAX PL1 V3.1 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 SAMPLE:

$!begin extract
$!before executing this command procedure, change the disk and directory
$create mainpro.pli
mainpro: procedure;
%include $stsdef;
%include $climsgdef;
%include cli$get_value;
%include cli$dispatch;
%include cli$present;
%include cli$dcl_parse;
%include lib$get_foreign;
%include lib$get_input;

dcl line_len fixed bin(15);
dcl mutl_command_ext char(50);
dcl mhf_commands globalref fixed bin;
dcl return_s char(40);
dcl database_name char(40);
dcl keyword_array character(40) varying;
dcl prompt char(15) init('COMMAND:');

/* Get the string from the command line*/
sts$value = lib$get_foreign(mutl_command_ext,,line_len);
if ^sts$success
   then signal vaxcondition(sts$value);

/*parse the line entered*/
sts$value = cli$dcl_parse(mutl_command_ext,mhf_commands,
                          lib$get_input,lib$get_input,prompt);
if ^sts$success
   then signal vaxcondition(sts$value);

/* In this case, call CLI$PRESENT to see if DATABASE_NAME verb
   was entered*/
sts$value = cli$present('DATABASE_NAME');
if ^sts$success
   then signal vaxcondition(sts$value);

/*get the value of the verb entered*/
sts$value = cli$get_value('DATABASE_NAME',return_s,);
if ^sts$success
   then signal vaxcondition(sts$value);

put skip list(return_s);

/* dispatch the routine */
sts$value = cli$dispatch();

end mainpro;

mutl_init_database: proc;
   /* This routine is executed when the call to cli$dispatch is made*/
   /* It is specified in the .CLD file for the verb INITIALIZE, under*/
   /* label DATABASE_NAME*/

   put skip list('In the dispatched routine');
end;
mutl_exit_mutl: proc;
   /*null routine*/
end;
$write sys$output "compiling program..."
$pli mainpro.pli
$write sys$output "creating the cld file..."
$create mhf_commands.cld
Module mhf_commands
DEFINE VERB INITIALIZE

   routine MUTL_INIT_DATABASE
   parameter p1, label=DATABASE_NAME
                 value(required, type=DATABASE_NAMES)
                 prompt="Database name :"

   define type DATABASE_NAMES
          keyword ACP_CAD_TABLE,                   syntax=INIT_SIMPLE_TABLE

   define syntax init_simple_table
          parameter P1, label=DATABASE_NAME
                    value(required)
          qualifier file value(required,
                    type=$file)
                    nonnegatable
          qualifier load_from value(required,
                    type=$file)
                    nonnegatable
   define verb exit
               routine mutl_exit_mutl
$write sys$output "creating the cld object file..."
$set command mhf_commands/object
$write sys$output "linking..."
$link mainpro,mhf_commands
$write sys$output "setting up the mhf symbol..."
$ddd = f$logical("sys$disk") + f$directory()
$mhf :== "$''ddd'mainpro.exe"
$write sys$output "executing the new command..."
$mhf init acp_cad_table
$del mhf_commands.cld;
$del mhf_commands.obj;
$del mainpro.pli;
$del mainpro.obj;
$!del mainpro.exe;
$!end extract




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