function rds_comm2(Branch)

* CREATED ON 3/19/99 by Bryce Meek - DUE TO BUFFER OVERLOAD IN RDS_COMM

declare function msg, get_property, entid, key_sort, repository, fieldcount, set_property
declare function dialog_box, send_event, obj_RDS, Supplement_Services
declare subroutine extract_si_keys, make.list, btree.extract, Supplement_Services



equ OutSpecThickLossCode$ to 'D1'
equ OutSpecResLossCode$   to 'D2'

equ FirstWaferInspection$ to 5

equ CrLf$ to char(13):char(10)

$insert quote_spec_equ
$insert prod_spec_equates
$insert rds_equates
$insert rds_layer_info_equ
$insert suppl_info_array_equ
$insert wo_master_sched_equ
$insert react_ll_serv_equ
$insert tw_info_array_equ
$insert react_hrs_equ
$INSERT REACT_RUN_EQUATES
$INSERT CLEAN_INSP_EQUATES

$insert msg_equates
$insert logical
$insert popup_equates

ReturnVar = 0
Branches = 'SEND_STAT_DATA,WAF_SIZE_SET,REACT_PROFILE,SET_SRP_PROFILE,HOLD_CHECK,HOLD_CLICK,SUPPL_CHECK,SUPPL_CLICK,SIGN_ATTEMPT,SIGN_HOLD_CHECK,NEXT_RDS,READY_TO_SHIP_CHECK,CHECK_LL,TW_INSPEC_CHECK,LOAD_UNLOAD_EXTRA_SIGN_CHECK,CHECK_WAF_ETCH,TC_HOURS_CHECK'
convert ',' to @fm in Branches
locate Branch in Branches using @fm setting Bpos then
   on Bpos gosub SEND_STAT_DATA, WAF_SIZE_SET, REACT_PROFILE, SET_SRP_PROFILE, HOLD_CHECK, HOLD_CLICK, SUPPL_CHECK, SUPPL_CLICK, SIGN_ATTEMPT, SIGN_HOLD_CHECK, NEXT_RDS, READY_TO_SHIP_CHECK, CHECK_LL, TW_INSPEC_CHECK, LOAD_UNLOAD_EXTRA_SIGN_CHECK, CHECK_WAF_ETCH, TC_HOURS_CHECK
end else
   Void = msg( '', 'Invalid Branch ':Bpos:' passed to rds_comm2' )
end
return ReturnVar
*===============================================================================================*
SEND_STAT_DATA:
	
  
return
*===============================================================================================*
WAF_SIZE_SET:
   
return       
*===============================================================================================*
REACT_PROFILE:
   ProfileInfo = get_property( @window:'.REACTOR_PROFILE', 'ARRAY' )
   Void = dialog_box( 'RDS_RPROFILE', @window, ProfileInfo:char(245):'*CENTER' )
return
*===============================================================================================*
SET_SRP_PROFILE:
	CurArray = get_property( @window:'.SRP_PROFILES', 'ARRAY' )
	CCnt = fieldcount( CurArray, @vm )
	Tcnt = 0
	PVals = 'No SRP Profiles'
	for i = 1 to CCnt
	   if ( CurArray<1,i> <> '' ) then
	      Tcnt += 1   
	      PVals<i> = 'Profile ':i
	   end
	next i
	if PVals = 'Profile 1' then
	   * THERE IS ONLY ONE PROFILE SO NO NEED TO SAY IT
	   PVals = 'Profile'
	end
   Void = set_property( @window:'.PROFILE_LIST', 'LIST', Pvals )	
return
*===============================================================================================*
HOLD_CHECK:
RETURN
   if @window = 'RDS_PRE_EPI' then
      HoldStatus = get_property( @window:'.HOLD', 'TEXT' )
   end else
      HoldStatus = xlate( 'RDS', get_property( @window:'.RDS_NO', 'TEXT' ), rds_hold$, 'X' )
   end
   if HoldStatus then
      Void = set_property( @window:'.HOLD_BUTTON', 'VISIBLE', 1 )
   end else
      Void = set_property( @window:'.HOLD_BUTTON', 'VISIBLE', 0 )
   end
   
