return to PRS Technologies website


Timekeeper Sort Transfer
################################################################################ Transferring Multiple Timekeepers This feature enables you to change the initials and sort levels for a list of timekeepers. This process runs in background mode, therefore you can allow the transfer to run unattended or schedule it to run at a specific time. In order to implement the change throughout the system, the ELBS tables are locked during the transfer; therefore, ensure that there are no active users on the system before beginning this procedure. 1. Before transferring a list of timekeepers, you must first create an input file that lists the timekeeper initials you want to transfer, along with the new timekeeper initials and sort levels you want to assign. The line format of the input file is: Column 1: Existing timekeeper initials Column 11: New timekeeper initials Column 21: New timekeeper sort levels The file is preprocessed to check for errors. If the system detects any errors, no timekeeper transfers are made. 2. To transfer a list of timekeepers, bring your system to the Unix prompt. 3. Enter the following command and press <ENTER>: matter.4ge TTRANSFER {RUN or SCAN} {filename} If you execute the above command using RUN, the system uses the existing timekeeper transfer program to update the specified timekeepers individually. If during any point in the process the transfer program is unable to lock the tables it is updating, the program halts and all timekeepers remaining on the list are not transferred. If you execute the above command using SCAN, the system checks the input file for errors and indicates what the result will be at the time you actually perform the timekeeper transfer (using RUN). Below is a script we used to automate the process. #!/usr/bin/ksh ############################################################################### # # Module: fix_tksrtlvl1.sh # Author: Peter R. Schmidt # Description: Fix Elite timekeeper sort levels # Make them match to the title sort levels # # Note: The 'fix: path & filename is limited to 20 characters # # Change Log # # Date Name Description................. # 08/31/01 Peter R. Schmidt Start Program # ############################################################################### show_remaining() { echo >> $LOG echo "------------------------------------------------------------" >> $LOG date >> $LOG echo "Completed fix of timekeeper sort levels for now" >> $LOG echo >> $LOG echo "Remaining timekeepers to be fixed are:" >> $LOG dbaccess son_db <<-EOF >>$LOG 2>/dev/null select tktitle,tkinit,tklast[1,15],tksort,tisort from title,timekeep where title.tititle = timekeep.tktitle and title.tisort <> timekeep.tksort --and tktmdate is null order by title.tisort,timekeep.tkinit EOF } ############################################################################### . /elite/custom/run.elite WINDOW_START=02 WINDOW_END=04 LOGDIR=/elite/work/logs LOG=$LOGDIR/fix_tksrtlvl1.log DBTEMP=${DBTEMP:-"/elite/work/tmp"} if [ ! -d $DBTEMP ]; then echo "Error: fix_tksrtlvl1.sh: Directory $DBTEMP does not exist." >> $LOG echo "fix_tksrtlvl1.sh terminated." >> $LOG fi cd $DBTEMP FIXFILE1=fix_srt.$$.tmp # Important: this is limited to 20 characters!! while true do echo "------------------------------------------------------------" >> $LOG date >> $LOG XHOUR=`date +%H` echo "The current hour is: $XHOUR" >> $LOG echo "Allowed to run between $WINDOW_START and $WINDOW_END" >> $LOG if [ $XHOUR -lt $WINDOW_START -o $XHOUR -gt $WINDOW_END ]; then echo "Leaving timekeeper sort level fix." >> $LOG echo "No longer in window of allotted time to run." >> $LOG echo "Window is $WINDOW_START through $WINDOW_END" >> $LOG show_remaining exit 0 fi cd $DBTEMP TMPFILE1=fix_tksrtlvl1.$$.tmp dbaccess son_db <<-EOF > /dev/null 2>&1 unload to '$TMPFILE1' delimiter "|" select tkinit,tkinit,tisort from title,timekeep where title.tititle = timekeep.tktitle and title.tisort <> timekeep.tksort --and tktmdate is null order by title.tisort,timekeep.tkinit EOF head -1 $TMPFILE1 | awk ' \ BEGIN { FS="|" } { printf "%-5s %-5s %-s\n",$1,$2,$3 } ' > $FIXFILE1 rm -f $TMPFILE1 echo >> $LOG echo "Fix File: " >> $LOG echo >> $LOG cat $FIXFILE1 >> $LOG echo >> $LOG echo "matter.4ge TTRANSFER RUN $FIXFILE1" >> $LOG echo >> $LOG matter.4ge TTRANSFER RUN $FIXFILE1 2>&1 >> $LOG if [ $? != 0 ]; then date >> $LOG echo "Error during timekeeper transfer" >> LOG break fi rm -f $FIXFILE1 # break # Debug: exit from loop if testing sleep 60 # 5 minute break between transfer attempts done show_remaining ################################################################################