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

RE: [sqr-users] write 1 from $1 -> in header



why are you using begin-heading for writing file-that is for writing reports
you have to use Begin-Procedure..
some thing like this:


BEGIN-PROGRAM
  Let $Program = 'fsaercnt'
  let $full_name = $Program || '.csv'
  open $full_name as 2
    for-writing
    record=900:vary
  Do process_heading
  do print_detail_records
  close 2       
END-PROGRAM

Begin-procedure process_heading
......
  if( #flag != 1 )
    write 2 from $l3
    write 2 from $l4
    let #flag = 1
  end-if
end-procedure

Rajib Sengupta
Systems Analyst and Team Lead
Peoplesoft Financial Consultant
Conagra Business Systems
Phone: 402-595-5749

-----Original Message-----
From: Ben Anderson [mailto:pegandersonbd1@hotmail.com]
Sent: Tuesday, July 15, 2003 1:32 PM
To: sqr-users@sqrug.org
Subject: RE: [sqr-users] write 1 from $1 -> in header


sorry - I should have done this originally:

BEGIN-HEADING
  
END-HEADING

BEGIN-PROGRAM
  Let $Program = 'fsaercnt'
  let $full_name = $Program || '.csv'
  open $full_name as 2
    for-writing
    record=900:vary
  close 2
  do print_detail_records
END-PROGRAM

Here's my error:
Error on line 119:   <!-- this is the line in my HEADING -->
   (SQR 3202) Specified file number not opened for writing.

SQR: Program Aborting.

I made sure I deleted this file before running.  What happens is it creates 
the file, writes some data, and then errors when it tries to print the 
header.  The file then contains the first page of print_detail_records, but 
no header.

I only want the header to print once, which I know doesn't make sense.  The 
reason is, my report writes out a .lis and this .csv and I want to keep all 
the print commands for the .lis right next to the write commands for the 
.csv, so that's why I want it in the BEGIN-HEADING....END-HEADING.

-Ben

>From: "Alexander, Steve" <Steve.Alexander@ci.sj.ca.us>
>Reply-To: sqr-users@sqrug.org
>To: "'sqr-users@sqrug.org'" <sqr-users@sqrug.org>
>Subject: RE: [sqr-users] write 1 from $1 -> in header
>Date: Tue, 15 Jul 2003 11:11:48 -0700
>
>What do you mean "write in the header?"  Do you have write statements in 
>the
>"begin-heading ... end-heading" section, or are you talking about writing a
>header record to the file (a special record at the begining of a file that
>contains different data than the other records)?
>
>-----Original Message-----
>From: Ben Anderson [mailto:pegandersonbd1@hotmail.com]
>Sent: Tuesday, July 15, 2003 10:47 AM
>To: sqr-users@sqrug.org
>Subject: RE: [sqr-users] write 1 from $1 -> in header
>
>
>ok, all your replies made sense, but it's still not working.  It's pretty
>weird.  I have the file being opened in BEGIN-PROGRAM.  The file is being
>opened and written to.  Then when it tries the write in the header - that's
>when I get the error.  I'm not closing the file until right before
>END-PROGRAM.  It errors out and then I'm left with the first page of data
>with no header.  Any ideas?
>TIA,
>Ben
>
> >From: "the dragon" <ceprn@hotmail.com>
> >Reply-To: sqr-users@sqrug.org
> >To: sqr-users@sqrug.org
> >Subject: RE: [sqr-users] write 1 from $1 -> in header
> >Date: Tue, 15 Jul 2003 11:18:23 -0500
> >
> >Also, putting an open statement in the heading would never get executed
> >unless print output was created - and print output may be created long
> >after you try writing to a flat file that you wanted open.
> >
> >clark 'the dragon' willis
> >dragon enterprises, consulting services
> >
> >
> >
> >PSA: Salary <> Slavery.  If you earn a salary, your employer is renting
> >your services for 40 hours a week, not purchasing your soul.  Your time 
>is
> >the only real finite asset that you have, and once used it can never be
> >recovered, so don't waste it by giving it away.
> >
> >"Time is the coin of your life. It is the only coin you have, and only 
>you
> >can determine how it will be spent.  Be careful lest you let other people
> >spend it for you."
> >
> >Carl Sandburg
> >(1878 - 1967)
> >
> >----Original Message Follows----
> >
> >Don't put an open statement in the HEADING unless you want it to execute 
>at
> >the beginning of every page you print.  I'm not sure what happens when 
>you
> >try to open a file that's already open.  Maybe nothing, or maybe it 
>deletes
> >whatever you've written before and starts over.
> >
> >Add a "status=#open_status" clause to the open statement and test the 
>value
> >of #open_status.  If it isn't 0, then your attempt to open the file 
>didn't
> >work.  Why?  You might not be logged in to that drive, or the path in
> >$full_name might not exist, or you might not have write-access to it, or
> >there might already be a read-only file with that name.
> >
> >_________________________________________________________________
> >The new MSN 8: advanced junk mail protection and 2 months FREE*
> >http://join.msn.com/?page=features/junkmail
> >
> >_______________________________________________
> >sqr-users mailing list
> >sqr-users@sqrug.org
> >http://www.sqrug.org/mailman/listinfo/sqr-users
>
>_________________________________________________________________
>STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
>http://join.msn.com/?page=features/junkmail
>
>_______________________________________________
>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

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

_______________________________________________
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