[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



place it in it's own procedure like this, and then call it from the 
begin-program: (this is a generic section in my code; modify as needed)

! ------*-*-----------------------&---------(--,----)------------*-*---+
!        - OPEN THE FILES -                                            |
!        - this procedure opens any flat files needed for         -    |
!        - processing. [CW]                                       -    |
!        - desc :                                                 -    |
!        - proc :  6                                              -    |
!        - from :  0                                              -    |
!        - 14-Dec-1999 [CW]                                       -    |
! ------*-*-----------------------&---------(--,----)------------*-*---+

begin-procedure open_the_files

show 'Entering OPEN THE FILES :  proc  6 '

let $file_name   = 'racsreplen.dat'
let $environment = getenv('ORACLE_SID')

show 'Environment = |' $environment '|'

let $source_file  = '/data/' || $country_code || lower($environment) || 
'/OM/export/'
let $source_file  = $source_file || {name} || '_' || $prcs_process_instance 
|| '.txt'

evaluate $environment
  when = 'ERPDEV'
!    let $source_file  = '/data/' || $country_code || lower($environment) || 
'/OM/export/'
!    let $source_file  = $source_file || {name} || '_' || 
$prcs_process_instance || '.txt'
!    break
  when = 'ERPQA'
!    let $source_file  = '/data/' || $country_code || lower($environment) || 
'/OM/export/'
!    let $source_file  = $source_file || {name} || '_' || 
$prcs_process_instance || '.txt'
!    break
  when = 'ERPPROD'
!    let $source_file  = '/data/' || $country_code || lower($environment) || 
'/OM/export/'
!    let $source_file  = $source_file || {name} || '_' || 
$prcs_process_instance || '.txt'
    break
  when-other
    show 'What environment are you running this program in?'
    stop quiet
end-evaluate

! evaluate $environment
!   when = 'ERPDEV'
!     let $source_file  = '/data/RA/erpdev/PO/import/racsreplen.dat'
!     let $success_path = '/data/RA/erpdev/PO/import/.processed/'
!     let $reject_path  = '/data/RA/erpdev/PO/import/.rejects/'
!     break
!   when = 'ERPQA'
!     let $source_file  = '/data/RA/erpqa/PO/import/racsreplen.dat'
!     let $success_path = '/data/RA/erpqa/PO/import/.processed/'
!     let $reject_path  = '/data/RA/erpqa/PO/import/.rejects/'
!     break
!   when = 'ERPPROD'
!     let $source_file  = '/data/RA/erpprod/PO/import/racsreplen.dat'
!     let $success_path = '/data/RA/erpprod/PO/import/.processed/'
!     let $reject_path  = '/data/RA/erpprod/PO/import/.rejects/'
!     break
!   when-other
!     show 'What environment are you running this program in?'
!     stop quiet
! end-evaluate

! let $source_file = '/data/RA/erpdev/PO/import/brian1.dat'
! let $source_file = '/data/RA/erpqa/PO/import/brian1.dat'
! let $source_file = '/data/RA/erpprod/PO/import/brian1.dat'

open $Source_File as 1
    for-reading record=640:vary
    status=#File_1_Status

if ( #File_1_Status <> 0 )
  show 'Could not open input file: ' $Source_File
  show ' '
  show 'SQR Halted.'
  stop quiet
else
  show 'Input file 1 successfully found and opened.' ! [CW]
end-if

open $Source_File as 2
    for-writing record=640:vary
    status=#File_2_Status

if ( #File_2_Status <> 0 )
  show 'Could not open output file: ' $Source_File
  show ' '
  show 'SQR Halted.'
  stop quiet
else
  show 'Output file 1 successfully found and opened.' ! [CW]
end-if

show 'Exiting  OPEN THE FILES'

end-procedure ! OPEN THE FILES

Those of you at Strong, tell Geoff the dragon says 'high' :-P

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----

I'm writing to a flat file and getting this error when I try to write in the 
BEGIN-HEADING section:
   (SQR 3202) Specified file number not opened for writing.

I've tried putting this:

  open $full_name as 2
    for-writing
    record=900:vary

in the HEADING and at the very beginning of BEGIN-REPORT, but it just errors 
on different line numbers.  I also tried switching BEGIN-REPORT to 
BEGIN-PROGRAM.  Any guidance?

Thanks,
Ben Anderson

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

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