Edu
Edu

Reputation: 91

Informatica Dynamic Header and Footer creation using post session command

I need to create a file(with some text like 'H12454COR') to replace the target file "incase of 0 byte target file using informatica post session command".

Can some one please help me with the command that I should use?

I can use the condition : if [ $TgtSuccessRows == 0]?

Thanks, E

Upvotes: 0

Views: 676

Answers (2)

Edu
Edu

Reputation: 91

I was able to get this using the following command in post session command in informatica.

if [ ! -s $PMTargetFileDir/$OutputFile1 ];then echo "H""$(date +"%Y%m%d")""$(date +"%Y%m%d")""XXX"""> $PMTargetFileDir/$OutputFile1;echo "T""$(date +"%Y%m%d")""$(date +"%Y%m%d")""XXX""""00000000002""" >> $PMTargetFileDir/$OutputFile1;fi;

Upvotes: 0

Maciejg
Maciejg

Reputation: 3353

This basically means you need a shell command / script to check existing file size and if it's zero-length, echo some text to it. You need to put it as post-session command with no conditions on Informatica side.

You may use a separate command task if you like. In this case use a link with a condition like $PMyourtargetname@numAffectedRows=0. The command would be like echo H12454COR > $$TargetFileName.

Upvotes: 1

Related Questions