cancel
Showing results for 
Search instead for 
Did you mean: 

Reading fixed length and delimited files from the same directory

Former Member
0 Kudos

Hello,

I have a scenario involving file to file conversion. The source file will be a text file which can be delimited or fixed length. The issue is that there is no distinction in the file name for the two types of file. There is however a header which indicates if the file is a delimited one or a fixed length one. How do I read the file? I can design two sender channels for the two different types of input file but how do I ensure that the input file is read by the correct sender channel?

Many thanks,

RR

Accepted Solutions (1)

Accepted Solutions (1)

sunilchandra007
Active Contributor
0 Kudos

You can schedule OS level script that would identify the type of file reading header and then rename the file to avoid the issue of same name. Now you can use 2 independent channel simply.

Regards,

Sunil Chandra

Former Member
0 Kudos

Thanks for the reply Sunil.

But I'd rather use two different folders than use an OS script. I was wondering if there is any option to handle this scenario within PI.

Is there any way a fixed and delimited file can use the same FCC?

Thanks,

RR

former_member184681
Active Contributor
0 Kudos

Hi,

Frankly speaking, I have never used FCC that way, but SAP Help says here:

NameA.fieldSeparator

■       If you made an entry for fieldFixedLengths, the extra length of the separator is taken into account, but no further consistency checks are performed.

Based on that, I believe it is at least worth trying and experimenting with setting both: fieldSeparator and fieldFixedLengths in parallel, in the same Communication Channel. You might additionally need to add keepIncompleteFields to the configuration to make it work properly. Just give it a try and let us know the results.

Hope this helps,

Greg

sunilchandra007
Active Contributor
0 Kudos

I guess there is no direct way to manage that in same FCC. Other way to avoid script could be use of java mapping with dynamic configuration to change the file/folder name.

Regards,

Sunil Chandra

Former Member
0 Kudos

Hello Greg,

Thank you for the reply.

I did see that excerpt in sap help and I tried it out as well. When both fieldFixedLengths and fieldSeparator are used, the FCC assumes that there is a separator even when the file is a fixed length one. As a consequence, it adds the length of the separator after each field length. This will mess up the FCC and give incorrect values in the fields since the fixedlength file does not have a separator in my scenario.

regards,

RR

Former Member
0 Kudos

Thanks Sunil.

Will try it out. But does the channel again check against the filename condition after running the module? Doesnt that happen before the module is executed?

Regards,

Rajith

Answers (0)