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
 
How to find the value is numeric or alphanumeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: How to find the value is numeric or alphanumeric
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

Site Director


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

PostPosted: Wed Mar 28, 2007 2:18 am    Post subject:
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    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Wed Mar 28, 2007 3:13 am    Post subject:
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    Post subject:
Reply with quote

ok sir.....

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

Site Director


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

PostPosted: Wed Mar 28, 2007 3:54 am    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Wed Mar 28, 2007 4:22 am    Post subject:
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

Site Director


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

PostPosted: Wed Mar 28, 2007 5:20 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Command to find TMEMBER name for a TPIPE Siva NKK Kothamasu IMS DB/DC 0 Wed Aug 16, 2017 6:08 pm

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