Page 1 of 1
BLOB
Posted: Fri Oct 14, 2016 7:04 pm
by avescovi
Hi everyone,
I have a problem reading the file generated from a BLOB fetch (on IBM i).
My scenario is (pseudocode):
1) File generation from a list
Code: Select all
Use Builtin(TRANSFORM_LIST) With_Args(#myList #fileName 'AU' 'I') To_Get(#Return_code)
2) Save as BLOB
Code: Select all
#myBlob := #fileName
Insert Fields(#myKey #myBlob) To_File(MyFile)
3) Read BLOB
Code: Select all
Fetch Fields(#myBlob) From_File(MyFile) With_Key(#myKey)
4) I check with System i Navigator and I am able to find and open the file automatically generated by the FETCH command (/LANSA_dcwpgmlib/tmp/lobwam/..../test.txt). The file is exactly the one inserted.
5)
The problem is here, I want to re-convert as list but I get the 'ER' Return_code
Code: Select all
Use Builtin(TRANSFORM_FILE) With_Args(#myList #myBlob.fileName 'AU' 'I') To_Get(#Return_code)
The strange thing is that this command is working using directly the file generated in point 1). But gives me the 'ER' return_code with the file generated by the BLOB fetch.
Some ideas?
Thank you
Andrea
Re: BLOB
Posted: Fri Oct 14, 2016 8:04 pm
by dannyoorburg
This is just a quick guess... But I'm suspicious of the length of the path into the blob folder... What would happen if it's more than 256 chars?
But I haven't actually tried this...
Maybe that helps....
Re: BLOB
Posted: Fri Oct 14, 2016 8:09 pm
by avescovi
Hi Danny,
The complete path is :
/LANSA_dcwpgmlib/tmp/lobwam/399ac85b-926b-4124-a865-ba2cc740e4d6/t03tab00f/t03testo/test.txt
And its length 93 chars.
I already checked this case, but unfortunately this is not our problem.
Thank you
Re: BLOB
Posted: Tue Oct 18, 2016 8:42 pm
by avescovi
Does anyone have an idea?
Thanks
Andrea
Re: BLOB
Posted: Tue Oct 18, 2016 8:55 pm
by Stewart Marshall
Hi Andrea
I haven't tried on an IBM i, but I know the same technique works on Windows, which makes me think it's probably a bug.
Please report it to your local support desk
Regards
Re: BLOB
Posted: Tue Oct 18, 2016 9:02 pm
by avescovi
Hi Stewart,
Thank you.
Regards
Andrea
Re: BLOB
Posted: Tue Oct 18, 2016 10:24 pm
by dannyoorburg
I'll have one more guess without actually trying it myself
Should it be a CLOB instead of a BLOB?
Danny
Re: BLOB
Posted: Wed Oct 19, 2016 1:50 am
by avescovi
Hi Danny,
Yes, with CLOB it works!
But I have found another problem with the TRANSFORM_LIST function.
In particular it cuts the blank characters at the end of the string also if the documentation said that using the Output File Format option 'A' ('AU' in my case) it should not do it. (from the documentation: In Char and String fields trailing blanks are not removed).
Do you have any idea?
Thank you
Andrea
Re: BLOB
Posted: Wed Oct 19, 2016 11:26 am
by Stewart Marshall
Hi Andrea
If there are discrepancies between documented and actual behaviour, there's clearly something that's not right, and it should be reported to your local support desk.
Regards
Re: BLOB
Posted: Wed Oct 19, 2016 12:23 pm
by dannyoorburg
Hi Andrea,
can you describe the functionality you're trying to achieve / problem you're trying to solve with this particular construct.
Just out of curiosity, there might be other ways of achieving the same result....
Cheers,
Danny
Re: BLOB
Posted: Thu Oct 20, 2016 10:37 am
by Stewart Marshall
Hi Andrea
You can also use the STM_FILE* BIFs to create documents.
These will give you much greater control over the document you're writing and reading.
Regards
Re: BLOB
Posted: Thu Oct 20, 2016 2:56 pm
by avescovi
Hi Stewart,
I will try.
Thank you
Andrea