#!/bin/bash

PREFIX=$1
LSN=$2

getFileName() {

    local PREFIX=$1
    local LSNPOST=$2
    local LSNLEN=${#LSNPOST}
    local ZEROFILL=0
    local i=$LSNLEN
    
    while [[ $i -ne 10 ]]
    do
	ZEROFILL=${ZEROFILL}0
	(( i = i + 1 ))
    done
    echo ${PREFIX}-${ZEROFILL}${LSNPOST}.dbf
}


LOGFILE=$(getFileName $PREFIX $LSN)

echo "LogFile = $LOGFILE"
exit 0

while [ -e $LOGFILE ]
do
   echo Treating $LOGFILE
   for LSN in `cat $LOGFILE  | cglog | grep LSN | awk -F\: '{ print $1 }' | awk -F\= '{ print $2 }'`
   do
       CLSN=$LSN #  echo "Next lsn = $LSN"
   done
   # echo "Last  = $LSN"
   (( NLSN = LSN + 1 ))
   # echo "Next = $LSN"
   LOGFILE=$(getFileName $PREFIX $NLSN)
done
echo "Last LSN = $LSN"
;




