View previous topic :: View next topic
|
Author |
Message |
devvs Currently Banned New User
Joined: 26 Mar 2007 Posts: 5 Location: Bangalore
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
devvs Currently Banned New User
Joined: 26 Mar 2007 Posts: 5 Location: Bangalore
|
|
|
|
we got it passed thru a calling module |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 I'll check back later this evening for follow-up. |
|
Back to top |
|
|
devvs Currently Banned New User
Joined: 26 Mar 2007 Posts: 5 Location: Bangalore
|
|
|
|
ok sir.....
thnx |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
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 |
|
|
devvs Currently Banned New User
Joined: 26 Mar 2007 Posts: 5 Location: Bangalore
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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".... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 [/code] |
|
Back to top |
|
|
|