Friday, November 12, 2010

Merge Two Files - Scripts

#!/bin/ksh

echo 'Merge Script is Start'

OutputFileName_Data=/home/postings_data.dat
OutputFileName_Trailer=/home/postings_Trailer_AS.dat
OutputFileName=/home/postings.dat

rm -f $OutputFileName

test -s $OutputFileName_Data
if [ $? = 1 ] ; then
echo " file size equal to 0" ;
echo " Default Header is Processing ";

test='HEADER EMPTY'
echo $test
HEADER='HDR'
#JOURNAL_ID=' '
#RUN_DATE_TIME=date '+%Y-%m-%d %H:%M'
ROW_COUNT='0000001'
DEBIT='00000000000000000'
CREDIT='00000000000000000'
JRLN_EFF_DT='0000000000'

echo $HEADER$' '$(date '+%Y-%m-%d %H:%M')$ROW_COUNT$DEBIT$CREDIT$JRLN_EFF_DT > $OutputFileName

error_status=$?

if [ $error_status -ne 0 ]
then
echo " Default Header is Processed with Error"
exit 1
else

echo " Default Header is Process Successfully";

rm -f /home/postings_data.dat
rm -f /home/postings_Trailer.dat

fi

else
echo " File Having Data : $OutputFileName_Data & size greater than 0" ;

error_status=0

cat $OutputFileName_Data $OutputFileName_Trailer >$OutputFileName

error_status=$?

if [ $error_status -ne 0 ]
then
echo "mergewith_Trailer.ksh:Error while writing the file1 to : $OutputFileName"
exit 1
else
echo "mergewith_Trailer.ksh:Success while writing the file to : $OutputFileName"

rm -f /home/postings_data.dat
rm -f /home/postings_Trailer.dat
fi

fi

Fixed Assests Important Tables and Process Details

FA Tables Description
SET-UP
PS_BUS_UNIT_TBL_AM All the AM Business Units
PS_CATEGORY_TBL All the AM Categories
PS_PROFILE_TBL All the AM Profiles
PS_PROFILE_DET_TBL All the Details about Profiles
PS_BOOK_DEFN_TBL All the AM Books
PS_BU_BOOK_TBL Gives you the details about the BOOKS attached to each BU
PS_ASSET_CLASS_TBL All the AM Classes
PS_DIST_TMPLLN_TBL Accounting Entry Templates

Interface
PS_INTFC_PRE_AM
PS_INTFC_PHY_A
PS_INTFC_FIN

TRANSACTIONAL
PS_ASSET One row per asset
PS_ASSET_ACQ_DET Gives us the detail about the PO / Voucher etc for an ASSET
PS_BOOK One row per asset about the Life of an asset ,Method of Depr etc.,
PS_BOOK_HIST All the rows for one asset
PS_COST Gives us the Cost Information & all the transactions on an asset
PS_DEPRECIATION Depereciation of an asset for the whole life
PS_DIST_LN Accounting enty table of an asset simialr to PS_VCHR_ACCTG_LINE
PS_ASSET_LOCATION Gives us the Location of an asset
PS_ASSET_CUSTODIAN Gives us the Custodian of an asset
PS_ASSET_ATTRIBUTE Som other attributes of an asset -- Not Imp
PS_RETIREMENT One row for each asset which is retired
PS_OPEN_TRANS one row for each transaction used for depr & acctg
PS_ASSET_LICENSE Some other attributes of an asset -- Not Imp
PS_BU_BOOK_CLOSE

REPORTING
PS_DPR_RPT
PS_ASSET_NBV_TBL



FA Processes - Description > Navigation
PO_RECVPUSH - Loads the PO Information in the INTFC_PRE_AM Table Purchasing > Receipts > Process Receipts

INTFAPAM - Loads the AP Information in the INTFC_PRE_AM Table Accounts Payables > Batch Processes > Extracts & Loads > Load Asset Requests