return     
*===============================================================================================*
HOLD_CLICK:
RETURN
   if @window = 'RDS_PRE_EPI' then
      Void = send_event( @window:'.HOLD_SET', 'CLICK' )
   end else
      Void = dialog_box( 'RDS_HOLD', @window, 'READONLY':char(245):get_property( @window:'.RDS_NO', 'TEXT' ) )
   end
return
*===============================================================================================*
SUPPL_CHECK:
*   SupplInfo = get_property( @window:'.SUPPL_INFO', 'ARRAY' )
	SupplInfo     = get_property( @window:'.RDS_NO', 'TEXT' )
	SuppsWithLots = Supplement_Services('GetSupplementsForLot', 'RDS', SupplInfo, '')
	If SuppsWithLots EQ False$ then
		SupplFlag = False$
	end else
		SupplFlag = True$
	end
	Void          = set_property( @window:'.SUPPL_BUTTON', 'VISIBLE', SupplFlag ) 
return
*===============================================================================================*
SUPPL_CLICK:
   SuplInfo = get_property( @window:'.SUPPL_INFO', 'ARRAY' )
	DataToSend = field( SuplInfo, @fm, 1, SupOpSigTime$ )
	SupplInst = get_property( @window:'.SUPPL_INST', 'TEXT' )
	DataToSend := char(245): SupplInst	
	* NOT PASSING THE LAST VALUE CAUSE IT IS JUST THE FLAG
	RetData = dialog_box( 'RDS_SUPPL', @window, DataToSend )
	if RetData <> 'CANCEL' then
	   Instructions = field( RetData, char(245), 2 )
	   RetData = field( RetData, char(245), 1 )
	   Void = set_property( @window:'.SUPPL_INFO', 'ARRAY', RetData:@fm:'1' )
	   Void = set_property( @window:'.SUPPL_INST', 'TEXT', Instructions )
      Void = set_property( @window, 'SAVEWARN', 1 )
	end
return
*===============================================================================================*
SIGN_ATTEMPT:
	* THEY ARE ABOUT TO SUCCEDED ON A SIGNATURE, MAKE SURE THAT THE SUPLEMENT FORM IF APPLICABLE
	* HAS BEEN SIGNED
	* MAKE SURE THAT 24 HAS NOT PASSED SINCE THE LAST CLEANING
	* READ THE RDS PRE CLEAN DATE AND TIME
	RDSNo = get_property( @window:'.RDS_NO', 'TEXT' )
	RDSRec = xlate( 'RDS', RDSNo, '', 'X' )
	SigDate = RDSRec<rds_pre_epi_sig_date$>
	SigTime = RDSRec<rds_pre_epi_sig_time$>
	DCnt = fieldcount( SigDate, @vm )
	TCnt = fieldcount( SigTime, @vm )
	CurSigDate = SigDate<1,DCnt>
	CurSigTime = SigTime<1,TCnt>
	Today = date()
	Now   = time()
   DateDiff = Today - CurSigDate
   SecondsToAdd = 0
   if DateDiff then
       SecondsToAdd = 86400*DateDiff
   end
   Tans = ( Now + SecondsToAdd ) - CurSigTime
   Tans =( Tans /3600)
   if Tans > 24.00 then
      MsgInfo = ''
      MsgInfo<mtext$> = 'It has been more than 24 hours since the last cleaning...':CrLf$:'Please re-clean the material and record in the pre epi window'
      MsgInfo<micon$> = 'H'
      Void = msg( '', MsgInfo )
      ReturnVar = 0
   end
   SupplInfo = get_property( @window:'.SUPPL_INFO', 'ARRAY' )
   if ( SupplInfo<SupOpSig$> = '' ) and ( SupplInfo<SupFlag$> = 1 ) then
      * THEY HAVE NOT SIGNED SO FORCE IT UP
      gosub SUPPL_CLICK
      returnVar = 0
   end else
      returnVar = 1
   end
