IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

VER statement help sought


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
David Sde

New User


Joined: 24 Apr 2011
Posts: 23
Location: USA

PostPosted: Mon May 05, 2014 9:51 pm
Reply with quote

Hi,

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?

Thanks so much,

David
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon May 05, 2014 10:08 pm
Reply with quote

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)
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon May 05, 2014 11:12 pm
Reply with quote

here is a snippet to check for Your formats

Code:

 ****** ***************************** Top of Data ******************************
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace "O"
 000005
 000006 line.1 = "ABC-123"
 000007 line.2 = "ABC"
 000008 line.3 = "123"
 000009 line.4 = "ABC-"
 000010 line.5 = "-123"
 000011 line.6 = "AB -123"
 000012 line.7 = "ABC- 23"
 000013 line.8 = "abc-123"
 000014 line.9 = "ABC-1"
 000015 line.0 = 9
 000016
 000017 do l = 1 to line.0
 000018    err = valid
 000019    do 1
 000020       if pos(" ", line.l) > 0 then do
 000021          err = "Embedded blanks"
 000022          leave
 000023       end
 000024
 000025       if pos("-", line.l) = 0 then do
 000026          err = "missing '-'"
 000027          leave
 000028       end
 000029
 000030       parse var line.l alf "-" num
 000031
 000032       if alf = ""  then do
 000033          err = "missing alf"
 000034          leave
 000035       end
 000036
 000037       if num = ""  then do
 000038          err = "missing num"
 000039          leave
 000040       end
 000041
 000042       if \datatype(alf,"U")  then do
 000043          err = "not upper case"
 000044          leave
 000045       end
 000046
 000047       if \datatype(num,"N")  then do
 000048          err = "not numeric"
 000049          leave
 000050       end
 000051
 000052    end
 000053
 000054    say right(l,2) left(line.l, 20) err
 000055
 000056 end
 000057
 000058 Exit 0
 000059
 ****** **************************** Bottom of Data ****************************



the result


Code:

  1 ABC-123              VALID
  2 ABC                  missing '-'
  3 123                  missing '-'
  4 ABC-                 missing num
  5 -123                 missing alf
  6 AB -123              Embedded blanks
  7 ABC- 23              Embedded blanks
  8 abc-123              not upper case
  9 ABC-1                VALID
 ***
Back to top
View user's profile Send private message
David Sde

New User


Joined: 24 Apr 2011
Posts: 23
Location: USA

PostPosted: Mon May 05, 2014 11:35 pm
Reply with quote

Many thanks to both of you; this is great!

David
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts process statement for SUPREC, CMPCOLM... TSO/ISPF 4
No new posts SYNCSORT/ICETOOL JOINKEYS SORT Statem... DFSORT/ICETOOL 13
No new posts DFDSS COPY using Filter REFDT statement JCL & VSAM 2
Search our Forums:

Back to Top