The solution is for a "EnsLib.HL7.Service.FTPService" service :

Method OnProcessInput(request As %Stream.Object, Output response As %RegisteredObject) As %Status
request.Attributes("FTPDir")

These files require transformation. They are HL7 messages and need segment changes according to the directories.
I don’t see any property that will also give a directory name: Attributes ("filename") is not the solution, unfortunately

>>> They should be deleted from the sftp server once transferred?
It’s already been done.

Any COS example will be very helpful.

Your "SendRequestAsync" method is only available for Process.

And to be purist, in that case, it must be:

set tSC = ..SendRequestAsync(..JSONOperation,stream,"0",,..MetadataContext) /// send the stream to operation

Nothing to do with the reponse parameter.

Best Regards.

Thanks for your answer.

The second possibility is the one I use but we are never sure that the field will be fulfil (SetIDOBX).

The first one, I didn’t know that “RawContent” is available this way. That’s the one that definitely I choice.