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

Converting a character field to numeric in sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Wed Jun 30, 2010 2:41 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jun 30, 2010 3:04 pm
Reply with quote

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
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Wed Jun 30, 2010 3:10 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jun 30, 2010 3:26 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Jun 30, 2010 6:30 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jun 30, 2010 8:17 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jun 30, 2010 10:05 pm
Reply with quote

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
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top