compile subroutine p_names_entry_valid(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition

$insert logical
$insert p_names_equ
declare function msg
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

ReturnedValue = DataIo       
status() = Valid$  
*
begin case
   case ConvType = 'ICONV'
      if num( DataIo ) then
         * is a number now check to see if it is on disk
         if rowexists( 'P_NAMES', DataIo ) then
            * ok now did this user enter it or is Heather trying to snoop
            if @user4 = xlate( 'P_NAMES', DataIo, p_names_entry_id$, '' ) else
               status() = invalid_msg$
            end
         end
      end else
         status() = invalid_msg$
      end
   case ConvType = 'OCONV'
      * no output
      ReturnedValue = DataIo
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return
