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

Re: Multiple output reports question



Hi Ben.

Just to explain why your program was not doing what you expected.  The
new-report command closes the current output file and opens a new one.  For
each iteration of your select statement you were closing first_name.lis and
then opening it and overwriting it.  As Ray's program shows the command you
needed to use was the use-report command to change the output destination.

Also note that 'begin-report' should no longer be used.  Begin-program
should be used in its place.

John Milardovic

> -----Original Message-----
> From: Ray Ontko [SMTP:rayo@ONTKO.COM]
> Sent: Monday, June 28, 1999 10:48 PM
> To:   Multiple recipients of list SQR-USERS
> Subject:      Re: Multiple output reports question
>
> Benjamin,
>
> Here is a sample program that writes first-names to one report and
> last-names to another report using a single select.
>
> Ray
>
>    begin-setup
>    declare-report first
>    end-declare
>    declare-report last
>    end-declare
>    end-setup
>
>    begin-program
>    do main
>    end-program
>
>    begin-procedure main
>    use-report last
>    new-report 'last.lis'
>    use-report first
>    new-report 'first.lis'
>    begin-select
>    last_name &last_name
>    first_name &first_name
>       use-report last
>       print &last_name (1,1)
>       next-listing
>       use-report first
>       print &first_name (1,1)
>       next-listing
>    from emp
>    order by last_name , first_name
>    end-select
>    end-procedure
>
> Here is some sample output:
>
> (last.lis)
>
>
>
>      Flintstone
>      Flintstone
>      Flintstone
>      Rubble
>      Rubble
>      Rubble
>
> (first.lis)
>
>
>
>      Fred
>      Pebbles
>      Wilma
>      Bam Bam
>      Barney
>      Betty
>
> > ORACLE 7.3, HP-UX 10.00, SCT-BANNER 3.1
> > I am trying to create two report outputs in the same SQR program. As the
> > example bellow, I want to print last names on the default report output
> > name and first names on a NEW-REPORT output.
> >
> > Example codes:
> > --------------
> > begin-report
> >  do main
> > end-report
> >
> > begin-procedure main
> > begin-select
> > spriden_last_name &last
> > spriden_first_name &first
> >  print &last (+1,1)
> >  new-report '/home/ble/first_name.lis'
> >  print &first (+1,1)
> > from spriden
> > end-select
> > end-procedure main
> >
> > Is there a reset command after printing first name on 'first_name.lis'
> > (new-report) to prevent the next last name record prints on the
> > 'first_name.lis'?
> >
> > The example above overwritten the next first name on the same line of
> > previous first name on the 'first_name.lis'. How do I print the next
> first
> > name on the next line and so on on the 'first_name.lis'.
> >
> > Since we have to use Job Submission for the default report with the
> special
> > format report name, DECLARE-REPORT and USE-REPORT can not be used here.
> >
> > I hope my questions do not cause me as an idiot. Thanks for your help.
> >
> >
> >
> > Ben Le
> > ITS - Sylvania CC-224
> > Voice:(503)-977-4970  Fax:(503)-977-4987
> > Mailto:ble@pcc.edu
> >
>
> ----------------------------------------------------------------------
> Ray Ontko       |  Ray Ontko & Co  |  "RO&C: data movers and shakers."
> rayo@ontko.com  |  Richmond, In    |  See us at http://www.ontko.com/