Hi Ramamurthy and All,
I am still getting the same error. Please help.
content of script used:
OUTFILE=$HOME/outfile.txt;export OUTFILE
cat $* > $OUTFILE
/usr/users/ssdb_mgr/unix2dos $OUTFILE
##----------------------------------------------##
## Run PROGRESS program to find email address ##
## and send attachment as an email to Notes ##
##----------------------------------------------##
display_banner=no;export display_banner
mbpro -b -p xxmailx.p -pf $SSDBPF/ssdb_user.pf -d dmy
xxmailx.p program content:
/*-----------------------------------------*/
/* Variables used by Email with attachment */
/*-----------------------------------------*/
define variable wk_userid as character format "X(8)" no-undo.
define variable wk_home_dir as character format "X(50)" no-undo.
define variable wk_scriptname as character format "X(50)" no-undo.
define variable wk_outfilename as character format "X(80)" no-undo.
define variable wk_subject as character format "X(80)" no-undo.
define variable wk_site as character init "UNKNOWN" no-undo.
define variable wk_attachment as character format "X(80)" no-undo.
define variable wk_messagebody as character format "X(80)" no-undo.
define variable wk_filesize as integer no-undo.
define variable wk_maxfilesize as integer no-undo.
define variable wk_limitfilesize as logical init "NO" no-undo.
define variable wk_allow_attach as logical init "YES" no-undo.
define variable wk_defaultmax as integer init "102400" no-undo.
define variable wk_user_mail as character no-undo.
/*---------------------*/
/* Main Program Begins */
/*---------------------*/
/**------------------**/
/** Initialisation **/
/**------------------**/
assign
wk_maxfilesize = 0
wk_limitfilesize = NO
wk_allow_attach = YES
wk_home_dir = OS-GETENV("HOME")
wk_scriptname = wk_home_dir + "/temp_script_for_email"
wk_attachment = "Undefined"
wk_messagebody = wk_home_dir + "/message.txt"
wk_userid = userid(sdbname("ssdb"))
wk_user_mail = "".
find first QG_User where user_id = wk_userid
no-lock no-error.
if available QG_User then
do:
wk_user_mail = trim(user_mail).
end. /*if available QG_User*/
assign
wk_site = wk_userid + "_SSDB"
wk_outfilename = OS-GETENV("OUTFILE").
if wk_outfilename matches "*.pdf" then
do:
wk_attachment = wk_site + ".PDF".
wk_subject = "See file attached in pdf format requested from "
+ "SSDB on " + (string(today)) + " at " + (string(time,"HH:MM:SS")).
end. /*if wk_outfilename matches "*.pdf"*/
else
do:
wk_attachment = wk_site + ".TXT".
wk_subject = "See file attached in txt format requested from "
+ "SSDB on " + (string(today)) + " at " + (string(time,"HH:MM:SS")).
end. /*else*/
/**---------------------------------------------------------------**/
/** Construct the mailx script if wk_user_mail is not blank **/
/**---------------------------------------------------------------**/
if wk_user_mail <> "" then
do:
/**---------------------------------------------------------**/
/** Check whether attachment filesize limit is configured **/
/** or not. If so, retrieve the filesize set and use it. **/
/**---------------------------------------------------------**/
assign wk_maxfilesize = 10000000 no-error.
if error-status:error then
do:
wk_maxfilesize = wk_defaultmax.
wk_limitfilesize = YES.
end.
else /*if no error*/
do:
wk_limitfilesize = YES.
end.
wk_limitfilesize = NO.
/**-------------------------------------------------------**/
/** If wk_limitfilesize is TRUE, check the attachment **/
/** byte size to make sure it does not exceed the value **/
/** set in wk_maxfilesize **/
/**-------------------------------------------------------**/
input from value(wk_outfilename).
seek input to end.
assign wk_filesize = seek(input).
if (wk_limitfilesize = YES) and
(wk_filesize > wk_maxfilesize) then
wk_allow_attach = NO.
else
wk_allow_attach = YES.
/**---------------------------**/
/** Create the mailx script **/
/**---------------------------**/
if wk_allow_attach = YES then
do:
output to value(wk_scriptname).
put unformatted
'uuencode ' wk_outfilename ' ' wk_attachment ' | '
'mailx -s '
'"' wk_subject '" '
wk_user_mail.
output close.
end. /*if wk_allow_attach = YES*/
else /*if wk_allow_attach = NO*/
do:
wk_subject = "Attachment file too big and prevented from reaching you".
output to value(wk_messagebody).
put unformatted
'The attachment file you have requested from ' +
'SSDB on ' +
(string(today)) + " at " +
(string(time,"HH:MM:SS"))
skip
'had exceeded the maximum file size allowed.'
skip(2)
'Attachment file size : ' +
left-trim(string(wk_filesize,">>>,>>>,>>>,>>9")) +
' bytes'
skip(1)
'Maximum size allowed : ' +
left-trim(string(wk_maxfilesize,">>>,>>>,>>>,>>9")) +
' bytes'
skip(2)
'This is an automated message from ' + 'SSDB.'
skip(1)
'Please do not reply to sender.'
skip(1).
output close.
output to value(wk_scriptname).
put unformatted
'mailx -s '
'"' wk_subject '" '
wk_user_mail
' < ' wk_messagebody.
output close.
end. /*else*/
/**------------------**/
/** Run the script **/
/**------------------**/
unix silent chmod a=rwx value(wk_scriptname). /*Make script exectuable*/
unix silent value(wk_scriptname). /*Execution*/
unix silent rm -f value(wk_scriptname). /*Clean up*/
unix silent rm -f value(wk_messagebody). /*Clean up*/
end. /*if wk_user_mail <> ""*/
/*----------------*/
/* End of Program */
/*----------------*/
Thanks and Regards,
Deepan N.