IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to find the value is numeric or alphanumeric


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
devvs
Currently Banned

New User


Joined: 26 Mar 2007
Posts: 5
Location: Bangalore

PostPosted: Wed Mar 28, 2007 1:58 am
Reply with quote

Hi,

An unknown value was pass in a cobol program.We dont know whether it's a numeric or alphanumeric or alphabetic value....
so i want to how can we know the nature of the value passed in the program???


Thanx in Advance
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 28, 2007 2:18 am
Reply with quote

Hello,

How was it passed? Did it come from a PARM statement in the JCL or from a calling module?

If it came from a JCL PARM, the length is provided.

Wherever it came from, there must be a linkage-section to handle the parm. Your code can process the parm data byte by byte and determine what kind of content is there.

Pretty much anything that is not known to be of a certain format should be defined as PIC X. When you use the PIC X data, you will not get a s0c7. How far you take the analysis of the PARM data depends on how much code you want to write. You could identify groups of numbers, keywords, positional parameters used by the program, etc.

If you clarify your request, we may have better suggestions.
Back to top
View user's profile Send private message
devvs
Currently Banned

New User


Joined: 26 Mar 2007
Posts: 5
Location: Bangalore

PostPosted: Wed Mar 28, 2007 3:03 am
Reply with quote

we got it passed thru a calling module
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 28, 2007 3:13 am
Reply with quote

Hello,

Ok, a calling program "passed" it.

So, now what is the question?

Until you more clearly define your request, it will be very difficult to provide feedback.

What i think i understand so far it that you don't know what it is or where it came from (other than some calling program). What is your called program supposed to do with the parm info when it is called?

Keep in mind that while your question is completely clear to you, it is not clear to everyone else icon_smile.gif I'll check back later this evening for follow-up.
Back to top
View user's profile Send private message
devvs
Currently Banned

New User


Joined: 26 Mar 2007
Posts: 5
Location: Bangalore

PostPosted: Wed Mar 28, 2007 3:15 am
Reply with quote

ok sir.....

thnx
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 28, 2007 3:54 am
Reply with quote

You're welcome icon_smile.gif

I'm not sure we've provided much help on this question, but we're here if you'd like to provide some more detail.

Good luck.
Back to top
View user's profile Send private message
devvs
Currently Banned

New User


Joined: 26 Mar 2007
Posts: 5
Location: Bangalore

PostPosted: Wed Mar 28, 2007 4:03 am
Reply with quote

Really i dont know much ..i was asked in an interview and i can remember this much only that " if an unknown value is somehow passed then how can u test whether it's a numeric or alphanumeric or alphabetic value??"


i tried 2 answer them by saying about USAGE clause Display that if a numeric value is passed with USAGE DISPLAY then inspite of getting EBCDIC value we get ASCII value.....

was i correct???

plzz help me out
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Mar 28, 2007 4:22 am
Reply with quote

devvs wrote:
"if an unknown value is somehow passed then how can u test whether it's a numeric or alphanumeric or alphabetic value??"
COBOL has a Class condition test that can answer you question. Of course, this assumes that you have the length of the unknown data, because if "they" are throwing data that you can not identify where it ends, "BOOM".... icon_lol.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 28, 2007 5:20 am
Reply with quote

Hello,

I'm not sure, but my guess is that they were looking for a response that said something about using an IF to see if the value was a number. Something like:

Code:
IF PARM-VALUE NOT NUMERIC


where PARM-VALUE would be the name of the field in your program's LinkageSection.

On the mainframe, it is rather uncommon to work with ASCII. Any translation is usually done before the data reaches mainframe COBOL code.

We're here if/when you have more questions icon_smile.gif [/code]
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Convert HEX to Numeric DB2 3
No new posts Find the occurrence of Key Field (Par... DFSORT/ICETOOL 6
Search our Forums:

Back to Top