On Tue, 12 Jun 2007 16:16:59 -0400, Lizette Koehler wrote:

>Maybe I am not clear myself on what ISPF can do in the PANEL options.
>
>I have a field on my Selection Panel.  It has SR01 and ER01 (Starting Range
and Ending Range) that are to be UCB addresses.  This field is EBCDIC though
the numbers are Hex in nature.  I am trying to validate that the field
entered is a range from 0000-FFFF and that the Ending Range is not smaller
than the starting range.
>
>I would enter 30FF for a valid UCB Address (not x'30ff' but c'30ff').  I
like letting the panel do as much of the work as possible.  But I am not yet
ready to jump into using REXX in the panel.

It's a classic problem found in any situation where you are trying to
manipulate hex values as character strings. In EBCDIC, the byte values for
the characters A-F are lower than those for the numbers 0-9. In ASCII they
are higher, so sorting hex numbers-as-strings works fine. You can see the
problem using anything that compares strings, e.g. sort in ISPF EDIT.

The classic way around it is to translate one or both ranges to something
else, e.g. 0-9 could become lower case a-j for sorting and comparison
purposes. Then you have to retranslate for display. Or perhaps you don't
have to sort; maybe you are just checking ranges or the like. In this case
you can convert just for the compares.

There is one other common gotcha that will surely eventually bite you if you
decide to use REXX to work with hex values in strings. One day one of your
UCBs will be something like 30E0, and you will compare it to say 1000, and
30E0 will be less! This is because REXX treats 30E0 as 30*10**0, or 30. You
have to use the == operator rather than simple = to force strong comparison.

But that's not (yet) your problem here.

Tony H.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to