Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Check for HEXADECIMAL value in a string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
cskakani

New User


Joined: 22 Dec 2003
Posts: 3

PostPosted: Thu Mar 31, 2005 1:15 pm    Post subject: Check for HEXADECIMAL value in a string
Reply with quote

Hi, can any one tell me ...How do I check for HEXADECIMAL value in a string using COBOL ?

Thanks
Chandra.
Back to top
View user's profile Send private message

mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Apr 01, 2005 5:44 am    Post subject:
Reply with quote

Hi Chandra,

By the way you phrased the ques I assume you know how to check for an A/N value in a string.

Use: IF STRING(POS) = X'C2' etc.

But I'm guessing there's more to your ques than you let on.
Back to top
View user's profile Send private message
cskakani

New User


Joined: 22 Dec 2003
Posts: 3

PostPosted: Sat Apr 02, 2005 7:25 am    Post subject: Re: Check for HEXADECIMAL value in a string
Reply with quote

Hi Jack,
Thanks for reply, could youplease expalin this with example?

Thanks & Regards,
Chandra.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Apr 02, 2005 7:36 am    Post subject:
Reply with quote

Hi Chandra,

You'll have to explain what you're trying to do in detail.
What's your I/P look like, what are you looking for, what do you intend to do with it when you find it? Don't spare the details.
Back to top
View user's profile Send private message
Great Indian

New User


Joined: 05 Apr 2005
Posts: 9

PostPosted: Wed Apr 06, 2005 5:03 pm    Post subject:
Reply with quote

Hi Chandra,
You can check HEXADECIMAL value in a string using COBOL.

Here is the code go thru it:-

WORKING-STORAGE SECTION.
01 WS-CH PIC X(05) VALUE 'RAO'.
PROCEDURE DIVISION.
MAINPARA.
IF WS-CH(2:1) = X'C1' THEN
DISPLAY 'HEXA DECIMAL'
ELSE
DISPLAY 'NOT IN HEXA DECIMAL'
END-IF.
STOP RUN.

Hexa decimal values for alphabets are:
A C1
B C2
C C3
D C4
E C5
F C6
G C7
H C8
I C9
J D1
K D2
.........like this....
Z E9
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Apr 10, 2005 12:37 am    Post subject:
Reply with quote

Hi GI,

Have to disagree w/your IF stmt. If WS-CH(2:1) is X'00' it's still hex (every byte is hex), it's just not X'C1" (or anything else except X'00'.)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us