I hope someone can help me. I'm having trouble figuring out to to use VER to validate an ISPF panel field. This is a 16-character field, defined with CAPS(ON), which must be of a particular format. The first n characters must be uppercase alphabetic (A-Z), followed by a single hyphen, followed by m numeric characters (0-9). Trailing blanks are okay, but embedded blanks are not.
E.g., these are okay:
ABC-1234
A-9
ABCDEF-01234
These are invalid:
ABC
999
AB-
-99
I couldn't figure out how to write the VER statement to enforce these rules (or if it's even possible), because the number of alphabetic characters preceding the hyphen isn't fixed, nor is the number of digits following the hyphen. Can anyone provide any guidance?
Joined: 01 Dec 2006 Posts: 717 Location: Pennsylvania
What I have done when the VER statement does not suit my needs is pass the value to an instream Rexx process.
This Rexx can be as complex as you need it.
If it is valid I set my valid return value to the original, otherwise I set it to something else.
I do a simple VER when I return.
See a small example here:
Code:
ED = 'ABC-1234'
*REXX (ED,VALSW)
IF ED = YADAYADA THEN VALSW = ED
ELSE VALSW = 'XXXXX'
*ENDREXX
VER (ED,NB,LISTV,&VALSW,MSG=SPECMSG)