STM_FILE_OPEN on iSeries

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Joerg Hamacher
Posts: 53
Joined: Thu Feb 11, 2016 12:01 am

STM_FILE_OPEN on iSeries

Post by Joerg Hamacher » Wed Jun 20, 2018 5:49 pm

Hello,

we have a webpage that uses a file picker to load a CSV-file from a local PC directory (Windows 10).
Then we save this CSV-file in a database file (NW_Artikelimport_BLOB) using a BLOB field (#NW_ArtikeldatenBLOB).
We want to show the data in a list on the web page - for this we use the server module of the file NW_Artikelimport_BLOB. Here we have the folowing steps:
  • Fetch Fields(#NW_ArtikeldatenBLOB) From_File(NW_Artikelimport_BLOB) With_Key(#NW_Nr_Artikelimport) Io_Status(#IO$STS)
  • Change Field(#w_StreamFileOptions) To('''Read Text LineTerminator=ALL ''')
  • Use Builtin(STM_FILE_OPEN) With_Args(#NW_ArtikeldatenBLOB.FileName #w_StreamFileOptions A) To_Get(#w_FileNumber #IO$STS)
  • Use Builtin(STM_FILE_READ) With_Args(#w_FileNumber) To_Get(#TEXT6500 #IO$STS)
As long as we have everything running on the PC everything is working fine.
But when we test the complete system running on iSeries (webserver, database, server modules - which is the environment where it has to be running in the end) we always get an error on STM_FILE_OPEN.

Messages in joblog imply that there is a conversion error (message# 3490). The file that is generated when fetching the BLOB apparently has CCSID 65535. Operating system version is V6R1M0.

Does anyone know what we are doing wrong? Which CCSID is expected - and how can it be changed if necessary?

Best regards,
Joerg

atostaine
Posts: 497
Joined: Wed Jan 20, 2016 7:38 am

Re: STM_FILE_OPEN on iSeries

Post by atostaine » Wed Jun 20, 2018 11:27 pm

You should have system value QCCSID set to your correct CCSID. In the U.S. most people use 37. If it's set to 65535, then the system i will not do a conversion. MANY people have changed this value on the fly and had no problems, but if you can't change it, you could use the job description to set it, or even do a CHGJOB using system_command BIF (or whatever it is)
Art Tostaine

Joerg Hamacher
Posts: 53
Joined: Thu Feb 11, 2016 12:01 am

Re: STM_FILE_OPEN on iSeries

Post by Joerg Hamacher » Thu Jun 21, 2018 6:04 pm

Hi Art,

thank you for this reply.
I did not know that system i does not do any conversion when the ID is 65535.
I added a SYSTEM_COMMAND line into the program where I embed CHGATR and change the CCSID of the BLOB file - and now it works fine.

Thank you very much,
Joerg

MarkD
Posts: 655
Joined: Wed Dec 02, 2015 9:56 am

Re: STM_FILE_OPEN on iSeries

Post by MarkD » Fri Jun 22, 2018 8:45 am

https://docs.lansa.com/14/en/lansa015/i ... e_open.htm

It might be interesting to see if using codepage=65535 also produces the same result.

The documentation says it's ignored on the Windows platforms, so maybe then you would not have to have a conditioned CHGATR command.

Post Reply