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 

Sort on Dates with Spaces

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


Joined: 21 Mar 2006
Posts: 2
Topics: 1

PostPosted: Thu Jan 18, 2007 11:43 am    Post subject: Sort on Dates with Spaces Reply with quote

Hi,

I need to sort the file with following records. Effdate is spaces for XLC and Termdate is spaces for NBS which i have shown as ' '

policy(1-9) Trans(10to13)Effdate(14 to 21)Termdate(22 to 29)

Code:

----+----1----+----2----+----3

111111111XLC         01012000
111111111XLC         09012000
111111111NBS 01012000         
111111111NBS 09012000         


output should be
Code:

----+----1----+----2----+----3
111111111XLC         01012000
111111111NBS 01012000       
111111111XLC         09012000
111111111NBS 09012000       

Kindly help
_________________
Regards,
Ravi
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Thu Jan 18, 2007 12:31 pm    Post subject: Reply with quote

i have used bbcode to repost the question.

policy(1-9) Trans(10to13)Effdate(14 to 21)Termdate(22 to 29)

Code:

----+----1----+----2----+----3

111111111XLC         01012000
111111111XLC         09012000
111111111NBS 01012000         
111111111NBS 09012000         


output should be
Code:

111111111XLC         01012000
111111111NBS 01012000
111111111XLC         09012000
111111111NBS 09012000


is this correct?

and your keys are:
  • PRIMARY
    • 22-29 ascending IF (10-13) = XLC
    • 14-21 ascending IF (10-13) = NBS
  • SECONDARY > 10-10 descending

???
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
waitling
Beginner


Joined: 12 Dec 2006
Posts: 15
Topics: 3

PostPosted: Sun Jan 21, 2007 1:09 am    Post subject: Reply with quote

TRY
Code:

//SYSIN  DD *
 INREC IFTHEN=(WHEN=(10,3,CH,EQ,C'XLC'),
               OVERLAY=(30:SEQNUM,5,ZD,START=1,INCR=2)),
       IFTHEN=(WHEN=NONE,
               OVERLAY=(30:SEQNUM,5,ZD,START=2,INCR=2))
 SORT  FIELDS=(30,5,ZD,A)
 OUTREC BUILD=(1,29)
/*
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: Sun Jan 21, 2007 11:50 am    Post subject: Reply with quote

Ravi,

Although it's not clear what exactly you want since you didn't respond to Dick's question, I'll assume that for each date you want the XLC record before the NBS record. Here's a DFSORT job that will do that. I added some extra input records for a better test.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
111111111XLC         01012000
111111111XLC         99999999
111111111XLC         09012000
111111111XLC         00000000
111111111NBS 01012000
111111111NBS 99999999
111111111NBS 09012000
111111111NBS 00000000
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=(10,3,CH,EQ,C'XLC'),
                OVERLAY=(81:22,8,C'1')),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(81:14,8,C'2'))
  SORT  FIELDS=(81,9,ZD,A)
  OUTREC BUILD=(1,80)
/*


SORTOUT would have:

Code:

111111111XLC         00000000           
111111111NBS 00000000                   
111111111XLC         01012000           
111111111NBS 01012000                   
111111111XLC         09012000           
111111111NBS 09012000                   
111111111XLC         99999999           
111111111NBS 99999999                   


Note that Waitling's statements assume that the XLC values are in the correct order and are followed by the NBS values in the same order. My statements don't make that assumption.
_________________
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
ravikaushik
Beginner


Joined: 21 Mar 2006
Posts: 2
Topics: 1

PostPosted: Tue Jan 23, 2007 1:02 pm    Post subject: Reply with quote

Sorry Guys that i didn't get back to you as i got busy with the problem fixing.

Dick, what you quoted is correct and thats what i wanted.

Frank and waitling thanks for your response i will try this one today.
_________________
Regards,
Ravi
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