For Programmers: Free Programming Magazines  


Home > Archive > Cobol > September 2004 > Initializing a char using ASCII value in COBOL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Initializing a char using ASCII value in COBOL
Type-D

2004-09-02, 3:55 pm

Hi people!

What I'm trying to do is very simple, but I just can't figure it out
since I'm not too good with COBOL. I have a set of characters that
must not be found in a particular string. I know how to search a
string and all, but my problem is that I receive the ASCII values of
these characters and I can't seem to find a way to convert them back
to chars (pic x) efficiently!? What I'm looking to do exactly is
something like this piece of "C" code does:

int iSomeChar = 64;
char cThisChar = iSomeChar;

Since ASCII for 0064 is "@", cThisChar now has the value "@". It's so
simple that I even feel dumb asking. Thanks a lot for your help,

Type-D
Chuck Stevens

2004-09-02, 3:55 pm

Would the intrinsic function "CHAR" meet your needs?

-Chuck Stevens

"Type-D" <b18cspecr@yahoo.ca> wrote in message
news:ebdca0cf.0408261240.1f740a03@posting.google.com...
> Hi people!
>
> What I'm trying to do is very simple, but I just can't figure it out
> since I'm not too good with COBOL. I have a set of characters that
> must not be found in a particular string. I know how to search a
> string and all, but my problem is that I receive the ASCII values of
> these characters and I can't seem to find a way to convert them back
> to chars (pic x) efficiently!? What I'm looking to do exactly is
> something like this piece of "C" code does:
>
> int iSomeChar = 64;
> char cThisChar = iSomeChar;
>
> Since ASCII for 0064 is "@", cThisChar now has the value "@". It's so
> simple that I even feel dumb asking. Thanks a lot for your help,
>
> Type-D



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com