MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need to extract the only column values using sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
satyenderd
Beginner


Joined: 26 Aug 2005
Posts: 144
Topics: 73

PostPosted: Fri Jul 25, 2008 3:18 pm    Post subject: Need to extract the only column values using sort Reply with quote

Hi all,

Herein I have a input file, out of which I need only one particular column values in the output file.
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
BATCH    T  *     3 T0J0AJ7C     T0J0AJ7           013F 12618                   
******************************** Bottom of Data ********************************

In the above mentioned screenshot i want the coulum starting from 57 to 62. SORT FIELDS=(57,6,CH,A), as in the above screenshot it is 12618.

could anyone pls help me to extract only that column in the output file using the sort.

Many many thanks in advance.
_________________
Satya
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jul 25, 2008 3:33 pm    Post subject: Reply with quote

If you want to extract the data from 57 to 62 and SORT it, you can use these DFSORT control statements:

Code:

    INREC BUILD=(57,6)
    SORT FIELDS=(1,6,CH,A)


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
satyenderd
Beginner


Joined: 26 Aug 2005
Posts: 144
Topics: 73

PostPosted: Fri Jul 25, 2008 3:45 pm    Post subject: Reply with quote

Thousand thanks Frank.
_________________
Satya
Back to top
View user's profile Send private message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Tue Jul 29, 2008 5:28 am    Post subject: What would be the difference Reply with quote

Frank,

I've used the below code in SORT and got the same result.

Code:

OUTREC BUILD=(57,6)
SORT FIELDS=(1,6,CH,A)


So, what is the difference? Would you please explain?

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jul 29, 2008 10:40 am    Post subject: Reply with quote

Actually, that wouldn't give the same result. If you're getting the same result, then the test data you're using is probably not good enough to show the difference.

INREC is processed before SORT so:

Code:

    INREC BUILD=(57,6)
    SORT FIELDS=(1,6,CH,A)


would extract 57,6 into 1,6 and then sort on 1,6. So you would be reducing the records to 6 bytes before sorting but still sorting on the field that was in 57,6 in the input record.

OUTREC is processed after SORT so:

Code:

  OUTREC BUILD=(57,6)
  SORT FIELDS=(1,6,CH,A)


would sort on 1,6 and then extract 57,6 into 1,6. Here you're sorting on whatever happened to be in 1,6 of the input records rather than on 57,6. And you're not reducing the records before sorting.

If you want to use OUTREC, you would need:

Code:

  SORT FIELDS=(57,6,CH,A)
  OUTREC BUILD=(57,6)


This would sort on 57,6 in the input records and then extract 57,6 to 1,6. Again, you're not reducing the records before sorting.

Reducing the record length to 6 before sorting with INREC can be more efficient than sorting on the entire record.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
satyenderd
Beginner


Joined: 26 Aug 2005
Posts: 144
Topics: 73

PostPosted: Thu Jul 31, 2008 12:36 pm    Post subject: Reply with quote

Thanks to all of you for your suggestions.

Good Day.
_________________
Satya
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group