cancel
Showing results for 
Search instead for 
Did you mean: 

how to ignore the last line in a file using FCC in sender File adapter

allamudi_loordh
Active Participant
0 Kudos

Hi PI mates,

I  have a problme of reading a file where last line it is coming like a special character "#" so i want to ignore the last line so that i can read other lines with field fixed lengths. i am getting only one character at the last line.  i am using FTP  & graphical mapping.

please  provide your inputs on this.

Thank you,

Loordh.

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi All,

Can you please help us is their any direct parameter is available to remove last line from the output file using SFTP.....PI....SFTP in FCC.

Thanks in advance!

Regards,

Sathya.

iaki_vila
Active Contributor
0 Kudos

Hi Allamudi,

The Grzegorz solution seems the best. I was wondering that you could use a batch program and use it from the sender filer adapter (Operating System Command Before/After File Processing). It isn't to difficult to delete the last line:

sed -n "$!p" file

Regards

iaki_vila
Active Contributor
0 Kudos

Hi Allamudi,

You could use a java mapping before the graphical mapping and ignore the last line. The code will be simple because you put in the ouputstream the inputstream, reading char to char and when the char is equal to # you finish the mapping.

Regards.

allamudi_loordh
Active Participant
0 Kudos

Hi Via,

Thanks for your response.

when we use java mapping we need source xml right,  that it self is not creating from File adapter , it is getting failed in FCC itself.

Regards,

Loordh.

former_member184681
Active Contributor
0 Kudos

Hi,

You can add the following parameters to the FCC configuration, this should solve your problem:

Structure.keepIncompleteFields = YES

Structure.missingLastfields = ignore

Then you just have to ignore this source structure item (where first field is equal to #) during message mapping. I believe this is the simplest way, without involving additional mapping. You could also define a separate Recordset Structure for this last file line, assuming that you have some key field that will help you distinguish between "normal" line and this one last line. But I think the first solution I described requires less changes to your scenario.

Hope this helps,

Greg