Quantcast
Channel: SCN : All Content - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 4013

BODS Script

$
0
0

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


Viewing all articles
Browse latest Browse all 4013

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>