return
*===============================================================================================*
SIGN_HOLD_CHECK:
   HoldStatus = xlate( 'RDS', get_property( @window:'.RDS_NO', 'TEXT' ), 'HOLD', 'X' )
   if HoldStatus = 1 then
      MsgInfo = ''
      MsgInfo<mtext$> = 'This RDS is currently on hold.  No further processing is allowed.'
      MsgInfo<micon$> = 'H'
      Void = msg( '', MsgInfo )
      ReturnVar = 0
   end else
      ReturnVar = 1
   end
return
*===============================================================================================*
NEXT_RDS:
	* GET REACTOR NUMBER AND THEN READ MASTER SCHEDULER AND GET ALL WOS AND RDSs THAT HAVE NOT BEEN LOADED
	* CAUSE THESE ARE VALID RDS NUMBERS
	ThisRDSNo = get_property( @window:'.RDS_NO', 'TEXT' )
	Reactor = get_property( @window:'.REACTOR', 'TEXT' )
	WOMastSchedRec = xlate( 'CONFIG', 'WO_MAST_SCHED', '', 'X' )
	ValidWOs = ''
	for Day = Day1$ to Day31$
	   ThisDay = WOMastSchedRec<Day,Reactor>
	   ThisDayIconv = iconv( ThisDay, '[WO_VALID_PROGRAM_CALL]' )
	   WoCnt = fieldcount( ThisDayIconv, @fm )
	   for i = 1 to WoCnt
	      ThisWO = ThisDayIconv<i>
     	   locate ThisWo in ValidWOs using @fm setting FPos else
     	   	ValidWos<-1> = ThisWo
     	   end 
	   next i
	Next Day
	open 'DICT.RDS' to DictRDSTableVar else
	   Void = msg( '', 'Unable to open DICT.RDS...' )
	   return
	end
	convert @fm to @vm in ValidWos
	SearchStr = ''
	SearchStr<-1> = 'WO':@vm:ValidWos
	SearchStr<-1> = 'STATUS':@vm:'C':@vm:'E':@fm ;* ORDER RECEIVED OR PRE EPI STATUS
	btree.extract( SearchStr, 'RDS', DictRDSTableVar, Keys, "S", flag )
	if flag <> 0 then
	   Void = msg( '', 'Error while extracting RDS keys...' )
	   return
	end
	if Keys = '' then
	   return
	end	
   convert @vm to @fm in Keys	
   Keys = key_sort( Keys, 'RDS', 'CUST_NAME':@fm:'WO':@fm:'RUN_ORDER_NUM', 1 )
   locate ThisRDSNo in Keys using @fm setting FFPos else
      * ALLOW THEM TO ENTER THE CURRENT RDS IN CASE NOTHING ELSE IS SCHEDULED
      Keys = insert( Keys, FFPos, 0, 0, ThisRDSNo )
   end
	* AT THIS POINT THE USER HAS SUCCESSFULLY SIGNED THIS RDS
	* NOW WE NEED TO ASK THE USER FOR THE NEXT RDS NUMBER
	* USE MSG() FUNCTION FOR INPUT

	AskRds:
	MsgInfo = ''
	MsgInfo<mtext$> = 'Enter the next RDS number, or press OK for a selection of scheduled RDSs...'
	MsgInfo<mtype$> = 'RCE'
	MsgInfo<micon$> = '?'
	MsgInfo<mvalid$> = '(MD0)'
	NextRDSNumber = ''							
	NextRDSNumber = msg( '', MsgInfo )
	convert char(27) to '' in NextRDSNumber
	if NextRDSNumber = '' then
		PopId = entid( @appid<1>, 'POPUP', '', 'RDS_QUERY' )
		OverRide = ''
		OverRide<pselect$> = 1
		OverRide<ptitle$> = 'Please choose the next RDS for reactor ':Reactor:'...'
		TKeys = Keys
		make.list( 0, TKeys, '', '' )
		NextRDSNumber = repository( "EXECUTE", PopId, @window, OverRide )
		if NextRDSNumber = '' then
		   goto AskRds
		end
	end else
	   locate NextRDSNumber in Keys using @fm setting FFFPos else
	      MsgInfo = ''
	      MsgInfo<mtext$> = NextRDSNumber:' is not a valid scheduled RDS...'
	      MsgInfo<micon$> = 'H'
	      Void = msg( '', MsgInfo )
	      goto AskRds
	   end
	end

	* GET CURRENT RECIPE USING XLATE() ON RDS TABLE USING THE 
	* TEXT VALUE OF THE RDS NO. ON THIS FORM

	CurrentRecipe = xlate( 'RDS', ThisRDSNo, 'RECIPE_NO', 'X' )


	* GET RECIPE FOR NEXT BOX USING XLATE ON RDS TABLE PASSING THE NUMBER
	* THAT THE USER ENTERED ABOVE

	NextRecipe = xlate( 'RDS', NextRDSNumber, 'RECIPE_NO', 'X' )

	If CurrentRecipe = NextRecipe else
		MsgInfo = ''
		MsgInfo<mtext$> = 'The next RDS has a different recipe.'
		MsgInfo<mtype$> = 'BO'
		MsgInfo<micon$> = '!'
		Void = msg( '', MsgInfo )
	end
