marwest98
22nd July 2008, 18:24
I need to convert the following script from unix to a .ba or a script that will run on Windows 2003 SqlServer 2005. Has anyone converted these? Or does anyone have one? I am very short on time and also need to create a session to run these. There are two parts.
Here is the first unix script.

#!/bin/sh -x

########################################
# exceljv490.sh for baan application file
# processing.
########################################

ORIG=/export/web/exceljv490
SOURCE=/u01/baan/bse/exchange/exceljv490/lseq/source
DEST=/u01/baan/bse/exchange/exceljv490/lseq/output
BSE=/u01/baan/bse/exchange/exceljv490/lseq

##########################
#
# move original files
# to the $SOURCE directory
#
###########################

/usr/bin/mv $ORIG/*.csv $SOURCE/

##############################
#
# Loop through all the files
# Process the .csv file
# and copy the processed
# file to an output dir.
#
##############################

FILE=`ls -tr $SOURCE | tail -1`

while [ -n "$FILE" ]
do

/usr/bin/dos2unix $SOURCE/$FILE $SOURCE/$FILE
$BSE/exceljv.pl $SOURCE/$FILE
/usr/bin/cp $BSE/exceljv490 $DEST/$FILE

#########################
#
# Check to see which user
# the mail goes to
#
#########################

INITIALS=`echo $FILE | cut -c7-8`

########################
#
# Call the rc.start
#
########################

/u01/baan/bse/exchange/exceljv490/lseq/rc.startjob490 EJV490

################################
#
# Test to see when the job is complete
#
################################

time=0
sleep 10
while [ "$time" -le "5" ]
do
if [ -f /usr/vsaini1/job_done ]
then
echo "It's done"
time=6
else
time=`expr ${time} + 1`
fi
if [ "$time" -eq "5" ]
then
mailx $INITIALS@perfectionbakeries.com<<EOMAIL
Subject: Job failed
From: EXCELJV490

`/usr/bin/date`
The job took too long or there may be a problem. Please see your administrator.
EOMAIL
exit 0
fi
sleep 10
done

#########################################
#
# Test to see if job_done or job_failed
# and email appropriate user
#
#########################################

if [ -f /usr/vsaini1/job_done ]
then
STATUS='job_done'
mailx -s $STATUS $INITIALS@perfectionbakeries.com<<EOMAIL
From: EXCELJV490

`/usr/bin/date`
$FILE

EOMAIL
# then remove job_done file
rm /usr/vsaini1/job_done
fi

##########################################
# the following is
# no longer needed because job never fails (ha)
##########################################
#if [ -f /home/vsaini1/job_failed ]
#then
# STATUS='job_failed'
# mailx -s $STATUS $INITIALS@perfectionbakeries.com<<EOMAIL
#
# `/usr/bin/date`
# $FILE
#
#EOMAIL
#fi

######################################
#
# copy the file to the job_done or job_failed dir.
#
######################################

/usr/bin/cp $DEST/$FILE $ORIG/$STATUS

#####################################
#
# delete the source file
#
###################################

rm /usr/vsaini1/$STATUS
rm $SOURCE/$FILE
FILE=`ls -tr $SOURCE | tail -1`
done

exit 0


There is a second part too: THis also has to be converted.
# rc.startjob, should be located in $BSE/etc
# version 94/06/29 (Erwin Derksen)
# * added setting of TERM to this file
# version 94/04/21 (initial version)
#
# script to start a job in the background
# BAMODE=1 : No output to screen.
# Be sure to define the BSE, BSE_TMP and PATH variable, because when started
# from the crontab these variables often are not defined

BSE=/u01/baan/bse
BSE_TMP=/u01/baan/bse/tmp
export BSE BSE_TMP
PATH=$BSE/bin:$PATH
export PATH

# It turned out that the TERM variable could be unset when running in a cron
#TERM=vt100 ;export TERM

# If you want to use several companies you can create several users for e.g.
# root who probably is running this script. If so, copy this script and use
# the next line to define the USER variable (<root100> is just an example).
#USER=<root100> ;export USER
USER=bsp ;export USER

if [ $# -lt 1 ];then
echo "Usage : rc.startjob <jobname> [jobok_file]"
exit 1
fi
if [ $1 = "-U" -o $1 = "-u" ];then
echo "Usage : rc.startjob <jobname> [jobok_file]"
exit 1
fi

#jobok_file contains the characters "OK" if the job was successful !
#If jobok_file is not specified, then output is written to $BSE/tmp/job


BAMODE=1 ;export BAMODE
DS_SERVER=ba ;export DS_SERVER
BSH_JOB=$1 ;export BSH_JOB

if [ $# -gt 1 ];then
BSH_JOBOK=$2 ;export BSH_JOBOK
echo $BSH_JOBOK
fi

ba6.2 ttaad5203m000 2>${BSE_TMP}/rc.startjoberr &

Han Brinkman
22nd July 2008, 19:10
Perhaps your admin allows you to install one of these products. At least you can use them to have more time to convert them.

Han

marwest98
22nd July 2008, 19:29
Unfortunately, the admin won't allow me to install them. In fact he is on vacation for the rest of the week.

marwest98
22nd July 2008, 19:47
Is there another way to convert them?