View previous topic :: View next topic
|
Author |
Message |
shchan
New User
Joined: 06 Jun 2007 Posts: 58 Location: Hyderabad
|
|
|
|
Hi,
I have the following requirement:
I need to extract a file form an input file based on a specific condition.But the input file has some character data which I want to convert to numeric.How can I achieve this?
The following is the sort card iam using:
Code: |
OPTION COPY
INCLUDE COND=((171,3,CH,EQ,C'ZZZ',AND,223,4,CH,EQ,C'ABCD'),
OR,(171,3,CH,EQ,C'P11',AND,223,4,CH,EQ,C'EFGH'))
OUTFIL FNAMES=SORTOUT,VTOF,
OUTREC=(1:247,15,16:227,15) |
The characters in the out file should be converted to numeric. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Quote: |
The characters in the out file should be converted to numeric. |
...and have you any rules regarding how the conversion should be achieved? Do you want any numeric value or is there a specific correlation between characters and numbers?
Garry. |
|
Back to top |
|
|
shchan
New User
Joined: 06 Jun 2007 Posts: 58 Location: Hyderabad
|
|
|
|
No, I have to use the out file in another program to search these records in anotherfile.As the out file is containing character data and Iam comparing it in my program with numeric data Iam getting a Soc7.I want to avoid this by converting the data in the out file to numeric type. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
I can't see how just making the characters numeric can be of any benefit. What if you change every nonumeric character to the number '1' - how does that help you? There are 26+ different characters that are non-numeric and, if you just change them randomly, how can you do any valid comparison.
You shouldn't use any means possible to avoid a S0C7 abend - you need to fix the data properly or amned the program to do an character compare.
Garry. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
shchan wrote: |
But the input file has some character data which I want to convert to numeric.How can I achieve this? |
Can you be a little less helpful?
What needs to be converted?
Provide more details...... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I want to avoid this by converting the data in the out file to numeric type. |
The proper resolution is to have the process that creates the data fixed. . .
If you arbitrarily change some values to "something numeric" you have created a much worse situation than the 0c7. Anything that uses this "patched up" data will produce corrupt results and should not be used for anything needed by the organization. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Code: |
OUTREC=(1:247,15,16:227,15) |
Quote: |
The characters in the out file should be converted to numeric. |
Sigh.
The OUTREC operand will give you an output record with the bytes in positions 247,15 and 227,15. We have no idea what those bytes look like in the input record or what you want them to look like in the output record, so how do you expect us to help you? We can't read your mind.
If you want to convert the bytes in 247,15 to numeric, you have to show what they look like in the input record and what you want them to look like in the output record. Likewise for the bytes in 227,15. |
|
Back to top |
|
|
|