1. Patrick Sohr
  2. PowerBuilder
  3. Wednesday, 16 August 2017 07:33 AM UTC

Hello,

we try to read (larger) files with the filereadex function into a blob. Our application crashes with a "Bad runtime function reference" error. I tried with around 500 files and found 5 files with this error. 

I also found this bug report https://apps.support.sap.com/sap/support/knowledge/preview/en/2475963 and I think it is the same problem. We use PB12.6 atm. Is this bug still there in PB 2017?

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 16 August 2017 13:58 PM UTC
  2. PowerBuilder
  3. # 1

Hi Patrick;

  Check out my earlier response to a similar question (click here).

HTH

Regards ... Chris

Comment
  1. Patrick Sohr
  2. Thursday, 17 August 2017 08:37 AM UTC
Hey,



you mean like this?



do while FileRead(li_filenum, lb_temp) > 0



lb_file += lb_temp



loop



 



With my files it seams i'm running in an endless loop ... not sure ... try catch doesn't catch an error.

  1. Helpful
  1. David Peace (Powersoft)
  2. Friday, 18 August 2017 09:23 AM UTC
That was what I had in mind. The fileread should return -100 when it get to the end of the file. It might be worth checking the return value from fileread i the debugger to see what is going on.



David

  1. Helpful
There are no comments made yet.
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Wednesday, 16 August 2017 08:34 AM UTC
  2. PowerBuilder
  3. # 2

Hi Patrick

I'm not sure anyone on here will be able to answer that. My guess is that it has not been fixed, but really you are the only one ho can prove that having a reproducible problem.

If as I suspect that you are stuck with this problem then you need to ask why you are reading over 300MB into ram in a blob. Is there another way to achieve the same process that perhaps uses a different method or even breaks the file down into chunks.

Keep us updated on how you get on and if we can help with an alternative method please tell us more about the business process.

Regards

David

Comment
  1. Patrick Sohr
  2. Wednesday, 16 August 2017 11:50 AM UTC
Hey,



its an file upload to an API. Under normal circumstances the API is for uploading smaller documents (pdf, jpg, ...) so there is no problem. But we have a customer who wants to upload bigger files too. Here is some code





li_filenum = fileopen(gs_ablage_path + is_ablage, StreamMode!, Read!, LockWrite!)

filereadex(li_filenum, lb_file)

fileclose(li_filenum)

ls_adress = iou_kundenportal.is_kundenportal_domain + 'kundenportal/api/dokument_file/' + string(il_kundenportal_id) + '/'

lole_xmlhttp.open("PUT", ls_adress, false)

lole_xmlhttp.setRequestHeader("Authorization", "Token " + ls_token )

lole_xmlhttp.setRequestHeader("Content-Type", "*/*" )

lole_xmlhttp.setRequestHeader("Content-Disposition","attachment; filename=" + toolbox.uf_cleanfilename(extractfilename(is_ablage)))

lole_xmlhttp.setRequestHeader("Content-Length", string(len(lb_file)) )

lole_xmlhttp.send(lb_file)



I deleted all the error handling and so around it but yeah, thats what I try to do in a nutshell :)

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.