return
*===============================================================================================*
READY_TO_SHIP_CHECK:

	* * * * * * *   This is appears dead 4/22/2015 JCH   * * * * * * * * * * 
	
   ThisRDS    = get_property( @window:'.RDS_NO', 'TEXT' )
   ThisRDSRec = xlate( 'RDS', ThisRDS, '', 'X' )
   WafersOut = obj_RDS('WafersOut',ThisRDS:@RM:ThisRDSRec)	;* JCH 10/20/2004 ThisRDSRec<rds_wafers_out$>
   if xlate( 'RDS', ThisRDS, 'OPEN_NCR', 'X' ) then
   	MsgInfo = ''
	   Text = 'This RDS has open NCRs...'
	   MsgInfo<mtext$> = text
	   MsgInfo<micon$> = 'H'
      Void = msg( '', MsgInfo )
      ReturnVar = 0
      return
	end
	
	
	* CHECK THE AVERAGES FOR THICKNESS AND RESISTIVITY
   * FIRST CHECK THICKNESS
   if xlate( 'RDS', ThisRDS, 'THICK_AVG_OUT', 'X' ) then
   	* NOW SEE IF THERE IS AN NCR
      NcrIds = ''
    	extract_si_keys( 'NCR', 'RDS_ID',  ThisRDS, NcrIds )
    	Ncnt = fieldcount( NcrIds, @vm )
    	BreakOut = false$
    	NCRThick = false$
    	for j = 1 to Ncnt
    		ThisLossCode = xlate( 'NCR', NcrIds<1,j>, 'LOSS_CODE', 'X' )
    	   if ( ThisLossCode = OutSpecThickLossCode$ ) then
    	   	BreakOut = true$
    	   	NCRThick = true$
			end
  	     until BreakOut   
  	   next j
		if ( NCRThick = false$ ) then
   		MsgInfo = ''
	      Text = 'This RDS thickness average is out of spec and there is no NCR for out of spec thickness...'
	      MsgInfo<mtext$> = text
	      MsgInfo<micon$> = 'H'
         Void = msg( '', MsgInfo )
         ReturnVar = 0
         return
		end
	end
   * NOW RESISTIVITY
   if xlate( 'RDS', ThisRDS, 'RES_AVG_OUT', 'X' ) then
		* NOW SEE IF THERE IS AN NCR
		NcrIds = ''
    	extract_si_keys( 'NCR', 'RDS_ID', ThisRDS, NcrIds )
    	Ncnt = fieldcount( NcrIds, @vm )
    	BreakOut = false$
    	NCRRes   = false$
    	for j = 1 to Ncnt
    		ThisLossCode = xlate( 'NCR', NcrIds<1,j>, 'LOSS_CODE', 'X' )
    	   if ( ThisLossCode = OutSpecResLossCode$ ) then
    	   	BreakOut = true$
    	   	NCRRes   = true$
			end
  	     until BreakOut   
		next j
  	   if ( NCRRes = false$ ) then
			MsgInfo = ''
	      Text = 'This RDS resistivity average is out of spec and there is no NCR for out of spec resistivity...'
	      MsgInfo<mtext$> = text
	      MsgInfo<micon$> = 'H'
	      Void = msg( '', MsgInfo )
	      ReturnVar = 0
	      return
		end
	end
	************************************************************************
	* IF A PRODUCT WAFER WAS USED THEN MUST HAVE FIRST WAFER INSPECTION CODE
	* AND ONE OF THE PIECES OF DATA
	************************************************************************
	TWProd      = ThisRdsRec<rds_tw_prod$>
	DataFound = 0
	if TWProd > 0 then
	   TwProdCnt    = ThisRdsRec<rds_tw_prod_cnt$>
	   TwProdTool   = ThisRdsRec<rds_tw_prod_tool$>
	   TwProdThick  = ThisRdsRec<rds_tw_prod_thick$>
	   TwProdRes    = ThisRdsRec<rds_tw_prod_res$>
	   TwProdRHO    = ThisRdsRec<rds_tw_prod_rho$>
	   TwProdStress = ThisRdsRec<rds_tw_prod_stress$>
	   TwProdTrans  = ThisRdsRec<rds_tw_prod_trans$>
		TwProdCon    = ThisRdsRec<rds_tw_prod_con$>
	   TwProdCode   = ThisRdsRec<rds_tw_prod_code$>
	   TWCnt = fieldcount( TwProdCnt, @vm )
	   DataFound = false$
		for j = 1 to TWCnt
		   AnyData = TwProdThick<1,j>:TwProdRes<1,j>:TwProdRHO<1,j>:TwProdStress<1,j>:TwProdTrans<1,j>:TwProdCon<1,j>
			if ( TwProdCode<1,j> = FirstWaferInspection$ ) and ( AnyData = '' ) then
				MsgInfo = ''
	      	Text = 'You have used a product for first wafer inspection, you must enter the data.'
	      	MsgInfo<mtext$> = text
	      	MsgInfo<micon$> = 'H'
	      	Void = msg( '', MsgInfo )
         	ReturnVar = 0
         	return			   
			end else
			   if AnyData <> '' then
			      DataFound = 1
			   end
	      end
	     until DataFound
		next j
	end
	************************************************************************
	* IF THERE ARE WAFERS OUT THEN THEY MUST HAVE A TTHICK_AVG TRES_AVG
	* DATA FOUND ABOVE
	************************************************************************
	if ( WafersOut > 0 ) and ( DataFound = '' ) then
	   TThickAvg = ThisRdsRec<rds_tthick_avg$>
	   TResAvg   = ThisRdsRec<rds_tres_avg$>
      if ( TThickAvg <> '' ) or ( TResAvg <> '' ) else
			MsgInfo = ''
	      Text = 'You have wafers out so you must have Thick/Res.'
	      MsgInfo<mtext$> = text
	      MsgInfo<micon$> = 'H'
	      Void = msg( '', MsgInfo )
         ReturnVar = 0
         return
      end
   end
   ReturnVar = 1
