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

Re: dat output files



Yolanda,

I've included some code that might help you get started.

begin-procedure InitRoutine
   .
   .
   .
  !Assign filename and path to variable <optional>
  !and call procedure to handle opening your file(s)
  let $output_file  = 'c:\temp\filename.dat'
  Do Open-files
   .
   .
   .
end-procedure


begin-procedure Open-files
  OPEN $output_file AS 1
  FOR-WRITING
  RECORD=050:FIXED
  STATUS = #Open1

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

! Once you open the file you must select your data
! and move it to the output fields (defined in your
! write statement.)
  move &a.emplid to $0field1
  move &a.name   to $0field2
  move &a.misc   to $0field3

! Call the write procedure for each record
! you want to write.
  Do WriteRecordOut

!Write procedure
Begin-Procedure WriteRecordOut
 WRITE 1 FROM $Ofield1:6
              $Ofield2:20
              $Ofield3:20
              $Ofiller:4
End-Procedure

I don't use an explicit close statement. I assume SQRW handles that
at program termination. But you can include one if you like

  !close output file
  close 1


Hope this helps you get going.


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