View previous topic :: View next topic |
Author |
Message |
tempuser Beginner
Joined: 05 Oct 2005 Posts: 28 Topics: 20 Location: INDORE
|
Posted: Mon Oct 08, 2007 7:00 am Post subject: How to validate the data for the amount field? |
|
|
Hi,
I am having a flat file with length 80.The amount position is defined as length 10.
The file is built by some non techie people and we need to upload this to our files.For this we need to do a valudation on the fields.Can some one tell me the procedure for validation in COBOL.
The valid values are 123456.89
12,456.80
$12345.66
.66
the invalid value are .666.
Thanks
Tempuser |
|
Back to top |
|
 |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Mon Oct 08, 2007 7:12 am Post subject: |
|
|
tempuser,
Please provide the pic value for the field you are validating for? Or is it for multiple fields? ".666" is invalid meaning precision you are lookiing for is 2 digits right?
This can be done using a combination of inspect and tallying. But Inspect works only for alphanumeric fields.
Vivek G _________________ Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay) |
|
Back to top |
|
 |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
|
Back to top |
|
 |
tempuser Beginner
Joined: 05 Oct 2005 Posts: 28 Topics: 20 Location: INDORE
|
Posted: Mon Oct 08, 2007 8:10 am Post subject: |
|
|
Vivek,
Thanks for the reply.As I informed the file is being provided by some Non Technical people.So there is a need to do the validation of the amount field.The PIC value is for the valid amount field is 9(8)v9(2).Means if they provide the value other than this ,We need to reject that value.
But they might enter the values some thing like
123456.89
12,456.80
$12345.66
.66
Thease to be considered as valid one.If they supply the value more than 10 in length or with 3 decimal fields,that need to be rejected.
The other thing is ,we need to use only INDEX and PERFORM .The INSPECT verb is not allowed.
Thanks
tempuser |
|
Back to top |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Mon Oct 08, 2007 8:19 am Post subject: |
|
|
See the NUMVAL and NUMVAL-C intrinsic functions in the Programming Guide. _________________ ....Terry |
|
Back to top |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Mon Oct 08, 2007 9:24 am Post subject: |
|
|
tempuser wrote: | The other thing is ,we need to use only INDEX and PERFORM .The INSPECT verb is not allowed. | Mmmmmm
A simple inline perform loop with reference modification would allow you to do all the validation you want.
It would be easier (and quicker) to just NUMVAL-C to larger numeric field and check for boundry conditions. |
|
Back to top |
|
 |
|
|