Environment: Oracle database, HPUX
Description: This script is menu used by users to transfer files from unix system to PC's to work with spreadsheet.
Code Listing:
# File : file_transfer_menu [m_trans]
# Purpose: file transfer host/pc
# Author : Robert Lawson 13-JAN-1997
# Mods : RobLaw 02/24/97 Remove file after successful transfer
#
# questions:
# - PC directory LOCAL_DIR="\\\users\\\$LOGNAME\\\data\\"
# without $LOGNAME and file name not tripping reserved escape sequences
# - notify if create date <> SYSDATE
# - generalize wher options are the same name as file?
# ls -l tt.sql
# -rw-r--r-- 1 roblaw users 937 Jan 10 11:19 tt.sql
# date
# Tue Jan 14 11:42:21 PST 1997
# ========================================================================
function do_transfer
{
if [ $LOCAL_FILE != "{}" ]
then
echo "Local PC file name ($LOCAL_FILE): \c"
read line
if [ "$line" ]
then
echo "line = *$line*"
LOCAL_FILE="$line"
fi
fi
if [ $HOST_FILE != "{}" ]
then
if [ -r $HOST_FILE ]
then
ls -l $HOST_FILE
echo "Enter\c"
read line
else
echo "HOST_FILE $HOST_FILE does not exist"
echo "Enter\c"
read line
return 1
fi
fi
X_COMMAND="receive $LOCAL_FILE from $HOST_FILE del"
# from korninit from WRQ Web Site, by John Imhoff
echo "\033&oC$X_COMMAND\r"
read hoststseq
if [ "$hoststseq" != F ]
then
$hoststseq
read status
if [ "$status" = S ]
then
/bin/rm -f $HOST_FILE
echo "Successful file transfer. Enter"
read line
else
echo "X_COMMAND: $X_COMMAND"
echo "ERROR 100: Status=$status. File transfer failed at startup. Enter"
read line
fi
else
echo "X_COMMAND: $X_COMMAND"
echo "ERROR 101: Status=$hostseq. File transfer failed initiating host sequence. Enter"
read line
fi
}
# ========================================================================
echo " ** File Transfer Menu **"
echo
echo " Options:"
echo " 1. Backlog (oeorf.lst)"
echo " 2. Backlog (oeorf.lst to diskette, Kessler)"
echo " 3. Work order routing (wo100.txt)"
echo " 4. Schedule demand (pn103.txt)"
echo " 5. Transactions (ic101.txt)"
echo " 6. Booked orders (pn105.txt)"
echo " 7. Shipped orders (pn106.txt)"
echo " 8. MFG Item Summary (ic104.txt)"
echo " 9. Model Item Summary (pn107.txt)"
echo " 10. MFG Item Summary (ic105.txt)"
echo " 11. Production Rate Detail (ic106.txt)"
echo " 12. Fabrication WO Status-powo (pn111.txt)"
echo " G General transfer"
echo " H Help"
echo " E Exit"
echo " Enter option $LOGNAME: \c"
read option; typeset -u option
case $option in
1) # backlog
HOST_FILE="oeorf.lst"
LOCAL_FILE="oeorf.lst"
do_transfer
;;
2) # backlog, to diskette
HOST_FILE="oeorf.lst"
LOCAL_FILE="a:\oeorf.lst"
do_transfer
;;
3) # WO routing
HOST_FILE="wo100.txt"
LOCAL_FILE="123\wo100.txt"
do_transfer
;;
4) # Schedule demand
HOST_FILE="pn103.txt"
LOCAL_FILE="123\pn103.txt"
do_transfer
;;
5) # Transactions
HOST_FILE="ic101.txt"
LOCAL_FILE="123\ic101.txt"
do_transfer
;;
6) # Booked Orders
HOST_FILE="pn105.txt"
LOCAL_FILE="123\pn105.txt"
do_transfer
;;
7) # Shipped orders
HOST_FILE="pn106.txt"
LOCAL_FILE="123\pn106.txt"
do_transfer
;;
8) # MFG Item Summary
HOST_FILE="ic104.txt"
LOCAL_FILE="123\ic104.txt"
do_transfer
;;
9) # Model Item Summary
HOST_FILE="pn107.txt"
LOCAL_FILE="123\pn107.txt"
do_transfer
;;
10) # MFG Item Summary
HOST_FILE="ic105.txt"
LOCAL_FILE="123\ic105.txt"
do_transfer
;;
11) # Production Rate Detail
HOST_FILE="ic106.txt"
LOCAL_FILE="123\ic106.txt"
do_transfer
;;
12) # Fabrication WO status
HOST_FILE="pn111.txt"
LOCAL_FILE="123\pn111.txt"
do_transfer
;;
G) # General transfer
HOST_FILE="{}"
LOCAL_FILE="{}"
do_transfer
;;
H) # Help
echo
echo "file_transfer_menu: Help"
echo "This menu will tranfer data file created on host system for use on pc."
echo "If you have 123 file, then go to 123 and either type file name, or use"
echo ".txt extension."
echo "Most common problems you'll encounter are:"
echo "1. JIT program not run, and thus no host file."
echo "2. JIT program not run, and thus one old host file."
echo "3. Your default PC directory is NOT \\\user\\\name\\\data."
echo "4. You used qualified PC directory name for local file (bug today)."
echo "5. You are having a bad hair day."
echo "Enter\c"
read line
;;
EEXITX)
echo "See ya later $LOGNAME"
;;
*) # bad apple
echo "opiton $option"
;;
esac
No comments:
Post a Comment