Assuming that by “invalid characters” you mean hex values not supported within the 5250 data stream, one approach would be to scan the input character string for invalid characters as it is entered by the users and, if any are found, posting an error to the user so that they can correct the data. In general valid characters would be anything between x’20’ and x’FE’ inclusive, x’00’, x’1C’, x’ 1E’, x’0E’, x’0F’, or x’1F’.
Out of curiousity — how are they inputting these invalid characters? Most users have no clue as to how to enter Hex mode on a keyboard in order to provide an arbitrary hex value.
If by “invalid” you mean something else, please explain.