If the only way to update a field in a file is programatically, you can add an edit to that program(s).
We all know that files are updated many other ways: CPYF, DBU, UPDDTA, SQL, etc, the only solution is to add a trigger program to the file. In the program you can vaildate your field and then take whatever action you want.
You may want to convert those invalid characters to blanks and sent out an an error message.
Depending on the possible values in the field, you could just add a Constraint ADDPFCST
Last Wiki Answer Submitted: May 11, 2012 1:22 pm by CharlieBrowne32,835 pts.
All Answer Wiki Contributors: CharlieBrowne32,835 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
RPG supports calls to the regular expression API. It is designed to handle the situation you describe. However, unless you are familiar with regular expressions it may be a lot quicker to code up an RPG procedure.
If it is a field being entered from a DSPF, they you need to add an edit in your program to check for those invalid characters..
You can then force an error an make the user correct the value.
RPG supports calls to the regular expression API. It is designed to handle the situation you describe. However, unless you are familiar with regular expressions it may be a lot quicker to code up an RPG procedure.
…in a field
What “field”? A database field? A field in the program? A display field? A Printer field?
Are those always going to be the only characters that must be prevented?
Tom
Hi Tom,
Display field entry field….
If it is a field being entered from a DSPF, they you need to add an edit in your program to check for those invalid characters..
You can then force an error an make the user correct the value.