compile subroutine calculator_resrho_valid(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition
declare function msg, get_property, set_property
declare subroutine update_index, extract_si_keys

$insert logical
$insert msg_equates

equ valid$         to 0    ;* successful
equ invalid_msg$   to 1    ;* bad data       -   print error message window
equ invalid_conv$  to 2    ;* bad conversion -          "         "
equ invalid_nomsg$ to 3    ;* bad but do not print the error message window
equ CrLf$          to char(13):char(10)

* THIS IS SIMPLY TO CALCULATE RESISTIVITY NOT TO VALIDATE RESRHO FOR THE 
* CALCULATOR, CAUSE THERE IS NO SPEC

ReturnedValue = DataIo       
status() = Valid$
begin case
   case ConvType = 'ICONV'
      Thickness = iconv( get_property( @window:'.THICKNESS_READINGS', 'ARRAY' ), 'MD2' )
      SheetRHO  = get_property( @window:'.SHEETRHO_READINGS', 'ARRAY' )
      OffSet = str( '.001':@vm, 17 )
      OffSet[-1,1] = ''
      Res = oconv( SheetRHO *** Thickness *** OffSet, 'MD3' )
      swap '.000' with '' in Res
	   Void = set_property( @window:'.RES_READINGS', 'ARRAY', Res )                    
   case ConvType = 'OCONV'
      * no output
      ReturnedValue = DataIo
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return
