need help to check numeric check



Support for C, C++, COBOL, PL/I, Fortran and assembler applications' runtime Environment LE.

need help to check numeric check

Postby gvenkateshmca » Mon Sep 14, 2015 6:38 pm

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
gvenkateshmca
 
Posts: 10
Joined: Mon Mar 23, 2015 6:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: need help to check numeric check

Postby BillyBoyo » Mon Sep 14, 2015 7:59 pm

Don't "de-edit" it. Or at least not until it is validated.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: need help to check numeric check

Postby gvenkateshmca » Tue Sep 15, 2015 9:19 am

I need to edit for the leading zeroes if user entered 1 it should display as 001
gvenkateshmca
 
Posts: 10
Joined: Mon Mar 23, 2015 6:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: need help to check numeric check

Postby BillyBoyo » Tue Sep 15, 2015 12:26 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: need help to check numeric check

Postby gvenkateshmca » Tue Sep 15, 2015 1:31 pm

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.
gvenkateshmca
 
Posts: 10
Joined: Mon Mar 23, 2015 6:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: need help to check numeric check

Postby NicC » Tue Sep 15, 2015 3:37 pm

What language are you using? I believe COBOL has a NUMERIC or ISNUMERIC BIF to check if a value is numeric.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: need help to check numeric check

Postby gvenkateshmca » Tue Sep 15, 2015 4:02 pm

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.
gvenkateshmca
 
Posts: 10
Joined: Mon Mar 23, 2015 6:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: need help to check numeric check

Postby BillyBoyo » Tue Sep 15, 2015 4:41 pm

If you define the input field as numeric, it'll help.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: need help to check numeric check

Postby gvenkateshmca » Tue Sep 15, 2015 5:00 pm

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
gvenkateshmca
 
Posts: 10
Joined: Mon Mar 23, 2015 6:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: need help to check numeric check

Postby Robert Sample » Tue Sep 15, 2015 7:20 pm

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
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Next

Return to Language Environment