Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
manipulating AlphaNumeric string

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

New User


Joined: 15 May 2006
Posts: 28

PostPosted: Wed Jun 14, 2006 11:51 am    Post subject: manipulating AlphaNumeric string
Reply with quote

i have a variable which has some string (ex:- 12345WE)

can anybody tell me a way How to check whether the last 2 characters of this string is ALPHANUMERIC or not.. (ex:- 12345WE)
Back to top
View user's profile Send private message

sunnyk

New User


Joined: 20 Oct 2004
Posts: 59

PostPosted: Wed Jun 14, 2006 1:16 pm    Post subject:
Reply with quote

By using Reference modification, move the last two chars to a new working storage variable and then check whether that new variable is > spaces. If yes, then last two chars of the string is ALPHANUMERIC else not.

Regds
Sunny
Back to top
View user's profile Send private message
venkatm99

New User


Joined: 01 Jun 2006
Posts: 23
Location: Sinagpore

PostPosted: Wed Jun 14, 2006 1:56 pm    Post subject: manipulating AlphaNumeric string
Reply with quote

hi

suppose alpha numeric varible length is 10 bytes.

01 ws-alpha pic x(10).

01 ws-alpha-r redefines ws-alpha.
05 ws-alpha-1 pic x(08).
o5 ws-alpha-2 pic 9(02).

If ws-alpha-2 is nureric
perform x
else
perform y
end-if

Hope it will clear ur doubt


cheers
venkat
Back to top
View user's profile Send private message
prodigy

New User


Joined: 15 May 2006
Posts: 28

PostPosted: Wed Jun 14, 2006 3:10 pm    Post subject: Re: manipulating AlphaNumeric string
Reply with quote

Hey thx guys for ur replies.... was useful
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Jun 25, 2006 1:40 am    Post subject:
Reply with quote

It's amazing how these "simple" ques can get complicated. Prodigy asked if you can test that the last 2 chars of a field are alphanuneric, but his example shows the last 2 chars as alphabetic.

Does he mean A or AN. My guess is that he meant A, else he would have used something like W6 as his last 2 chars. Also does he consider a space an alpha; the alpha class test does.

Anyway, I'd try:
Code:

IF HIS-FLD(n:2)    IS NOT ALPHABETIC
    OR 
   HIS-FLD(n:1)     = SPACE
    OR 
   HIS-FLD(n + 1:1) = SPACE
   DISPLAY 'FIELD IS NOT ALPHA AND/OR CONTAINS SPACES'
ELSE
   DISPLAY 'FIELD LOOKS OK TO ME'
END-IF
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Sun Jun 25, 2006 4:41 pm    Post subject:
Reply with quote

It gets even more complicated if the last 2 chars are not always in the same place.
The given example was '- 12345WE'. Now what happens if the value is '- 123WE' ?
Can this happen?
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm
No new posts change string before sertan string anatol DFSORT/ICETOOL 8 Tue Aug 15, 2017 5:43 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us