View previous topic :: View next topic
|
Author |
Message |
sprikitik
New User
Joined: 29 Jan 2007 Posts: 61 Location: Makati City, Philippines
|
|
|
|
My screen has a single editable field which is 3 characters length. The valid values that can be entered is +1 to +99 or -1 to -99.
Possible valid combi are:
+1_
_+1
+99
-1_
_-8
and so on, as long as the numeric part is 1 to 99 and the sign is at the left, if no sign was provided, the default sign will be + (positive). So if i entered 1, the screen will be updated and will display +1_..
How do i do the validation such a way that the following values will be rejected?
1+_
99+
_1+
99-
and so on...
The idea is that the sign should always be at the left side of number and if no sign is provided, the sign will default to +
Thank you! |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
sprikitik
New User
Joined: 29 Jan 2007 Posts: 61 Location: Makati City, Philippines
|
|
|
|
Yes i did, but the pgm is abending when the value is invalid. For example 99+
Thanks! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
If you truly insist on rejecting the invalid values, you'll need to write your own routine to validate the field -- check right to left for a plus or minus before a digit, for example.
BIF DEEDIT converts 99+ into 099 but it doesn't give you any option to recognize the invalid format -- you just get the numeric data value back. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
sprikitik wrote: |
Yes i did, but the pgm is abending when the value is invalid. For example 99+ |
99+ seems to match:
Code: |
___ Format 2: argument-1, monetary format ________________________________________________________
| |
| >>__ _______ __ _digit__ ______________ _ __ _______ __ ____ __ _______ ______________________>< |
| |_space_| | |_.__ _______ _| | |_space_| |_ +_| |_space_| |
| | |_digit_| | |_ -_| |
| |_.__digit________________| |_CR_| |
| |_DB_| |
| |
|__________________________________________________________________________________________________|
|
What does your NUMVAL look like?
What do the data areas look like? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Interesting ... I used this code:
Code: |
05 NUMVAL-CHAR PIC X(03) VALUE '99+'.
05 NUMVAL-NUMBER PIC S9(03) SIGN LEADING SEPARATE.
/
PROCEDURE DIVISION.
S1000-MAIN SECTION.
COMPUTE NUMVAL-NUMBER = FUNCTION NUMVAL (NUMVAL-CHAR) .
DISPLAY 'NUMVAL-CHAR ' NUMVAL-CHAR.
DISPLAY 'NUMVAL-NUMBER ' NUMVAL-NUMBER. |
and got these results:
Code: |
NUMVAL-CHAR 99+
NUMVAL-NUMBER +099 |
so I'm not sure why your program would ABEND on known good data. |
|
Back to top |
|
|
|