Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
cskakani

New User

Joined: 22 Dec 2003
Posts: 3

 Posted: Thu Mar 31, 2005 1:15 pm    Post subject: Check for HEXADECIMAL value in a string Hi, can any one tell me ...How do I check for HEXADECIMAL value in a string using COBOL ? Thanks Chandra.

mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Fri Apr 01, 2005 5:44 am    Post subject: 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.
cskakani

New User

Joined: 22 Dec 2003
Posts: 3

 Posted: Sat Apr 02, 2005 7:25 am    Post subject: Re: Check for HEXADECIMAL value in a string Hi Jack, Thanks for reply, could youplease expalin this with example? Thanks & Regards, Chandra.
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Sat Apr 02, 2005 7:36 am    Post subject: 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.
Great Indian

New User

Joined: 05 Apr 2005
Posts: 9

 Posted: Wed Apr 06, 2005 5:03 pm    Post subject: 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
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Sun Apr 10, 2005 12:37 am    Post subject: 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'.)
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics GDG gen check using REXX raghuraman123 CLIST & REXX 6 Wed Apr 18, 2018 9:18 pm Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am How syntax check at Bind time is diff... Poha Eater DB2 5 Wed Mar 21, 2018 9:16 pm Find a string in PS file opened in br... mukkas CLIST & REXX 3 Sat Feb 24, 2018 2:15 pm line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us