Skip to Content

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.

Dynamic File

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.

To report this post you need to login first.

13 Comments

You must be Logged on to comment or reply to a post.

      1. Nipun Shedhani
        Hi sravya,

        thats an excellent blog!!!!

        i am familiar with variable subtitution, but ur blog says how to avoid  when  file name is included in the “content of file”..
        but in receiver adapter we give like
        VaribalName        Reference
          Var1                  payload:MT_VENDORMASTER,1,RECORD,1,Header_record,1,GLN_Code,1

        : the runtime the value of gln_code should be included in file name as mar%var1%.txt.

        but in ur blog i have seen file node being added to avoid the file name inclusion in the “content of file”..
        should we create one more dt,mt, etc for file node parameter that u mentioned or we should include it in the target message structure..im not clear on this..

        if we include the filenode item in target structure the what will be the variable substitution parameters??

        please help me in this issue asap

        waiting for ur reply..

        (0) 
  1. Idi Kurniawan
    Thank you. very useful blog.

    But anyway, how are we going to do the suppress if we want the output file to be in XML format? because in your case, the file is a fixed-length one

    Regards,
    Idi

    (0) 
  2. Ranjit Deshmukh
    Hi Sravya,
    Your blog is definitely helpful in case of Variable substitution.
    I have a query for you- It is pretty evident that you have removed the contents of the FILENODE i.e. FILENAME from getting written to the file.
    But here in this case were you able to avoid an extra line break?
    This being a default parameter as endSeparator for the FILENODE
    Is there a way that you can avoid this extra line break?

    Ranjit

    (0) 
  3. Venugopalarao Immadisetty
    Hi,

      Could you please help us using your approach we were not able to ignore the impty line in the file. To remove empty line what other parameters do I need to add ?

    Regards,
    Venu

    (0) 

Leave a Reply