return
*===============================================================================================*
CHECK_LL:
	ReturnVar = 1
	RETURN 			;* Added per Pete on 1/4/2006
	
	Reactor		= get_property( @window:'.REACTOR', 'TEXT' )
	ReactLLInfo = xlate( 'CONFIG', 'REACT_LL_SERV', '', 'X' )
	Reactors    = ReactLLInfo<LLReactor$>
	
	AsmPlusReactors = XLATE('CONFIG','ASM_PLUS_REACTORS','','X')	;* Added 1/12/05 JCH
   
	LOCATE Reactor IN AsmPlusReactors USING @FM SETTING Dummy THEN
		
		ReturnVar = 1
		RETURN 
	END
   locate Reactor in Reactors using @vm setting RPos else
      ReturnVar = 1 ;* WILL NOT HAPPEN CAUSE ALL REACTORS WILL BE IN THERE EXCEPT AT FIRST HELLO
      return
   end
	LastDate     = ReactLLInfo<LLLastDate$,RPos>
	LastTime     = REactLLInfo<LLLastTime$,RPos>
   Today = date()
   DateDiff = Today - LastDate
   SecondsToAdd = 0
   if DateDiff then
   	SecondsToAdd = 86400*DateDiff
   end
   Tans = ( time() + SecondsToAdd ) - LastTime
   HrsSinceLast = ( Tans /3600) * 100	   
   HrsSinceLast = oconv( HrsSinceLast, 'MD2' )
   if HrsSinceLast > 50.00 then
		MsgInfo = ''
	   Text = 'This reactor has not had a Leak && Lamp check for ':HrsSinceLast:' hours,':CrLf$:'Please turn the reactor over to maintenance...'
	   MsgInfo<mtext$> = text
	   MsgInfo<micon$> = '!'
	   Void = msg( '', MsgInfo )
      ReturnVar = 1 ;* JUST WARN THE USER, DO NOT STOP
      return      
   end
   if HrsSinceLast > 60.00 then
		MsgInfo = ''
	   Text = 'This reactor has not had a Leak && Lamp check for ':HrsSinceLast:' hours,':CrLf$:'You must turn the reactor over to maintenance...'
	   MsgInfo<mtext$> = text
	   MsgInfo<micon$> = '!'
	   Void = msg( '', MsgInfo )
      ReturnVar = 0 ;* STOP EVERYTHING
      return      
   end
   ReturnVar = 1
