Page 1 of 2

need help to check numeric check

PostPosted: Mon Sep 14, 2015 6:38 pm
by gvenkateshmca
Hi All,

I have defined one field as alphanumeric and need to check numeric validations .i am not able to check below numeric valiations

if user entered 1b2 (b blank = space) it should not allow it should give erorr, but in my case it is considering as 012 as I am using BIF DEEDIT function
can you please let me know how to error out in this case

Thanks
Venkat

Re: need help to check numeric check

PostPosted: Mon Sep 14, 2015 7:59 pm
by BillyBoyo
Don't "de-edit" it. Or at least not until it is validated.

Re: need help to check numeric check

PostPosted: Tue Sep 15, 2015 9:19 am
by gvenkateshmca
I need to edit for the leading zeroes if user entered 1 it should display as 001

Re: need help to check numeric check

PostPosted: Tue Sep 15, 2015 12:26 pm
by BillyBoyo
You don't need to de-edit for that. And read what I wrote. If you do feel you "need" to do it, do it after the validation.

Re: need help to check numeric check

PostPosted: Tue Sep 15, 2015 1:31 pm
by gvenkateshmca
Thanks for your suggestions , I need help for validating the below cases
The input field defined as Character x(03)
user entered
bb1 (b blank) ---- it should convert to 001
b1b --- it should convert to 001
bb1 ---- it should convert to 001
1bb ---- it should convert to 001
1b1 ---- it should rejected-error
any character or special character in this field it should reject.

Re: need help to check numeric check

PostPosted: Tue Sep 15, 2015 3:37 pm
by NicC
What language are you using? I believe COBOL has a NUMERIC or ISNUMERIC BIF to check if a value is numeric.

Re: need help to check numeric check

PostPosted: Tue Sep 15, 2015 4:02 pm
by gvenkateshmca
I am using Cobol and if I use is numeric for that field it won't accept as this has spaces.
i am not sure about the ISNUMERIC BIF can you please give some expample.

Re: need help to check numeric check

PostPosted: Tue Sep 15, 2015 4:41 pm
by BillyBoyo
If you define the input field as numeric, it'll help.

Re: need help to check numeric check

PostPosted: Tue Sep 15, 2015 5:00 pm
by gvenkateshmca
I have declared as numeric and tested still i am getting error when user entered bb0 it should accept this value and should display as 000 ,
And also if i enter bb1 it shuould not give error it should be 001 .
User has entered full 3 bytes are numeric then only it will accept other it won't,

In need to accept all these cases
b1 (b blank) ---- it should convert to 001
b1b --- it should convert to 001
bb1 ---- it should convert to 001
1bb ---- it should convert to 001
1b1 ---- it should rejected-error

Re: need help to check numeric check

PostPosted: Tue Sep 15, 2015 7:20 pm
by Robert Sample
So you will need to check each character individually -- either using reference modification or by moving the variable to a redefined variable. Are you sure your variable is getting spaces -- usually CICS uses LOW-VALUES for screen variables? Your error checking code using reference modification should be something along the lines of
IF  VARI (1 : 1) >= '0' AND VARI (2 : 1) = SPACE AND VARI (3 : 1) >= '0'
    <handle the error>
ELSE
    IF (VARI (1 : 1) > SPACE AND < '0') OR (VARI (2 : 1) > SPACE AND < '0') OR (VARI (3 : 1) > SPACE AND < '0')
        <handle non-numeric data>
    ELSE
        <use BIF DEEDIT on the variable>
    END-IF
END-IF