f_check_status.srf 878 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. $PBExportHeader$f_check_status.srf
  2. global type f_check_status from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_check_status (integer arg_type, string arg_string)
  6. end prototypes
  7. global function integer f_check_status (integer arg_type, string arg_string);Int rslt = 1
  8. Long cnt = 0
  9. IF sys_option_aloweditstatus = 0 THEN
  10. rslt = 1
  11. GOTO ext
  12. END IF
  13. IF arg_string = '' THEN
  14. rslt = 1
  15. GOTO ext
  16. END IF
  17. IF arg_type = 1 THEN
  18. SELECT count(*) INTO :cnt
  19. FROM u_color
  20. Where colorname = :arg_string;
  21. ELSEIF arg_type = 2 THEN
  22. SELECT count(*) INTO :cnt
  23. FROM u_color_wood
  24. Where woodcode = :arg_string;
  25. ELSEIF arg_type = 3 THEN
  26. SELECT count(*) INTO :cnt
  27. FROM u_color_pcode
  28. Where pcode = :arg_string;
  29. END IF
  30. IF sqlca.SQLCode <> 0 THEN
  31. rslt = 0
  32. GOTO ext
  33. END IF
  34. IF cnt <> 1 THEN
  35. rslt = 0
  36. GOTO ext
  37. END IF
  38. ext:
  39. RETURN rslt
  40. end function