 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1988, 1990. All rights reserved
LAYERED PRODUCT: PLI 3.3 OP/SYS: VMS 5.3-1
SOURCE: Digital Customer Support Center
OVERVIEW:
The following program demonstrates how to pass parameters from a
program to a command procedure.
*** CAUTION ***
This sample program has been tested using PLI V3.3 on VMS V5.3-1.
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:
This example sets global symbols within the program, which are then
used in the command procedure. The command procedure is executed from
the program by a call to the Run-Time Library routine, LIB$SPAWN. The
program first sets up the 2 global symbols, one is the filename and the
second is the queue name. The command procedure, which is called with
LIB$SPAWN and executed from within the created subprocess, will print
the file identified by the filename symbol on the given queue specified
by the queue name symbol.
PROGRAM SAMPLE:
spawn: proc options(main);
%include $ssdef;
%include $stsdef;
%include $libclidef;
%include lib$spawn;
%include lib$set_symbol;
%include str$trim;
dcl comfile char(10) init('@PRINT.COM');
dcl queue_name char(31);
dcl filename char(31);
dcl symbol1 char(7) init('SYMBOL1');
dcl symbol2 char(7) init('SYMBOL2');
dcl cstatus fixed bin(31); /* this will be the subprocess completion status */
dcl table fixed bin(31) init(lib$k_cli_global_sym);
/* symbol must be global so that it will be viewable by the subprocess */
put skip list('Enter the file name to be printed:');
get list (filename);
put skip list('Enter the queue name: ');
get list (queue_name);
sts$value = str$trim(queue_name,queue_name);
If ^sts$success
then signal vaxcondition(sts$value);
sts$value = str$trim(filename,filename);
If ^sts$success
then signal vaxcondition(sts$value);
sts$value = lib$set_symbol(symbol1,filename,table);
If ^sts$success
then signal vaxcondition(sts$value);
sts$value = lib$set_symbol(symbol2,queue_name,table);
If ^sts$success
then signal vaxcondition(sts$value);
sts$value = lib$spawn(comfile, , , , , ,cstatus, , , , ,);
If ^sts$success
then signal vaxcondition(sts$value);
If posint(cstatus,1,1) ^= ss$_normal
then signal vaxcondition(cstatus);
end spawn;
-------------------------------------------------------------
PRINT.COM should contain:
$print/queue='SYMBOL2' 'SYMBOL1'
|
buy online or call 1.800.AT.COMPAQ
|
|