#! /bin/csh # # Purpose: # Copy EWS Bin information from STDF files # and call SAS to generate Bin mapping. # # Author: Jeff Yuan 10/6/98 # # Revision: JY 11/9/98 using STDX function, # instead of STDF_TO_ATDF. # JY 08/03/99 To handle stdf file which # name has pattern # p123456_1, instead of # p123456_01 ############################################### # Setup variables # ############################################### ## location/subdirectory for Bin mapping ## set STDFDIR = ~/ews_map ## location where raw STDF files reside ## set stdfpath = "/nac3/firms1/stdf" set curdir=`pwd` ## unlias cd, and don't show the standard error ## (unalids cd > /dev/tty) > &/dev/null ######################################################## # create subdirectory in user account if it does exist # ######################################################## if (-e $STDFDIR) then else echo 'creating subditrctory ...' /usr/bin/mkdir $STDFDIR endif ######################################################## # get user name and start time # ######################################################## set user=`whoami` set start=`date '+%d/%m/%y:%H:%M:%S'` if (-e $STDFDIR/stdf_list) then /usr/bin/mv ${STDFDIR}/stdf_list ${STDFDIR}/stdf_list.sav endif /usr/bin/touch $STDFDIR/stdf_list echo -n 'Please enter the EXACT lot name: ' setenv REPLY $< # Translate to low case of letter # set REPLY="`echo $REPLY | tr '[A-Z]' '[a-z]'`" echo -n 'Please enter the EXACT device name (replace "_" with "X"): ' setenv DEV $< # Translate to low case of letters, except "X" # set DEV="`echo $DEV | tr '[A-W,Y-Z]' '[a-w,y-z]'`" echo 'Searching the STDF files -' cd ${stdfpath} ################################################################### # Get/search the list of STDF files for LATEST wafers of the lot # ################################################################### ls -rt *_${REPLY}_*|grep ${DEV}_ > $STDFDIR/temmmp set num_line = `/usr/ucb/wc -l $STDFDIR/temmmp` if ($num_line[1] == 0) then echo "There is no STDF file for lot ${REPLY} in ${stdfpath}" echo "or, the device name ${DEV} is not correct." else foreach i (1 2 3 4 5 6 7 8 9 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) /usr/bin/grep "_${REPLY}_${i}_" $STDFDIR/temmmp |tail -1 >> $STDFDIR/stdf_list end ################################################### # Make sure that the STDF files exist for the lot # ################################################### echo 'Creating maping datafile for each WAFER -' @ i=0 foreach FF (`cat $STDFDIR/stdf_list`) @ i++ cp $stdfpath/$FF $STDFDIR/$FF # New name for each WAFER set fname = `echo $FF | sed -e "s/.*_\(${REPLY}_\)\([0-9]\)_.*/\10\2/" | sed -e "s/.*_\(${REPLY}_[0-9][0-9]\)_.*/\1/"` # set fname = `echo $FF | sed -e "s/.*_\(${REPLY}...\).*/\1/"` ############################################################# # Call function STDX to get the Bin information for mapping # ############################################################# /usr2/crtools/bin/stdx -P $STDFDIR/$FF > $STDFDIR/$fname /usr/bin/rm -f $STDFDIR/$FF echo $i end ##################################################### # Create the list of Bin data files for SAS mapping # ##################################################### cd $STDFDIR /usr/bin/ls -1 ${REPLY}* > $STDFDIR/${REPLY} cd $curdir sleep 1 echo 'Running SAS -' ### Call SAS program ### /usr2/sas612/sas -noterminal -log $STDFDIR/mapping.log\ ~phxtools/ews_map/binmap.sas ### clean up the user directory ### /usr/bin/rm -f $STDFDIR/${REPLY}* sleep 1 ######################## # Distill the PS file # ######################## echo 'Converting PS file to PDF file -' /opt/Acrobat3/bin/distill $STDFDIR/m${REPLY}.ps set FLAG=$?DISPLAY ## FLAG will be 0 or 1 ## if ($FLAG == 0) then echo " " echo "Please set your display by using setenv. Then call" echo "/opt/Acrobat3/bin/acroexch to view your bin map in PDF format." else /opt/Acrobat3/bin/acroexch $STDFDIR/m${REPLY}.pdf & endif echo " " echo "file m${REPLY}.pdf is saved in $STDFDIR directory" endif /usr/bin/rm -f $STDFDIR/temmmp /usr/bin/rm -f $STDFDIR/m${REPLY}.ps ### users' records into a log file ### set quit=`date '+%d/%m/%y:%H:%M:%S'` echo "$user $start $quit" >> ~phxtools/ews_map/Acces.dat echo 'Done mapping'