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 

Identifying nature of a field

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


Joined: 04 Oct 2003
Posts: 68
Topics: 25

PostPosted: Fri Oct 12, 2007 8:54 am    Post subject: Identifying nature of a field Reply with quote

Hi,

I have a requirement to generate different set of statments depending upon the nature of the field. By nature, I mean whether the field is declared as numeric like PIC 9 or alphanumeric like PIC X.

e.g 01 X PIC 9.
01 Y PIC XX.

My COBOL program should generate statements like :
IF X NUMERIC
.....

IF Y IS NOT ALHABETIC
....

Is it possible in COBOL to do so?

Thanks
Tushar Johri
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Fri Oct 12, 2007 8:58 am    Post subject: Reply with quote

Yes, figuring your program knows that X in a numeric field and Y is alpha-numeric.....
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Mon Oct 15, 2007 4:29 am    Post subject: Reply with quote

cobcurious,

Quote:

My COBOL program should generate statements like :


I am not clear what "Generate" means in this context. Can u explain in detail what u are trying to accomplish?
_________________
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
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Fri Oct 19, 2007 6:14 am    Post subject: Reply with quote

cobcurious,
I am not clear with your question. Do you want to check for a field if it is numeric or alphabetic? If so, you can use IS NUMERIC clause. This returns true of the field is numeric and false if it is alphabetic.
Back to top
View user's profile Send private message Send e-mail
Terry_Heinze
Supermod


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

PostPosted: Fri Oct 19, 2007 3:44 pm    Post subject: Reply with quote

I think Tushar wants his COBOL program to be able to "see" the USAGE (PICTURE) definition of a data item. The answer to that would be "no". Once compiled, the program can only test for values, classes, etc. See the IF statement in the language reference manual.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
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