cas_val

Validates CAS numbers.

Syntax

list cas_val(cas)
string   cas

Description

cas_val() checks that a user entry has only two digits and two dashes and then applies a checksum technique. If the user entry is a valid CAS number, it is returned. If it is invalid, NULL is returned.

cas

CAS registry number for a substance. These numbers are assigned by the American Chemical Society.

Example

You can use cas_val() in validation triggers for CAS fields in applications and to validate CAS values before submitting them to Thor or Merlin

The following code shows a validation trigger for the CAS field:

{
if (parm[0])
   field=cas_val(parm[0]);  /* returns parm[0] if valid  */
                            /* returns NULL if not valid */
}


Updated 19 May 1999. Copyright DataAspects Corp. 1998-1999