Solution to the problem encountered using Variable Substitution with XI-SP12
Enabling of variable substitution feature in SP12 patch is a relief for lot of XI developers using File Adapters. Before the happiness lasted long we found out that filename is substituted from the payload of the file sent to the receiver. In a real time scenario we do not need the filename to be present in the content of the receiver file. There is an option of using module exits for encountering problems with variable length files. But this blog highlights a very simple way to achieve this using the parameters of file CC at the inbound. In my current project we have to write the file into a folder with a particular file name format and the file name should not be present in the content of the file.
Rules for file name:
1.Format of filename“PN+Unique Generation Number+.+File_Type.”
2.Generation number should be unique and should be generated for every inbound file sent to the receiver.
3.FileName is not the part of file content sent to the receiver.
I generated the required file name using java mapping and provided the file name variable in the variable substitution. I am excited to see that file is created and it lasted for only some moments as the file name is getting written into the content,which is undesired. To encounter this I created an additional node FILENODE under message type and element called FILENAME in addition to the payload required by the receiver file. I tried to suppress it by not giving the FILENODE in the record structure column of the receiver file content conversion in vain as still the filename is written as a last line into the content. I browsed the File CC parameters and did the following configuration, which worked.
It worked for us and relieved us from writing OS level scripts and hence blogged as it might be helpful for the people who shared the same experience. It is an approach which we followed and any suggestions to this are welcome.