cancel
Showing results for 
Search instead for 
Did you mean: 

BODS Script

Former Member
0 Kudos

Hi

I am new to  BODS,I have to do source file validation using BODS script.

File validation logic available in below UNIX script , I have to achieve below logic with BODS script.Please help regarding the same.

#Variable declaration

export dt=`date +%Y%m%d"."%H%M%S`

export dt1=`date`

export FilePath=/home/ildwetl/INFO_LAYER/SrcFiles/ABC

export TrigPath=/home/ildwetl/INFO_LAYER/ExtProc/ABC/Autosys_Trig

export LogPath=/home/ildwetl/INFO_LAYER/AppLogs/ABC_TRUST

export Error_Flag=0

export FILE_IN=$FilePath/abc_data.txt

export FILE_TRG=$TrigPath/abc_trigger.txt

export JL=$LogPath/abc_$dt.log

export EL=$LogPath/abc_$dt.err

> $JL

> $EL

if [ -s $FILE_IN ]                 

then

  echo "abc Lockbox File found - Execution at " $dt1  >> $JL

else

  echo "abc Lockbox File NOT found (or) Empty File Found - Execution at " $dt1 >> $EL

  Error_Flag=1

  exit -99

fi

export LockBox_Line_Count=1

export LockBox_Trailer_Count=1

export LockBox_Header=1

export LockBox_Trailer=1

Error_Flag=0

LockBox_Line_Count=`wc -l  $FILE_IN | cut -f1 -d " "`

LockBox_Trailer_Count=`tail -1 $FILE_IN | cut -c2-7`

LockBox_Header=`head -1 $FILE_IN | cut -c 1`

LockBox_Trailer=`tail -1 $FILE_IN | cut -c 1`

grep -iq 'NO DEPOSITS' $FILE_IN

export RC=`echo $?`

if [ $RC -eq 0 ]

then

  echo "NO DEPOSITS FILE FOUND - Execution at " $dt1 >> $JL

  cp $FILE_IN  $FilePath/Processed_Files/abc_data.txt

  cp $FILE_IN  $FilePath/Archive/abc_data_bkp_$dt.txt

  > $FILE_IN

  chmod 777 $FilePath/Archive/abc_data_bkp_$dt.txt $FilePath/Processed_Files/abc_data.txt

  rm -f $FILE_TRG $FILE_IN

  exit

fi

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Dirk,

This is Informatica to BODS migration project.Current informatica we are using Unix script.

I have to develop informatica mapping logic in BODS.Same as I have to develop UNIX script logic in BODS script.

former_member187605
Active Contributor
0 Kudos

There's no logical reason why you cannot reuse exisiting Unix scripts, it will only run your migration project faster. Unless you'll be running DS on WIndows. But inthat case, it's still better to migrate the shell scripts to .bat files.

Former Member
0 Kudos

This is customer decision Dirk.

I will try to achieve this.

anyway Thanks.

former_member187605
Active Contributor
0 Kudos

It's not forbidden to challenge bad / stupid / ridiculous / inefficient... customer decisions .

Good luck with your migration project.

Former Member
0 Kudos

Hi Dirk,

Thanks for ur reply.

My support team not allowing unix script.Bcz of this i have to prepare  Unix script logic into BODS script.

Could plz help me the same.

former_member187605
Active Contributor
0 Kudos

In your OP you wrote "File validation logic available in below UNIX script". That means your support team do allow it, do,'t they? If the script is there, just call it from DS.

If you want to write the same logic in DS, you'll have to replace every shell variable by an equivalent DS global variable (don't forget the initial $-character) and call every single command line from the exec function.

former_member187605
Active Contributor
0 Kudos

You can call any Unix script using the DS exec built-in function. See for a very recent example.