BLOB

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
avescovi
Posts: 25
Joined: Wed Mar 16, 2016 3:01 am
Location: Switzerland
Contact:

BLOB

Post 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
dannyoorburg
Posts: 177
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: BLOB

Post 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....
avescovi
Posts: 25
Joined: Wed Mar 16, 2016 3:01 am
Location: Switzerland
Contact:

Re: BLOB

Post 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
avescovi
Posts: 25
Joined: Wed Mar 16, 2016 3:01 am
Location: Switzerland
Contact:

Re: BLOB

Post by avescovi »

Does anyone have an idea?

Thanks

Andrea
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: BLOB

Post 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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
avescovi
Posts: 25
Joined: Wed Mar 16, 2016 3:01 am
Location: Switzerland
Contact:

Re: BLOB

Post by avescovi »

Hi Stewart,
Thank you.

Regards

Andrea
dannyoorburg
Posts: 177
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: BLOB

Post by dannyoorburg »

I'll have one more guess without actually trying it myself :)

Should it be a CLOB instead of a BLOB?

Danny
avescovi
Posts: 25
Joined: Wed Mar 16, 2016 3:01 am
Location: Switzerland
Contact:

Re: BLOB

Post 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
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: BLOB

Post 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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
dannyoorburg
Posts: 177
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: BLOB

Post 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
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: BLOB

Post 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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
avescovi
Posts: 25
Joined: Wed Mar 16, 2016 3:01 am
Location: Switzerland
Contact:

Re: BLOB

Post by avescovi »

Hi Stewart,

I will try.
Thank you

Andrea
Post Reply