Page 1 of 1

Need only numeric records using dfsort commands

PostPosted: Wed Jan 19, 2011 12:42 pm
by bhaki14
Hi ,

In my file, there are 100 records.
In those, 50 are alphanumeric and 50 are numeric.
Here, i need only numeric ones using dfsort commands.
So, how would i do it ?
Suggestions are appreciated.


Thanks,
Bhanu.

Re: Suggesstions need

PostPosted: Wed Jan 19, 2011 3:20 pm
by NicC
have you checked out any of the sort documentation - links are in other posts within this section. I believe someone asked this sort of question a week or so ago - suggest you search through, as you should already have done, and see if you can find the post.

Re: Suggesstions need

PostPosted: Thu Jan 20, 2011 12:06 am
by Frank Yaeger
Bhanu,

You need to give more information about what exactly you're trying to do.

What is the RECFM and LRECL of the input file?

What is the starting position and length of the field that can be numeric or alphanumeric?

Does numeric mean it only has characters 0-9, whereas alphanumeric has anything else?

Please show an example of the records in your input file and what you expect for output.

Re: Need only numeric records using dfsort commands

PostPosted: Fri Jan 21, 2011 7:56 am
by bhaki14
Hey, thanks for the reply.

RECFM : FB
LREC : 100
All parameters are same for both input and output datasets.

//sysin dd *
sort fields=copy
include=(100,1,ch,eq,c' y ')
outrec fields=(1,3,97x)

Through the above conditions, i got like this.

aed
juk
456
trf
uji
987
eer
yji
kki
338
259
kop

Now my requirement is, i want only the numeric records in my output dataset.
Or else, numeric records in one dataset and alphanumeric in another dataset.

Re: Need only numeric records using dfsort commands

PostPosted: Fri Jan 21, 2011 11:09 pm
by Frank Yaeger
I asked
What is the starting position and length of the field that can be numeric or alphanumeric?


You didn't give me that information.

You show an INCLUDE with 100,1 which would imply that the field starts at position 100, but you show an example which implies that the field is in positions 1-3. It would be much easier to help you if you gave complete and clear information (especially when asked).

At any rate, you can select fields with only numerics using DFSORT's NUM function, e.g.

    INCLUDE COND=(1,3,FS,EQ,NUM)


For more information, see the "Check for a numeric string" Smart DFSORT Trick at:

http://www.ibm.com/support/docview.wss? ... g3T7000094