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

Re: [sqr-users] email a file from sqr



Richard, Ivan,

You can get around the "file has to be closed" problem by using
the new-report command (e.g., "new-report ''").  This causes
SQR to end the output file (to start a new one) and the various
output files are produced.

Ray

On Thu, Oct 09, 2003 at 08:29:21AM -0500, Knapp, Richard wrote:
> 
> I've used call system to e-mail a file from within the sqr environment.  Two 
>things:  The file has to be closed (can't create with print, need to use write 
>and an explicit close), the mailer on the source machine has to be accessible 
>from the command line.
> 
> Richard Knapp
> Database Programmer/Analyst
> Institutional Research and Planning
> University of Missouri System
> 573-882-8856
> knappr@umsystem.edu
> 
> 
> -----Original Message-----
> From: Turner, Ivan [mailto:Ivan.Turner@qwest.com]
> Sent: Wednesday, October 08, 2003 5:04 PM
> To: sqr-users@sqrug.org
> Subject: [sqr-users] email a file from sqr
> 
> 
> Isn't there an easier way to email a file to users that have entered their 
>e-mail address on a panel?  The example below creates a ksh script for a unix 
>box.  I would think I could give a one liner in a sqr "call system".
> 
> Begin-Procedure 810-email-csv-file
>  let $rptdir = getenv('ARMSRPT')
> string 
> $rptdir
> '/'
> 'email_list.ksh'
> by '' into $emailscript
> 
> open $emailscript as 3 for-writing record = 500 status = #scriptst
> 
> if #scriptst != 0
>    let $prcs_run_status='E'
>    let $prcs_message_parm1 = 'FTP File open error'
>    do update-prcs-run-status
>       rollback
>    stop
> end-if
> 
> Let $csvfile = 'CSV_FILE='||$file_name 
> let $mail_sub = 'Cash Tracking Report ' || $file_name 
> Let $mail_list = 'EMAIL_LIST='||$email_list
> show $emailscript
> show $csvfile
> show $mail_sub
> show $mail_list
> write 3 from $csvfile
> write 3 from $mail_list
> Let $email_string1='uuencode ' || $file_name || ' ' || $file_name 
> Let $email_string2='mailx -m -s "' || $mail_sub || '" $EMAIL_LIST '
> string $email_string1
> $email_string2 
> by '|'
> into $email_string
> show $email_string
> write 3 from $email_string
> close 3
>      string 'chmod +x ' $emailscript   by '' into $chmode_command
>      call system using $chmode_command  #unix_status 
> call system using $emailscript #emailrc
> 
> Let #emailrc = 0
> 
> if #emailrc != 0
>    let $prcs_run_status='E'
>    let $prcs_message_parm1 = 'ftp error'
>    do update-prcs-run-status
> rollback
> end-if
> end-procedure
> 
> -----Original Message-----
> From: Poonam Auluck [mailto:poonam.auluck@ams.com]
> Sent: Wednesday, September 10, 2003 10:55 AM
> To: sqr-users@sqrug.org
> Subject: RE: [sqr-users] Alphabetize Question
> 
> 
> 
> Hey All,
> 
> I didn't word my question correctly last night....I wasn't trying to order
> a recordset resulting from sql...
> 
> I just had two input variables, that I needed to alphabetize because I was
> building a between clause.
> 
> I've figured it out as such:
> 
> 
> let $doc1 = 'BB'
> let $doc2 = 'AA'
> if $doc1 > $doc2
>    let $from_doc = $doc2
>    let $to_doc = $doc1
> else
>    let $from_doc = $doc1
>    let $to_doc = $doc2
> end-if
> 
> Which is exactly what I needed...
> 
> Thanks for your help,
> Poonam
> 
> 
> 
>                                                                               
>                                                         
>                       Scotty Barnes                                           
>                                                         
>                       <sbarnes@wesleyan        To:       sqr-users@sqrug.org, 
><sqr-users@sqrug.org>                                    
>                       .edu>                    cc:                            
>                                                         
>                       Sent by:                 Subject:  RE: [sqr-users] 
>Alphabetize Question                                          
>                       sqr-users-admin@s                                       
>                                                         
>                       qrug.org                                                
>                                                         
>                                                                               
>                                                         
>                                                                               
>                                                         
>                       09/10/2003 09:29                                        
>                                                         
>                       AM                                                      
>                                                         
>                       Please respond to                                       
>                                                         
>                       sqr-users                                               
>                                                         
>                                                                               
>                                                         
>                                                                               
>                                                         
> 
> 
> 
> 
> Don't listen to this suggestion.
> If you use order by col1 , col2
> 
> it will put all of col1 in ascending order if any of col1 are duplicate
> values it will put col2 in ascending order after it ordered col1. e.g.
> 
> (1,3),(1,2),(2,2),(2,1)
> 
> would be selected as
> 
> col 1   col2
> 1       2
> 1       3
> 2       1
> 2       2
> 
> Thus col1 is not always less than col2 which it seemed you were asking for.
> 
> There earlier suggestion of $col1 < $col2 is the best if you want to check
> to variables of which is first.
> 
> or you can use
> select
> col1
> from table
> union
> select col2
> from table
> order by 1
> end-select
> 
> This would sort the list above like this:
> 
> 1
> 1
> 1
> 2
> 2
> 2
> 2
> 3
> 
> 
> or
> 
> There is a chapter on the quick sort in the SQR reference guide if you need
> 
> to sort many items in a list that can not be selected in the example I
> showed you above.
> 
> Hope this helps
> 
> scotty
> 
> 
> At 09:08 AM 9/10/2003, Thornton, Robert wrote:
> >One option would be to put order by in the select clause.
> >
> >Example:
> >
> >BEGIN-SELECT
> >value1  &value1
> >value2  &value2
> >from table
> >where blah blah
> >Order by value1, value2
> >
> >END-SELECT
> >
> >-----Original Message-----
> >From: sqr-users-admin@sqrug.org [mailto:sqr-users-admin@sqrug.org] On
> >Behalf Of Poonam Auluck
> >Sent: Tuesday, September 09, 2003 8:46 PM
> >To: sqr-users@sqrug.org
> >Subject: [sqr-users] Alphabetize Question
> >
> >
> >Hi,
> >
> >I was wondering if anyone knows if there is a sqr function that will
> >alphabetize two variables.
> >
> >Or if I can put the variables into an array and then alphabetize them.
> >
> >Any ideas??
> >
> >Any help is appreciated!!
> >
> >Thanks,
> >Poonam
> >
> >
> >
> >
> >
> >_______________________________________________
> >sqr-users mailing list
> >sqr-users@sqrug.org
> >http://www.sqrug.org/mailman/listinfo/sqr-users
> 
> 
> ----------
> 
> Scott A Barnes
> Programmer/Analyst
> Wesleyan University
> North College
> 860-685-2807
> 
> 
> ----------
> Lottery: A tax on people who are bad at math!
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
> 
> 
> 
> 
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
----------------------------------------------------------------------
Ray Ontko   rayo@ontko.com   Phone 1.765.935.4283   Fax 1.765.962.9788
Ray Ontko & Co.   Software Consulting Services   http://www.ontko.com/

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users