View previous topic :: View next topic |
Author |
Message |
cobcurious Beginner

Joined: 04 Oct 2003 Posts: 68 Topics: 25
|
Posted: Fri Oct 12, 2007 8:54 am Post subject: Identifying nature of a field |
|
|
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 |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Fri Oct 12, 2007 8:58 am Post subject: |
|
|
Yes, figuring your program knows that X in a numeric field and Y is alpha-numeric..... |
|
Back to top |
|
 |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Mon Oct 15, 2007 4:29 am Post subject: |
|
|
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 |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Fri Oct 19, 2007 6:14 am Post subject: |
|
|
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 |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Fri Oct 19, 2007 3:44 pm Post subject: |
|
|
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 |
|
 |
|
|