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 

DFSORT help ??

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


Joined: 30 Jun 2009
Posts: 8
Topics: 3

PostPosted: Mon Oct 26, 2009 5:53 pm    Post subject: DFSORT help ?? Reply with quote

I have an input with the below data and i want the output to be as below

95001 92001 ABC 2007-01-01 -- ?
95001 92001 DEF 2007-01-01 2008-10-01
95001 92001 DEF 2008-10-01 2009-10-01
95001 92001 DEF 2009-10-01 -- ?

Output should be

95001 92001 ABC 2007-01-01 -- ?
95001 92001 DEF 2007-01-01 -- ?

the first two fields are the keys along with the third field. If all the keys are matched then i need only one record in the output but the dates should be Min date and the max date. If the end date is given as blank then i need it to be blank as shown in the above output. Assume that the file is 80 byte long
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: Mon Oct 26, 2009 6:36 pm    Post subject: Reply with quote

Your "rules" have holes and your example is not very good.

Quote:
If all the keys are matched then i need only one record in the output but the dates should be Min date and the max date.


You show an example with the Min date, but not with the Max date.

Quote:
If the end date is given as blank then i need it to be blank as shown in the above output.


You show an input example where one of the end dates for the three records with the same keys is blank and the output record has blank. Do you want a blank for the end date if any of the end dates is blank? And is the field really blank or does it have '--' or what?

Please show a better example of input and expected output for all relevant variations. Give the starting position, length and format for each relevant field. Show what a "blank end date" really looks like. Please use code tags around your records so we can see what they really look like.
_________________
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
gopurs
Beginner


Joined: 30 Jun 2009
Posts: 8
Topics: 3

PostPosted: Mon Oct 26, 2009 9:04 pm    Post subject: Reply with quote

Example 1

Input
Code:

95001 92001 ABC 2007-01-01                  ?
95001 92001 DEF 2007-01-01 2008-10-01
95001 92001 DEF 2008-10-01 2009-10-01
95001 92001 DEF 2009-10-01                   ?

Output should be
Code:

95001 92001 ABC 2007-01-01           ?
95001 92001 DEF 2007-01-01            ?

Example 2

Input
Code:

95001 92001 ABC 2007-01-01            ?
95001 92001 DEF 2008-10-01 2009-10-01

Output should be
Code:

95001 92001 ABC 2007-01-01                 ?
95001 92001 DEF 2008-10-01 2009-10-01

key1 - 1 to length of 5
key2 7 to length of 4 (packed decimal)
typ 13 to length of 3
begin date 17 to length of 10
end date 28 to length of 10
end-date null indicator pos 38

All the fields are character fields except key2. It is a packed decimal field(PD) for a length of 4 bytes. Blank end date will be 10 spaces.

As far as I know there cannot be two open end dates for a particular key(3 fields together) combination.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Oct 27, 2009 11:43 am    Post subject: Reply with quote

gopurs,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=your input 38 byte file,DISP=SHR                               
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(39:28,10)),                 
  IFTHEN=(WHEN=(38,1,CH,EQ,C'?'),OVERLAY=(39:C'9999-12-31'))   
                                                               
  SORT FIELDS=(1,5,CH,A,7,4,PD,A,13,3,CH,A,                   
               17,10,CH,A,39,10,CH,A),EQUALS                   
                                                               
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(49:SEQNUM,8,ZD)),         
  IFTHEN=(WHEN=GROUP,BEGIN=(49,8,ZD,EQ,1),PUSH=(57:17,10))     
                                                               
  OUTFIL REMOVECC,NODETAIL,BUILD=(38X),                       
  SECTIONS=(1,15,                                             
  TRAILER3=(1,16,57,10,X,28,11))                               
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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