home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST1.PRG < prev    next >
Encoding:
Text File  |  1989-08-23  |  1.1 KB  |  45 lines

  1. ********************
  2.  
  3. FUNCTION Ap_it
  4.  
  5.    PARAMETERS _apa, _apb, _apc, _apd
  6.  
  7.    * _apa = the field name
  8.    * _apb = the field data type
  9.    * _apc = the field length
  10.    * _apd = the field decimal
  11.  
  12.    * This function call is to replace the REPLACE field_name WITH ...
  13.    * Now: AP_IT("Lastname","C",1)
  14.    
  15.    * This function replaces the parameters into a STRUCTURE EXTENDED
  16.    * database this is previously created and open.
  17.  
  18.    IF PCOUNT() = 3
  19.       _apd = 0
  20.    ENDIF
  21.  
  22.    IF EMPTY(ALIAS())
  23.       RETURN(-1)
  24.    ELSEIF TYPE("field_name") = "U"
  25.       RETURN(-3)
  26.    ELSEIF TYPE("_apa") + TYPE("_apb") + TYPE("_apc") + TYPE("_apd") != "CCNN"
  27.       RETURN(-2)
  28.    ENDIF
  29.  
  30.  
  31.    LOCATE ALL FOR UPPER(field_name) == UPPER(_apa)
  32.    IF FOUND()
  33.       RETURN(0)
  34.    ELSE
  35.       APPEND BLANK
  36.       IF _apc > 255
  37.          REPLACE field_name WITH _apa, field_type WITH _apb, field_len WITH INT(_apc % 256), field_dec WITH INT(_apc / 256)
  38.       ELSE
  39.          REPLACE field_name WITH _apa, field_type WITH _apb, field_len WITH _apc, field_dec WITH _apd
  40.       ENDIF
  41.    ENDIF
  42.    RETURN(RECNO())
  43.  
  44. * End of File
  45.