return
*===============================================================================================*
TW_INSPEC_CHECK:
	InfoArray   = get_property( @window:'.TW_INFO', 'ARRAY' )
	ICnt = fieldcount( InfoArray<1>, @vm )
	PSNId     = get_property( 'RDS_UNLOAD.PSN', 'TEXT' )   
	ThickMinAll = oconv( xlate( 'PROD_SPEC', PSNId, 'THICK_MIN_ALL', 'X' ), 'MD2' )
	ThickMaxAll = oconv( xlate( 'PROD_SPEC', PSNId, 'THICK_MAX_ALL', 'X' ), 'MD2' )
	ThCnt = fieldcount( ThickMinAll, @vm )
	ResMinAll = oconv( xlate( 'PROD_SPEC', PSNId, 'RES_MIN_ALL', 'X' ), 'MD3' )
	ResMaxAll = oconv( xlate( 'PROD_SPEC', PSNId, 'RES_MAX_ALL', 'X' ), 'MD3' )
	RCnt = fieldcount( ResMinAll, @vm )
	ConMinAll = oconv( xlate( 'PROD_SPEC', PSNId, 'CON_MIN_ALL', 'X' ), 'MS21' )
	ConMaxAll = oconv( xlate( 'PROD_SPEC', PSNId, 'CON_MAX_ALL', 'X' ), 'MS21' )
	CCnt = fieldcount( ConMinAll, @vm )
	StressMin = oconv( xlate( 'PROD_SPEC', PSNId, 'STRESS_MIN', 'X' ), 'MS21' )
	StressMax = oconv( xlate( 'PROD_SPEC', PSNId, 'STRESS_MAX', 'X' ), 'MS21' )
	TransSpec     = oconv( xlate( 'PROD_SPEC', PSNId, 'TRANS_SPEC', 'X' ), 'MD2' )
	* IF WE HAVE DATA IN ANY CELL THAT IS FIRST WAFER THEN VERIFY AGAINST THE SPEC OF ONE OF THE LAYERS
	MsgText = ''				
	for i = 1 to ICnt
		ToolEntered = InfoArray<TWInfoArrayTool$,i>
		CurCode = InfoArray<TWInfoArrayCode$,i>
		if CurCode = 5 then
			Thick = InfoArray<TWInfoArrayThick$,i>
			Res   = InfoArray<TWInfoArrayRes$,i>
			Con  = InfoArray<TWInfoArrayConc$,i>
			Stress = InfoArray<TWInfoArrayStress$,i>
			Trans  = InfoArray<TWInfoArrayTrans$,i>
			RHO    = InfoArray<TWInfoArrayRHO$,i>
			if Thick then
			   InSpec = 0
			   for j = 1 to ThCnt
			      if ( Thick >= ThickMinAll<1,j> ) and ( Thick <= ThickMaxAll<1,j> ) then
			         InSpec = 1
			      end
			     until InSpec
			   next j
		      if InSpec else
		         MsgText = 'Thickness on line ':i:' is out of spec from ':ThickMinAll<1,1>:' - ':ThickMaxAll<1,1>:CrLf$
		      end			   
			end
			if Res then
			   InSpec = 0
			   for j = 1 to RCnt
			      if ( Res >= ResMinAll<1,j> ) and ( Res <= ResMaxAll<1,j> ) then
			         InSpec = 1
			      end
			     until InSpec 
			   next j
			   if InSpec else
               MsgText := 'Resistivity on line ':i:' is out of spec from ':ResMinAll<1,1>:' - ':ResMaxAll<1,1>:CrLf$
            end			   
			end
			if RHO then
			   RHO = oconv( RHO * 1000, 'MD3' )
			   InSpec = 0
			   for j = 1 to RCnt
			      if ( RHO >= ResMinAll<1,j> ) and ( RHO <= ResMaxAll<1,j> ) then
			         InSpec = 1
			      end
			     until InSpec 
			   next j
			   if InSpec else
               MsgText := 'SheetRHO on line ':i:' is out of spec from ':ResMinAll<1,1>:' - ':ResMaxAll<1,1>:CrLf$
            end			   
			end			
			if Con then
			   InSpec = 0
			   for j = 1 to CCnt
			      if ( Con >= ConMinAll<1,j> ) and ( Con <= ConMaxAll<1,j> ) then
			         InSpec = 1
			      end
			     until InSpec 
			   next j
			   if InSpec else
               MsgText := 'Concentration on line ':i:' is out of spec from ':ConMinAll<1,1>:' - ':ConMaxAll<1,1>:CrLf$
            end			   
			end			
			if Stress then
			   if ( Stress >= StressMin ) and ( Stress <= StressMax ) else
               MsgText := 'Stress on line ':i:' is out of spec from ':StressMin:' - ':StressMax:CrLf$
            end
			end
			if Trans then
			   if ( Trans < TransSpec ) else
               MsgText := 'Transition on line ':i:' is out of spec < ':TransSpec:CrLf$
            end
			end			
	   end
	next i
	if MsgText <> '' then
	   MsgInfo = ''
	   MsgInfo<mtext$> = MsgText
	   MsgInfo<micon$> = 'H'
	   Void = msg( '', MsgInfo )
	   ReturnVar = 1
	end
