Field Validation

Hello All,

I am trying to resolve how to validate a text box (field) immediately after entry and to determine if the content is invalid. And if it is, to return the user to that field. I have tried  using the various "validation" properties ending only in the field trying to validate itself on every character to the field trying to validate itself constantly ect...

What is the "new way" for the following "old way" of administering immediate field validation after the user has finished entering and before moving on to the next field.

Here is the "old code"

Sample procedural (linear) code


       AF25.
           ACCEPT TRN-ACCT-NO,      LINE 03, POSITION 25
                                    PROMPT, ECHO, UPDATE
                                    ON EXCEPTION ERR-CDE
                                    GO TO ERR-EXCEPTION.
           MOVE TRN-ACCT-NO TO CUS-ACCT-NO.
           PERFORM VERIFY-CUST THRU VC-EXIT.
           IF WS-REC-FND = "N"
              MOVE "INVALID CUSTOMER !" TO ERR-MSG1
              MOVE "Strike Any Key To Continue" TO ERR-MSG2
              PERFORM DISP-ERR-WIN THRU DEW-EXIT
              GO TO AF25.
              
       AF26.
           ACCEPT.............(NEXT FIELD)

I realize that I can validate all fields at once based on a given event... That being said,  it would be helpful to be able to handle it immediately as well.

I am old ! So please be as explicit as possible in your example as I am still a newbie when it comes to event driven logic. Thanks in advance for your answers they are greatly appreciated.

Allen