Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use the variable(have value of mail id) instead of entering mail id directly within mail code?

 
SOLVED
Go to solution
Highlighted
Meen
Occasional Advisor

Can I use the variable(have value of mail id) instead of entering mail id directly within mail code?

Hello All,

I am writing the code to generate the report and automatically send it to specific mail id.

Within the command ,I have saved the mail id within the variable named MAIL_ID

I am trying to access mail id in mail command using variable name (MAIL_ID),but it not works.

In similar way, I saved the filename within variable name FILENAME_TXT and accessed it using variable name in mail command and it works.But it didnt recognize the mail id within the variable.

It recognizes mail id as filename and displays no file found.

Could you please let me know how to resolve it?

8 REPLIES 8
Steven Schweda
Honored Contributor

Re: Can I use the variable(have value of mail id) instead of entering mail id directly within mail c

> I am trying to access mail id in mail command using variable name
> (MAIL_ID),but it not works.

   Instead of trying to describe your code, why not just show your code?
It's hard to guess what you're thinking, or what you're doing.  Are you
talking about something like this?:

its $ type text.txt
   Text.

its $ filename = "text.txt"

its $ type filename
%TYPE-W-SEARCHFAIL, error searching for ITS$DKA0:[SMS.itrc]filename.LIS;
-RMS-E-FNF, file not found

its $ type 'filename'
   Text.

      https://support.hpe.com/hpsc/doc/public/display?docId=a00058693en_us
      https://support.hpe.com/hpsc/doc/public/display?docId=emr_na-c04623190

   Look for:
      12  Defining Symbols, Commands, and Expressions
      12.12  Understanding Symbol Substitution

Meen
Occasional Advisor

Re: Can I use the variable(have value of mail id) instead of entering mail id directly within mail c

Hello Steven,

Thanks for the reply.

Here is the code stored in variabletest.com file:

EMAIL_ID = ""bm957383@gsk.com""
FILE_NAME_TXT="meenakshi.txt"
mail 'FILE_NAME_TXT' /subj= "trial mail" 'EMAIL_ID'
exit

when I try to run this .com file,it displays below error.

BRESA4_BM957383>@variabletest.com
%DCL-W-SYMDEL, invalid symbol or value delimiter - check command syntax
%DCL-W-PARMDEL, invalid parameter delimiter - check use of special characters
\.TXT\

 

Maurizio De Tommaso_
Valued Contributor

Re: Can I use the variable(have value of mail id) instead of entering mail id directly within mail c

Hello,

your simple DCL code runs, as expected, errors free :

$ type variabletest.com

$! disk$reserve:[dcl_procedures]variabletest.com
$ EMAIL_ID = "system"
$ FILE_NAME_TXT="disk$reserve:[dcl_procedures]meenakshi.txt"
$ mail 'FILE_NAME_TXT' /subj= "trial mail" 'EMAIL_ID'
$ exit
$!

$ @variabletest
New mail on node SHARK from SHARK::SYSTEM

Please, capture the output of the following steps :

$ set ver
$ @variabletest

And please, tell me also the platform you are working on (Vax, Alpha or Integrity) and the VMS version.

Regards,
/Maurizio

 

Meen
Occasional Advisor

Re: Can I use the variable(have value of mail id) instead of entering mail id directly within mail c

Hello Maurizio,

Thanks for the reply.

Please find the below error I received when I tried in our server.

Content in the file: VARIABLETEST.COM

EMAIL_ID="bm957383@gsk.com"
FILE_NAME_TXT="DKC0:[USERS.BM957383]meenakshi.txt"
mail 'FILE_NAME_TXT' /subj="Trial mail variables check" 'EMAIL_ID'

Running the command:

$ @variabletest.com

Error:

%DCL-E-OPENIN, error opening DKC0:[USERS.BM957383]GSK.COM; as input
-RMS-E-FNF, file not found

It considers my email Id as text file and shows error as "FILE NOT FOUND"

My current server is  Compaq Alpha Server ES40

Operating System : OpenVMS 7.1-2

Volker Halle
Honored Contributor

Re: Can I use the variable(have value of mail id) instead of entering mail id directly within mail c

If you want to use an SMTP mail address, you should constuct the e-mail address symbol like:

$ EMAIL_ID = "smtp%""bm957383@gsk.com"""   ! it's one, two and three double-quotes in this line

Volker.

Meen
Occasional Advisor

Re: Can I use the variable(have value of mail id) instead of entering mail id directly within mail c

Hello Volker,

I tried as you mentioned,unfortunately I got below error.

BRESA4_BM957383>@variabletest.com
%MAIL-E-NOSUCHUSR, no such user EXIT

contents in file:

EMAIL_ID="smtp%""bm957383@gsk.com"""
FILE_NAME_TXT="meenakshi.txt"
mail 'FILE_NAME_TXT' /subj="trialwith variables" 'EMAIL_ID'
exit

Maurizio De Tommaso_
Valued Contributor
Solution

Re: Can I use the variable(have value of mail id) instead of entering mail id directly within mail c

Perfect, I figured out where your problem was :

$! disk$reserve:[dcl_procedures]variabletest.com
$ EMAIL_ID = "system@digital.com"
$ FILE_NAME_TXT="meenakshi.txt"
$ mail 'FILE_NAME_TXT' /subj= "trial mail" "smtp%''EMAIL_ID'"
$ exit

Please, let me know.

Best Regards,
/Maurizio

Meen
Occasional Advisor

Re: Can I use the variable(have value of mail id) instead of entering mail id directly within mail c

Thank you so much Maurizio!

It exactly works. Thanks a ton :)