AMPS1000 - Load info from INTFC_PRE_AM into INTFC_PHY_A & INTFC_FIN Asset Management > Send/Receive info > Retrieve info from AP/PO

AMIF1000 - Load all the asset tables Asset Management > Send/Receive info > Load Transaction in AM

AM_DEPR_CALC - Depreciation Calculation Asset Management > Depreciation > Processing > Calculate

AMAEDIST/ AMAEJOB - Accounting entries for an asset Asset Management > Acc Entries > Create Acc Entries

AMDPCLOS - Accounting entries for an asset Depreciation Asset Management > Acc Entries > Close Depreciation

File Archive Unix Script

#!/bin/sh
##############################################################################
# NAME : FileArchive.sh #
##############################################################################

##############################################################################
# #
# SOURCE ENVIRONMENT #
# #
##############################################################################
HOME='/home/data'; export HOME
GENERIC_SCRIPT_DIR=$HOME/application/ftp/scripts; export GENERIC_SCRIPT_DIR
CALLER=FileArchive.sh
current_date=`date +%y%m%d%H%M%S`
FTP_ENV=AX; export FTP_ENV
DATE=`date +%Y%m%d-%H%M`

ARGNUM="$#"
if [ $ARGNUM -ne 1 ]
then
echo "Usage: FileArchive.sh filename"
echo "********************** Guidelines *********************************"
cat ftp.msg
exit 101
fi
FILENAME=$1
echo "`date` - Starting execution of ${CALLER} ${FILENAME}"

if [ ! -f $FILENAME ]
then
echo " $FILENAME doesn't exists"
echo "********************** Guidelines *********************************"
cat ftp.msg
exit 102
fi
#################################################################################
# #
# READ FROM PARAMETER FILE #
# #
#################################################################################
FTPINFO=$FILENAME
source ${FILENAME}

export FTPINFO
#
ARCHIVE_DIR=${AX_SOURCE_DIR}
#echo "Archive Directory"
#echo $ARCHIVE_DIR
#
ARCHIVE_FILE_NAME=${AX_SOURCE_FILE_NAME}
#echo "File Name"
#echo $ARCHIVE_FILE_NAME
#
ARCHIVE_TARGET_DIR=${AX_TARGET_DIR}
#echo "Target Directory"
#echo $ARCHIVE_TARGET_DIR

READY_FILE_NAME_TODELETE=${AX_READY_FILE_NAME_TODELETE}

# - make sure target directory exists
mkdir -p $ARCHIVE_TARGET_DIR

#
#
#echo "Source"
#echo ${ARCHIVE_DIR}/${ARCHIVE_FILE_NAME}
#echo "Target"
#echo ${ARCHIVE_TARGET_DIR}/${DATE}_${ARCHIVE_FILE_NAME}
# Add deltion of .rdy file
if [ -f ${ARCHIVE_DIR}/${READY_FILE_NAME_TODELETE} ]
then
echo "`date` - Deleting ready file: ${ARCHIVE_DIR}/${READY_FILE_NAME_TODELETE}"
rm ${ARCHIVE_DIR}/${READY_FILE_NAME_TODELETE}
fi

if [ -f ${ARCHIVE_DIR}/${ARCHIVE_FILE_NAME} ]
then
NEW_FILENAME=${ARCHIVE_TARGET_DIR}/${DATE}_${ARCHIVE_FILE_NAME}
echo "`date` - Archiving file ${ARCHIVE_DIR}/${ARCHIVE_FILE_NAME} as ${NEW_FILENAME}"
mv ${ARCHIVE_DIR}/${ARCHIVE_FILE_NAME} ${NEW_FILENAME}

echo "`date` - Compressing archived file ${NEW_FILENAME}"
compress ${NEW_FILENAME}
#echo "successful"
fi
echo "`date` - Archive completed."
exit 0;

Database Platform Migration from Sybase to MSSQL Server Steps