 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1992. All rights reserved
PRODUCT: VAX PLI OP/SYS: VMS
SOURCE: Digital Customer Support Center
OVERVIEW:
This example will demonstrate how to use the callable interface to the
VMS Mail Utility to display user profile information.
*** CAUTION ***
This sample program has been tested using VAX PLI, version 3.5 on VMS,
version V5.5. However, we cannot guarantee its effectiveness because of
the possibility of error 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:
VMS Mail is maintained in an indexed file that serves as a system-wide
database of user profile data. This file exists in SYS$SYSTEM as
VMSMAIL_PROFILE.DATA. User profile entries consist of a default MAIL
subdirectory, default print form, forwarding address, personal name string,
default print queue name, and a flags field that describes any automatic
options such as auto purge, a CC prompt and copy self, forward, send.
This database is used by both VMS mail and the callable interface.
This example willl simulate the VMS MAIL command SHOW ALL.
Please refer to the "VMS Utility Routines", June 1990, Chapter 9
for more information on the callable interface to VMS Mail.
PROGRAM:
/* This program was rewritten in PLI using article entitled:
Example-COBOL Using Callable Mail To Display User Profile Information */
send_file: proc options(main);
%include $stsdef;
%include $ssdef;
%include $maildef;
%include str$trim;
%include sys$getmsg;
%include mail$user_begin;
%include mail$user_get_info;
%include mail$user_end;
dcl 01 nullist,
05 dummy_1 fixed bin(31) init(0),
05 dummy_2 fixed bin(31) init(0),
05 dummy_3 fixed bin(31) init(0),
05 dummy_4 fixed bin(31) init(0);
dcl 01 userlst,
05 username_part,
07 usrname_buflen fixed bin(15),
07 usrname_itmcode fixed bin(15) init(MAIL$_USER_USERNAME),
07 usrname_pointer pointer,
07 usrname_retadr fixed bin(31) init(0),
05 username_signal,
07 usrsignal_buflen fixed bin(15) init(0),
07 usrsignal_itmcode fixed bin(15) init(MAIL$_NOSIGNAL),
07 usrsignal_pointer pointer,
07 usrsignal_retadr fixed bin(31) init(0),
05 usrpart_terminator fixed bin(31) init(0);
dcl 01 output_list,
05 auto_purg_lst,
07 auto_buflen fixed bin(15) init(4),
07 auto_itmcode fixed bin(15) init(MAIL$_USER_AUTO_PURGE),
07 auto_pointer pointer,
07 auto_retadr pointer,
05 ccpmt_lst,
07 ccpmt_fixed bin(15) init(4),
07 ccpmt_itmcode fixed bin(15) init(MAIL$_USER_CC_PROMPT),
07 ccpmt_pointer pointer,
07 ccpmt_retadr pointer,
05 cpy_for_lst,
07 cpyf_fixed bin(15) init(4),
07 cpyf_itmcode fixed bin(15) init(MAIL$_USER_COPY_FORWARD),
07 cpyf_pointer pointer,
07 cpyf_retadr pointer,
05 cpy_rep_lst,
07 cpyr_buflen fixed bin(15) init(4),
07 cpyr_itmcode fixed bin(15) init(MAIL$_USER_COPY_REPLY),
07 cpyr_pointer pointer,
07 cpyr_retadr pointer,
05 cpy_snd_lst,
07 cpys_buflen fixed bin(15) init(4),
07 cpys_itmcode fixed bin(15) init(MAIL$_USER_COPY_SEND),
07 cpys_pointer pointer,
07 cpys_retadr pointer,
05 editor_lst,
07 edt_buflen fixed bin(15) init(255),
07 edt_itmcode fixed bin(15) init(MAIL$_USER_EDITOR),
07 edt_pointer pointer,
07 edt_retadr pointer,
05 for_lst,
07 for_buflen fixed bin(15) init(255),
07 for_itmcode fixed bin(15) init(MAIL$_USER_FORWARDING),
07 for_pointer pointer,
07 for_retadr pointer,
05 form_lst,
07 form_buflen fixed bin(15) init(255),
07 form_itmcode fixed bin(15) init(MAIL$_USER_FORM),
07 form_pointer pointer,
07 form_retadr pointer,
05 dir_lst,
07 dir_buflen fixed bin(15) init(255),
07 dir_itmcode fixed bin(15) init(MAIL$_USER_FULL_DIRECTORY),
07 dir_pointer pointer,
07 dir_retadr pointer,
05 new_msg_lst,
07 msg_buflen fixed bin(15) init(2),
07 msg_itmcode fixed bin(15) init(MAIL$_USER_NEW_MESSAGES),
07 msg_pointer pointer,
07 msg_retadr pointer,
05 personal_lst,
07 per_buflen fixed bin(15) init(255),
07 per_itmcode fixed bin(15) init(MAIL$_USER_PERSONAL_NAME),
07 per_pointer pointer,
07 per_retadr pointer,
05 queue_lst,
07 que_buflen fixed bin(15) init(255),
07 que_itmcode fixed bin(15) init(MAIL$_USER_QUEUE),
07 queue_pointer pointer,
07 queue_retadr pointer,
05 usr_ret_name_lst,
07 retname_buflen fixed bin(15) init(255),
07 retname_itmcode fixed bin(15) init(MAIL$_USER_RETURN_USERNAME),
07 ret_pointer pointer,
07 ret_retadr pointer,
05 output_terminator fixed bin(31) init(0);
dcl forwarding char(255);
dcl user_form char(255);
dcl queuename char(255);
dcl username char(12);
dcl retusername char(255);
dcl full_dir char(255);
dcl editor char(255);
dcl per_name char(255);
dcl cc_prompt bit(32) aligned;
dcl ccpmt_len fixed bin(31);
dcl form_len fixed bin(31);
dcl que_len fixed bin(31);
dcl for_len fixed bin(31);
dcl per_len fixed bin(31);
dcl edt_len fixed bin(31);
dcl dir_len fixed bin(31);
dcl retname_len fixed bin(31);
dcl user_len fixed bin(15);
dcl new_msg fixed bin(15);
dcl auto_purg bit(32) aligned;
dcl auto_len fixed bin(31);
dcl cpy_rep bit(32) aligned;
dcl cpy_rep_len fixed bin(31);
dcl cpy_snd bit(32) aligned;
dcl cpy_snd_len fixed bin(31);
dcl cpy_for bit(32) aligned;
dcl cpy_for_len fixed bin(31);
dcl editor_len fixed bin(31);
dcl user_context fixed bin(31) init(0);
queue_pointer = addr(queuename);
queue_retadr = addr(que_len);
dir_pointer = addr(full_dir);
dir_retadr = addr(dir_len);
auto_pointer = addr(auto_purg);
auto_retadr = addr(auto_len);
ccpmt_pointer = addr(cc_prompt);
ccpmt_retadr = addr(ccpmt_len);
cpyr_pointer = addr(cpy_rep);
cpyr_retadr = addr(cpy_rep_len);
cpys_pointer = addr(cpy_snd);
cpys_retadr = addr(cpy_snd_len);
cpyf_pointer = addr(cpy_for);
cpyf_retadr = addr(cpy_for_len);
edt_pointer = addr(editor);
edt_retadr = addr(editor_len);
edt_retadr = addr(edt_len);
form_pointer = addr(user_form);
form_retadr = addr(form_len);
for_pointer = addr(forwarding);
for_retadr = addr(for_len);
ret_pointer = addr(retusername);
ret_retadr = addr(retname_len);
per_pointer = addr(per_name);
per_retadr = addr(per_len);
usrsignal_pointer = null();
usrname_pointer = addr(username);
msg_pointer = addr(new_msg);
sts$value = mail$user_begin(user_context,nullist,nullist);
if ^sts$success
then signal VAX Condition(sts$value);
put skip list ('Enter the name of the user for profile: ');
get list (username);
sts$value = str$trim(username,username,user_len);
if ^sts$success
then signal VAX Condition(sts$value);
usrname_buflen = user_len;
sts$value = mail$user_get_info(user_context,userlst,output_list);
if ^sts$success
then do;
put skip list ('error detected in USER_GET_INFO');
signal VAX Condition(sts$value);
end;
sts$value = mail$user_end(user_context,nullist,nullist);
if ^sts$success
then signal VAX Condition(sts$value);
put skip list ('Mail profile data for ',substr(retusername,1,retname_len));
put skip list ('Your mail file directory is ',substr(full_dir,1,dir_len));
put skip list (' ');
put skip list ('You have ',new_msg, ' new messages');
if for_len = 0
then put skip list ('You have not set a forwarding address');
else put skip list ('Your mail is being forwarded to ', forwarding);
put skip list ('Your personal name is ',substr(per_name,1,per_len));
if edt_len = 0
then put skip list('You have not specified an editor');
else put skip list('Your editor is ', substr(editor,1,edt_len));
if substr(cc_prompt,1,1) = '0'b
then put list ('CC prompting is disabled.');
else put list ('CC prompting is enabled.');
put skip list('Automatic copy to yourself on');
if substr(cpy_snd,1,1) = '1'b
then put skip list (' SEND ');
if substr(cpy_rep,1,1) = '1'b
then put skip list (',REPLY ');
if substr(cpy_for,1,1) = '1'b
then put skip list(',FORWARD ');
if (substr(cpy_snd,1,1) = '0'b & substr(cpy_rep,1,1) = '0'b &
substr(cpy_for,1,1) = '0'b)
then put skip list (' Nothing');
put skip list ('Automatic deleted message purge is ');
if substr(auto_purg,1,1) = '0'b
then put list('disabled.');
else put list('enabled.');
if que_len = 0
then put skip list('You have not specified a default queue.');
else put skip list ('Your default print queue is ',
substr(queuename,1,que_len));
if form_len = 0
then put skip list ('You have not specified a default print form.');
else put skip list ('Your default print form is ',
substr(user_form,1,form_len));
end send_file;
|
buy online or call 1.800.AT.COMPAQ
|
|