File Layout Error Processing

If an error occurs on any field in any record of a rowset object populated with the ReadRowset method, the rowset object’s property IsEditError returns True. For example, you can use the method ExecuteEdits on a record, to verify that the data in the record is valid (has the correct format, the right data type, and so on.) This type of error is indicated by the IsEditError.

In some instances, however, the rowset object won’t receive the error; in that case the file object’s IsError property returns True. To discover all field errors, check both properties after executing ReadRowset.

To determine which field has the error, you must examine the EditError property of every field in the rowset to find the one returning True. You can then examine that field’s MessageSetNumber and MessageNumber properties to determine the relevant error message. The following example shows how this might be done:

&MYROWSET = &MYFILE.ReadRowset();
If &MYFILE.IsError Then
  For &I = 1 to &MYROWSET.ActiveRowCount
    If &MYROWSET.GetRow(&I).IsEditError Then
      &ROW = &MYROWSET.GetRow(&I);
      For &J = 1 to &ROW.RecordCount
        If &ROW.GetRecord(&J).IsEditError Then
          &REC = &ROW.GetRecord(&J);
          For &K = 1 to &REC.FieldCount
            If &REC.GetField(&K).EditError Then
              /* Examine the field’s 
                 MessageSetNumber and MessageNumber properties, 
                 and respond accordingly */


Note: Only field errors set the IsError, IsEditError, or EditError properties. All other errors triggered by File class methods terminate the PeopleCode program.