Informatica IPC - UNIX script fail

I have created a unix script to be executed after the session finished. The script basically counts the lines of specific file and then creates a trailer with this specific structure:

T000014800000000000000000000000000000

T - for trailer

0000148 - number of lines

00000000000000000000000000000 - filler

I have tested the script in Mac, I know already that environments are totally different, but I want to know what is needed to be changed in order to execute this script successfully in IPC.

After execution I get the following error message: The shell command failed with exit code 126.

I invoke the script as follows:

sh -c "$PMRootDir/scripts/exec_trailer_unix.sh $PMRootDir/TgtFiles"


#! /bin/sh

TgtFiles=$1
TgtFilesBody=$TgtFiles/body.txt
TgtFilesTrailer=$TgtFiles/trailer.txt

string1=$(sed -n '$=' $TgtFilesBody)
pad=$(printf '%0.1s' "0"{1..8})
padlength=8
string2='T'
string3=$(printf '%s%*.*s%s\n' "$string2" 0 $((padlength - ${#string1} - ${#string2} )) "$pad" "$string1")
string4='00000000000000000000000000000'
string5=$(printf '%s%*.*s%s\n' "$string3" 0 $((${#string3} - ${#string4} )) "$string4")
echo $string5 > $TgtFilesTrailer

Any idea would be great.

Thanks in advance.

1 answer

  • answered 2021-11-23 03:45 Koushik Roy

    Please check below points.

    1. it looks like permission issue. Please login using informatica user(the user that runs infa demon) and run this command. You should be able to get the errors.
    sh -c "$PMRootDir/scripts/exec_trailer_unix.sh $PMRootDir/TgtFiles"
    
    1. Sometime the server variable $PMRootDir in UNIX doesnt get interpreted and can result null value. Please use echo $PMRootDir to check if its working after logging into UNIX using above user.

    2. You can create trailer file using Infa easily. Just add an aggregator transformation right before actual target( group by a dummy field to calculate count(*)). Then add an expression transformation to create those strings. And then trailer file target. Just 3 more transformations.

               | --> AGG --> EXP --> Trailer Target file
    Final Tr --|--> Final Target
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum