[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: SQR generated e-mail from UNIX



One thing about emailing .lis files.

I used to email mine from unix, but our exchange server started to crash.
When I stopped emailing the .lis file, the server stopped crashing.  I think
it had something to do with the printer control characters in the file.

If you are really determined to do this, here would be my suggestion:

Declare a new report at the end of your processing.  If you declare a new
report, your old "real" report should be freed up.  You could then mail it,
I think.

The other option would be to cat the lis file into another file:


  let $command = 'cat /fullpath/filename > /fullpath/temp.file'
  call system using  $command  #unix_status


  let $command = 'mail kmason@gix-global.com < /usr/tmp/temp.file'
  call system using  $command  #unix_status


  if your Exchange server crashes (and, maybe it won't), try running your
file through
  a script first to strip out the lines with the printer characters.

  It would be something like this.  It takes two little scripts to to make
it work smoothly:
!---------------------------------------------------------------------------
-----
main.ksh

#ksh
# Gracen Duffield
#
# .lis files cannot be sent through exchange because the printer
# control characters bring down the server.  At least,  that is
# the observed relationship between printer control characters and
# exchange
#
#  The printer control characters are located on the first line of the
#  file.  Therefore, the first line needs to be eliminated.
#
#  This script is kind of clunky, but it does the trick.
#
#  This is the junk I am trying to get rid of:
#  ^[E^[(0N^[&l1O^[&l8D^[&l5E^[&l66F^[(s16.66H^[&k2G
#
#  $1 is the full path and file name
#
sed -f /home/path/lisdel.ksh $1 > /home/path/outfile.txt

cat /home/path/outfile.txt > $1

date >> $1

#  The date is added because the .lis file last line is always incomplete
#  when you vi it.

!------------  Here is the second file lisdel.ksh
1d
/SearchTerm/d

!----- It removes the first line because of the printer characters
!----- and it removes anyline with SearchTerm on it because there are
!----- also printer characters there.

The call from the sqr would be:

  let $command = '/home/path/lisdel.ksh /path/something.lis'
  call system using  $command  #unix_status


Gracen Duffield
Texas Department of Housing and Community Affairs
475-3839


-----Original Message-----
From: Discussion of SQR, SQRIBE Technologies's database reporting
language [mailto:SQR-USERS@list.iex.net] On Behalf Of Kathy Mason
Sent: Tuesday, September 21, 1999 9:29 AM
To: Multiple recipients of list SQR-USERS
Subject: SQR generated e-mail from UNIX


I have searched the archives and with the help I found there I was able to
set-up an automatic e-mail generated by my SQR.  However, I have 2
questions.  I
have been able to write to a file close it in my SQR and then e-mail it or
have
an SQR e-mail a .lis file generated by a previously run SQR.  I cannot get
the
.lis file e-mailed from the SQR in which it is created.  The error message I
get
is "cannot find or open the file"  Can a .lis file be e-mailed from within
the
SQR that creates it?

Second question, can I e-mail to more than one e-mail address in one
command.  I
am using the call system using command in Unix.  I have been able to
accomplish
it by repeating my code, but I thought perhaps there was a better way.

Here is a sample of my code:

  let $command = 'mail kmason@gix-global.com < /usr/tmp/summary.dat'
  call system using  $command  #unix_status

Any help you can give me would be appreciated.
Thanks,
Kathy