NetTalk Central

Author Topic: Open file error?  (Read 3822 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 376
    • View Profile
    • Email
Open file error?
« on: June 11, 2013, 11:56:04 PM »

Been trying to resolve an error on some handcode that I inserted in a procedure routine
I then created these 3 blocks of code to try and check where it's failing

The first 2 fails to open the file,
the last, classic low level legacy code works

Any ideas where this is going wrong

Are there any gotchas for opening and closing of files in routines?
Where are the errors reported if it has errors?

TIA

Johan



! fails
      do openfiles
      set(pay:payment_isn_key,pay:payment_isn_key)
      next(payment)
      if error()
         message('do openfiles:' & error())
      end

! fails
      p_web._OpenFile(payment)
      set(pay:payment_isn_key,pay:payment_isn_key)
      next(payment)
      if error()
         message('p_web._OpenFile(payment):' & error())
      end

!works
      open(payment)
      if error()
         message('open(payment) ' & error())
      end
      next(payment)
      set(pay:payment_isn_key,pay:payment_isn_key)
      if error()
         message('open(payment) next' & error())
      end



kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Open file error?
« Reply #1 on: June 12, 2013, 01:28:28 AM »
Are you trying to fetch a record or loop through a file? Either way it is not openfile failing it is accessing the data in the file

try something like this to fetch

      do openfiles
      pay:payment_isn = xxx
      If Access:Payment.Fetch(pay:payment_isn_key)
         message('do openfiles:' & error())
      End

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Open file error?
« Reply #2 on: June 12, 2013, 01:41:38 AM »
what procedure type?

what files are listed in the OpenFiles routine?

Is the app Legacy or ABC?

If you look in the OpenFiles routine, what do you see there?

cheers
Bruce

JohanR

  • Sr. Member
  • ****
  • Posts: 376
    • View Profile
    • Email
Re: Open file error?
« Reply #3 on: June 12, 2013, 02:53:54 AM »

Hi Bruce

ABC web app, multi dll.
I have recompiled all apps, including data dll.

Is there a way to switch on error reporting on file access, to have them logged to a certain file or similiar?
Perhaps I should check in the file access class.


thanks

Johan




The files are listed in the routine as below

OpenFiles  ROUTINE
! Start of "Beginning of Procedure, Before Opening Files"
! [Priority 5000]

! End of "Beginning of Procedure, Before Opening Files"
  p_web._OpenFile(invoice)
  p_web._OpenFile(cctrans)
  p_web._OpenFile(client)
  p_web._OpenFile(ccnr)
  p_web._OpenFile(payment)
  p_web._OpenFile(payitem)
  FilesOpened = True
! Start of "Beginning of Procedure, After Opening Files"
! [Priority 5000]


JohanR

  • Sr. Member
  • ****
  • Posts: 376
    • View Profile
    • Email
Re: Open file error?
« Reply #4 on: June 12, 2013, 03:19:02 AM »


Hi,

Got it fixed,
thanks Kevin

It was my legacy access code that was the problem.
Was a piece of code I copied from legacy app.

Still interesting why a legacy next(file) would fail, without using the abc equivalent.


Johan


kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Open file error?
« Reply #5 on: June 12, 2013, 03:04:58 PM »
I think you were just missing pay:payment_isn = xxx before the set