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 Help in Sort JCL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
waves
Beginner


Joined: 09 Nov 2006
Posts: 35
Topics: 12

PostPosted: Sat Oct 06, 2007 4:09 am    Post subject: Need Help in Sort JCL Reply with quote

The following is my requirement:

i need to sort the input file based on two fields such as SSN(social security number) in ascending order and the Timestamp on descending order. please help in this regard.

SSN-- X(9)
Timestamp--X(14)
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Sat Oct 06, 2007 4:19 am    Post subject: SORT FIELDS syntax Reply with quote

what location within the record are the two fields?

SORT FIELDS=(pos,length,type,order,pos,len,type,order)

order is A for decending and D for decending.

so, if ssn is in position 11 and timestamp is in position 87:
SORT FIELDS=(11,9,CH,A,87,14,CH,D)

a better title would have been: syntax for SORT FIELDS.

no one will beable to search the forum and find your post as an example of SORT FIELDS syntax.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
waves
Beginner


Joined: 09 Nov 2006
Posts: 35
Topics: 12

PostPosted: Sat Oct 06, 2007 4:25 am    Post subject: Reply with quote

thanks for ur valuable reply.

SSN number is at 1st position

Time stamp is at 260th position
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12383
Topics: 75
Location: San Jose

PostPosted: Sat Oct 06, 2007 9:16 am    Post subject: Reply with quote

waves,
Try this


Code:

  SORT FIELDS=(001,09,CH,A,    $ sort on ssn  asc
               260,26,CH,D)    $ sort on timestamp desc


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Sat Oct 06, 2007 1:53 pm    Post subject: Reply with quote

waves,

This is pretty basic stuff. 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
waves
Beginner


Joined: 09 Nov 2006
Posts: 35
Topics: 12

PostPosted: Wed Oct 10, 2007 10:35 am    Post subject: Reply with quote

Thanks a lot Kolusu and Frank.

I need to do the same sort in COBOL program.

i have an input file which has the SSN number, First name, Last name, Timestamp etc. as some of its columns.

i need to sort the input file so that i get the latest record from the input file based on the Timestamp.

In this case, the first sort was done on the SSN number,first name and last name in Ascending order and then the Timestamp in the descending order.

the second sort was done on the SSN Number, First name and Last name, so that all the duplicates will be removed giving SUM FIELDS = NONE.

the final out put file will contain the Latest record. These things i have done in thru JCL.

the same has to be done in the COBOL Program. please i need help how to do the same in COBOL.

please correct me if i'm wrong.

We are using SYNCSORT Product.

Thanks in Advance.
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Thu Oct 11, 2007 1:39 am    Post subject: Reply with quote

waves,

You can do the same in COBOL. Refer the quick manuals link to get a hold of sorting in COBOL.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.12?DT=20020923143836
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
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 -> Job Control Language(JCL) 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