Question
· May 23, 2017

Ensemble Service using File.InboundAdapter: File name of the file being processed

Hi,

I have created a Business Service which uses the EnsLib.File.InboundAdapter. This service will call a business service which will create an acknowledgement file in a directory specified in the operation after loading the parsed file into some temporary tables.

In order to create the acknowledgement file, I need the original file name. In the OnProcessInput of the service, it receives a stream of file data, and I can't find a way to get hold of the file name.

Any advice will be appreciated, thank you.

Discussion (5)1
Log in or sign up to continue

Let me recap what I think I understand.  You have a business service that uses an inbound file adapter.  The OnProcessInput method of that service builds the message that then gets sent into the production.  The input parameter of the OnProcessInput is a file character stream of some kind.  You want to get the filename associated to that stream to add to your message.

If all the above is true then you need to access the 'filename' property of the stream.  Note that the exact property may depend on the stream class being used.  'Filename' will work with any file based stream in the %Stream package or those stream classes defined in %Library.  If this stream is of type Ens.StreamContainer then use the 'OriginalFilename' property.

If I am still not clear perhaps you could share at least some of the implementation of you OnProcessInput method and the details of the message class you are building.

One other question would be how are you trying to incorporate the source filename into the output filename?  Are you using the %f filespec?

Thank you. The parameter of OnProcessInput being a %Stream.Object confused me, as that has no FileName property in the class reference. The FileName property did however work. I realize now that a FileCharacterStream object is passed to the OnProcessInput from the File InboundAdapter.

Regarding your question: I use the original file name in a Business Operation, which uses the File.OutboundAdapter. I concatenate a suffix to the original filename and then use putline of the OutboundAdapter to create the file.