return

*===========================================================================================================*
LOAD_UNLOAD_EXTRA_SIGN_CHECK:

/*
	RDSNo = get_property( 'RDS.RDS_NO', 'TEXT' )
	RDSRec = xlate( 'RDS', RDSNo, '', 'X' )
	
	
	
	PreCINo			= XLATE('REACT_RUN',RDSNo,REACT_RUN_PRE_CI_KEY$,'X')
	LastCleanSigDTM = XLATE('CLEAN_INSP',PreCINo,CLEAN_INSP_CLEAN_VER_SIG_DTM$,'X')[-1,'B':@VM]

	IF LastCleanSigDTM NE '' THEN

		CurrDTM	= ICONV(OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTS'),'DT')

		Delta = CurrDTM - LastCleanSigDTM
	
   
		IF Delta > 24.00 THEN
			MsgInfo = ''
			MsgInfo<mtext$> = 'It has been more than 24 hours since the last cleaning...':CrLf$:'Please re-clean the material and record in the pre epi window'
			MsgInfo<micon$> = 'H'
			Void = msg( '', MsgInfo )
			ReturnVar = 0
		End 
	END Else 
	
      ReturnVar = 1
	End 
	
*/	
ReturnVar = 1
return


*===========================================================================================================*
CHECK_WAF_ETCH:
   * CHECK TO SEE IF IT IS BURIED LAYER OTHERWISE DONT CHECK THE WAFER ETCH
   RDSID = get_property( @window:'.RDS_NO', 'TEXT' )
   if not( xlate( 'RDS', RDSID, 'BURIED_LAYER', 'X' ) ) then
      * IT IS NOT BURIED LAYER SO DO NOT CHECK
      ReturnVar = 1
      return 
   end
   open 'DICT.SPC_WAFER_ETCH' to DictSPCWaferEtchTable else
      Void = msg( '', 'Unable to open DICT.SPC_WAFER_ETCH' )
      ReturnVar = 0
      return   
   end
   Reactor = get_property( @window:'.REACTOR', 'TEXT' )
   
   *DateRange = oconv( date()-7, 'D4/' ):'...':oconv( date(), 'D4/' )	;* 10/23/2003 JCH
   DateRange = oconv( date()-14, 'D4/' ):'...':oconv( date(), 'D4/' )	;* Changed to 14 days
   SearchStr = ''
   SearchStr<-1> = 'REACTOR':@vm:Reactor
   SearchStr<-1> = 'DATE_TESTED':@vm:DateRange
   SearchStr    := @fm
   btree.extract( SearchStr, 'SPC_WAFER_ETCH', DictSPCWaferEtchTable, Keys, '', Flag )
   if Flag <> 0 then
      Void = msg( '', 'Error while extracting SPC_WAFER_ETCH records...' )
      ReturnVar = 0
      return
   end
   if Keys then
      ReturnVar = 1
   end else
      MsgInfo = ''
      MsgInfo<micon$> = 'H'
      MsgInfo<mtext$> = 'There has not been a wafer etch test within the last 14 days for reactor ':Reactor:'.':CrLf$:'Engineering must perform a wafer etch test prior to starting the box.'
      Void = msg( '', MsgInfo )
      * DO NOT STOP THE OPERATOR
      ReturnVar = 1
   end
return
*===========================================================================================================*
TC_HOURS_CHECK:
	RDSNo = get_property( 'RDS.RDS_NO', 'TEXT' )
	RDSRec = xlate( 'RDS', RDSNo, '', 'X' )
	Reactor = RDSREc<rds_reactor$>
	CurReactHrs = xlate( 'CONFIG', 'REACT_HRS_EQU', '', 'X' )
	TCHours = CurReactHrs
   if TCHours > 400 then
      MsgInfo = ''
      MsgInfo<mtext$> = 'The TC hours are greater than 400 hours.':CrLf$:'Please have maintenance change out the TCs before commiting the next box'
      MsgInfo<micon$> = 'H'
      Void = msg( '', MsgInfo )
      ReturnVar = 0
   end else
      ReturnVar = 1
   end
return



