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

Re: printing



At 12:41 PM 11/5/97 -0500, you wrote:
>A simple question.  Normally,whenever I run a script thru SQR I get back a
..lis
>file (I am running it on UNIX with Sybase).  Then I send that .lis file to a
>laser printer.
>Now, I need to run the script so that I get back a plain text file, no
need to
>worry about formatting, I've already taken out all the nice looking stuff.
 But
>I need to create a plain file. Anyone know how?

Aaron,

Another alternative is to create an output file instead of using the default
report output. You need a procedure to open a file for writing. Then you need
to populate the variables in the output record. Then you need to write the
output record. When you are done you should close the file (although I
think SQR will close the file when the program terminates.)

Scott Gunter
Teledyne Ryan Aeronautical

Example...

!**********************************************************************
! Open-Files: Open all files related to SQR
!
! -open the file fixed length for writing
!
!**********************************************************************
begin-procedure Open-files
  display 'output destination: ' noline
  display $output_file
  OPEN $output_file AS 1
  FOR-WRITING
  RECORD=150:FIXED
  STATUS = #Open1

  IF #Open1 = -1
     DISPLAY 'Error opening ' NOLINE
     DISPLAY $output_file
     DISPLAY 'Status is ' NOLINE
     DISPLAY #Open1
     STOP QUIET
  END-if
end-procedure

!***********************************************************************
! WriteRecordOut
!         Writes the output records
!**********************************************************************
!Build/Write Record to Output File
Begin-Procedure WriteRecordOut
WRITE 1 FROM  $company:6 $traclock:5 $filler:1 '"01"':4 &A.ssn:9 $cybname:30
              $street1:30 $street2:30 $citystate:21 &A.zip:5 $birthdate:6
              $termcd:2 &A.sex:1
End-Procedure

!***********************************************************************
! CloseFiles
!         Close the output file
!**********************************************************************
Begin-Procedure CloseFiles
Close 1
End-Procedure



Scott Gunter
IS Representative SR
Teledyne Ryan Aeronautical
619/291-7311 x1741