MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to validate the data for the amount field?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
tempuser
Beginner


Joined: 05 Oct 2005
Posts: 28
Topics: 20
Location: INDORE

PostPosted: Mon Oct 08, 2007 7:00 am    Post subject: How to validate the data for the amount field? Reply with quote

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
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Mon Oct 08, 2007 7:12 am    Post subject: Reply with quote

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
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Mon Oct 08, 2007 7:18 am    Post subject: Reply with quote

tempuser,

Forgot one thing. You are also make use of EDIT fields in COBOL.

Check the below link :

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.3.2?SHELF=&DT=20020923143836&CASE=
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
tempuser
Beginner


Joined: 05 Oct 2005
Posts: 28
Topics: 20
Location: INDORE

PostPosted: Mon Oct 08, 2007 8:10 am    Post subject: Reply with quote

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
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Mon Oct 08, 2007 8:19 am    Post subject: Reply with quote

See the NUMVAL and NUMVAL-C intrinsic functions in the Programming Guide.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Mon Oct 08, 2007 9:24 am    Post subject: Reply with quote

tempuser wrote:
The other thing is ,we need to use only INDEX and PERFORM .The INSPECT verb is not allowed.
Mmmmmm Rolling Eyes
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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group