Programming Guide


Validates the current screen

int sm_s_val(void);



sm_s_val validates all fields and their occurrences, on- and offscreen, that are not protected from validation. Calling this function is equivalent to calling sm_fval for each field and its occurrences. If an occurrence fails validation, sm_s_val repositions the cursor to it and displays an error message. If the occurrence is offscreen, sm_s_val scrolls the array until it is visible. The function then stops validation and returns. Fields that follow the invalid occurrence remain unvalidated.

sm_s_val validates array occurrences sequentially, whether onscreen or offscreen. Thus, offscreen occurrences that precede the first onscreen occurrence are validated first.

sm_s_val also validates groups, grids, and tab cards. A group is validated when its first field would be validated were it not a group member. Fields that are members of a group are not validated individually. A grid is validated after its last field is validated. All fields, grids and tab cards that are on a tab card are validated together and before the card's validation function is called. When a card is validated, offscreen occurrences of fields not on that card may be validated if they are synchronized with fields on the card.

sm_s_val validates synchronized arrays by processing parallel occurrences sequentially. The function begins by validating the first occurrence (on- or offscreen) of the array with the lowest base field number, then the first occurrence of the array with the next base field number, and so on. sm_s_val completes validation when it processes the last occurrence of the array with the highest base field number.

For more information about field validation processing, refer to sm_fval.


proc screen_exit()

if (sm_s_val()) // found invalid field data, returned -1
msg err_reset \
"Erroneous data; please correct and save again"

See Also

sm_fval, sm_n_gval, sm_validate