View previous topic :: View next topic
|
Author |
Message |
Anil Kumar Govindula
New User
Joined: 06 Aug 2008 Posts: 9 Location: India
|
|
|
|
Hello friends,
Are there any special characters which are NOT allowed in a alphanumeric field in COBOL?
I've searched in google but couldn't find proper answer. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Nope, not a one. An alphanumeric, PICTURE X, can contain any bit value from zero to 255, with ease.
So can numerics, for that matter. You may well have trouble with using it, but they can contain any of those bit values previously mentioned.
I've a feeling there is a deeper question lurking behind this... |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Anil Kumar Govindula wrote: |
Hello friends,
Are there any special characters which are NOT allowed in a alphanumeric field in COBOL?
I've searched in google but couldn't find proper answer. |
You did not Google hard enough; this manual page definitely states
Quote: |
The content of alphanumeric literals, comment lines, and comment entries can include any of the characters in the computer's compile-time character set, and can include both single-byte and DBCS characters.
|
I recommend that you save the link to the Application Development Help Center (languages and tools), and not rely on Googled information of questionable accuracy. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
this will probably be a good read for you: E-Cobol Programmers Guide
afterwards, download E-COBOL Language Reference
so that you have a handy reference as you code.
If you are not using Enterprise Cobol, then there are 'buttons' at the top of the page for manuals. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Are you attempting to eliminate and replace unwanted characters from a given COBOL field?
This can be done easily with an INSPECT CONVERTING, using a 256-byte FROM table consisting of X'00' through X'FF' values and a 256-byte TO table (initialized to SPACES) and then populated with the byte-values you want to keep. All other byte-values are converted to SPACE.
For example, in the TO table, you want to keep all NUMERICS, 0-9, so you move bytes 241 through 250 of the FROM table to bytes 241 through 250 of the TO table, before issuing the INSPECT.
Same concept applies to upper and lower-case letters and other "keepers".... |
|
Back to top |
|
|
|