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 

Cartesian Join match using DFSORT Splice

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


Joined: 10 Dec 2005
Posts: 159
Topics: 75

PostPosted: Sat Apr 22, 2006 5:43 am    Post subject: Cartesian Join match using DFSORT Splice Reply with quote

1)
Code:

    1 22222
    2 33333
    2 44444
    2 55555
    3 66666
    5 77777

2)
Code:

    1             91
    2             82
    2             21
    3             73
    4             64
    5             45

result :
Code:

1   22222     91
2   33333     82
2   33333     21
2   44444     82
2   44444     21
2   55555     82
2   55555     21
3   66666     73
5   77777     45


B match with A,both B and A have duplicate. record in file(1 should match every record in file(2) Can this solved by splice?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Sat Apr 22, 2006 10:02 am    Post subject: Reply with quote

I believe that's a "cartesian join". I haven't been able to figure out a way to do that with SPLICE.
_________________
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
kolusu
Site Admin
Site Admin


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

PostPosted: Sat Apr 22, 2006 4:35 pm    Post subject: Reply with quote

issac1029,

The following DFSORT/ICETOOL JCL will give you the desired results provided that you have the PTFs UQ95214 and UQ95213 from dec 2004 installed which supports IFTHEN,BUILD and restart parms.

Assumptions:

1. Both the input files are of FB recfm and 80 Bytes Lrecl
2. Each key can have a max of 10 duplicates in both the files.

A brief explanation of the job.

1. The first COPY operator takes in file1 and adds key seq num at the end of every record using RESTART parm. Based on this keyseq number we use IFTHEN and arrange the contents.This is done to get 1 single record with all the possible values.

2. The Splice operatorr takes the output from the step1 copy and creates a single record. ie the output from the splice will be as follows

Code:

1 91
2 82 21
3 73
4 64
5 45


Notice the 2 duplicates of key "2" are clubbed as single record and both the values are side by side

3. Repeat step1 for the other file.

4. Repeat step2 for the other file. The output from this step will be

Code:

1 22222
2 33333 44444 55555
3 66666
5 77777


Notice the 3 duplicates of key "2" are clubbed as single record and the 3 values are side by side

5. Now we take the output of step2 and step4 and SPLICE once again so that we can join the records together.

Code:

1 22222             1 91
2 33333 44444 55555 2 82 21
3 66666             3 73
5 77777             5 45


Now using outfil we break the records in to the desired format.

6. The last COPY operator eliminates the unwanted records.


Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD *
1 91
2 82
2 21
3 73
4 64
5 45
//IN2      DD *
1 22222
2 33333
2 44444
2 55555
3 66666
5 77777
//TOOLIN   DD *
  COPY FROM(IN1) USING(CTL1)

  SPLICE FROM(T1) TO(T3) ON(1,1,CH) KEEPNODUPS   -
  WITHEACH WITH(73,3) WITH(76,3)                 -
  WITH(79,3) WITH(82,3) WITH(85,3) WITH(88,3)    -
  WITH(91,3) WITH(94,3) WITH(97,3) USING(CTL2)

  COPY FROM(IN2) USING(CTL3)

  SPLICE FROM(T2) TO(T4) ON(1,1,CH) KEEPNODUPS   -
  WITHEACH WITH(9,6) WITH(15,6)                  -
  WITH(21,6) WITH(27,6) WITH(33,6) WITH(39,6)    -
  WITH(45,6) WITH(51,6) WITH(57,6) USING(CTL4)

  SPLICE FROM(CON) TO(T5) ON(1,1,CH) KEEPNODUPS  -
  WITHALL WITH(70,3) WITH(73,3) WITH(76,3)       -
  WITH(79,3) WITH(82,3) WITH(85,3) WITH(88,3)    -
  WITH(91,3) WITH(94,3) WITH(97,3) USING(CTL5)

  COPY FROM(T5) USING(CTL6)

//T1       DD DSN=&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//T2       DD DSN=&T2,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//T3       DD DSN=&T3,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//T4       DD DSN=&T4,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//T5       DD DSN=&T5,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//CON      DD DSN=&T4,VOL=REF=*.T4,DISP=OLD
//         DD DSN=&T3,VOL=REF=*.T3,DISP=OLD
//OUT      DD SYSOUT=*
//CTL1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,1))
  OUTREC IFTHEN=(WHEN=(81,8,ZD,EQ,+1),
         BUILD=(1:1,2,70:3,3,27X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+2),
         BUILD=(1:1,2,70:03X,73:3,3,24X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+3),
         BUILD=(1:1,2,70:06X,76:3,3,21X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+4),
         BUILD=(1:1,2,70:09X,79:3,3,18X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+5),
         BUILD=(1:1,2,70:12X,82:3,3,15X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+6),
         BUILD=(1:1,2,70:15X,85:3,3,12X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+7),
         BUILD=(1:1,2,70:18X,88:3,3,09X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+8),
         BUILD=(1:1,2,70:21X,91:3,3,06X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+9),
         BUILD=(1:1,2,70:24X,94:3,3,03X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+10),
         BUILD=(1:1,2,70:27X,97:3,3))
  OUTFIL FNAMES=T1
//CTL2CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(1,1,CH,A)
  OUTFIL FNAMES=T3
//CTL3CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,1))
  OUTREC IFTHEN=(WHEN=(81,8,ZD,EQ,+1),
         BUILD=(1:1,2,03:03,6,99:X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+2),
         BUILD=(1:1,2,03:06X,09:3,6,48X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+3),
         BUILD=(1:1,2,03:12X,15:3,6,42X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+4),
         BUILD=(1:1,2,03:18X,21:3,6,36X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+5),
         BUILD=(1:1,2,03:24X,27:3,6,30X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+6),
         BUILD=(1:1,2,03:30X,33:3,6,24X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+7),
         BUILD=(1:1,2,03:36X,39:3,6,18X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+8),
         BUILD=(1:1,2,03:42X,45:3,6,12X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+9),
         BUILD=(1:1,2,03:48X,51:3,6,06X)),
         IFTHEN=(WHEN=(81,8,ZD,EQ,+10),
         BUILD=(1:1,2,03:54X,57:3,6))
  OUTFIL FNAMES=T2
//CTL4CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(1,1,CH,A)
  OUTFIL FNAMES=T4
//CTL5CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(1,1,CH,A)
  OUTFIL FNAMES=T5,
  OUTREC=(1,2,03,6,70,3,80:X,/,
          1,2,03,6,73,3,80:X,/,
          1,2,03,6,76,3,80:X,/,
          1,2,03,6,79,3,80:X,/,
          1,2,03,6,82,3,80:X,/,
          1,2,03,6,85,3,80:X,/,
          1,2,03,6,88,3,80:X,/,
          1,2,03,6,91,3,80:X,/,
          1,2,03,6,94,3,80:X,/,
          1,2,03,6,97,3,80:X,/,

          1,2,09,6,70,3,80:X,/,
          1,2,09,6,73,3,80:X,/,
          1,2,09,6,76,3,80:X,/,
          1,2,09,6,79,3,80:X,/,
          1,2,09,6,82,3,80:X,/,
          1,2,09,6,85,3,80:X,/,
          1,2,09,6,88,3,80:X,/,
          1,2,09,6,91,3,80:X,/,
          1,2,09,6,94,3,80:X,/,
          1,2,09,6,97,3,80:X,/,

          1,2,15,6,70,3,80:X,/,
          1,2,15,6,73,3,80:X,/,
          1,2,15,6,76,3,80:X,/,
          1,2,15,6,79,3,80:X,/,
          1,2,15,6,82,3,80:X,/,
          1,2,15,6,85,3,80:X,/,
          1,2,15,6,88,3,80:X,/,
          1,2,15,6,91,3,80:X,/,
          1,2,15,6,94,3,80:X,/,
          1,2,15,6,97,3,80:X,/,

          1,2,21,6,70,3,80:X,/,
          1,2,21,6,73,3,80:X,/,
          1,2,21,6,76,3,80:X,/,
          1,2,21,6,79,3,80:X,/,
          1,2,21,6,82,3,80:X,/,
          1,2,21,6,85,3,80:X,/,
          1,2,21,6,88,3,80:X,/,
          1,2,21,6,91,3,80:X,/,
          1,2,21,6,94,3,80:X,/,
          1,2,21,6,97,3,80:X,/,

          1,2,27,6,70,3,80:X,/,
          1,2,27,6,73,3,80:X,/,
          1,2,27,6,76,3,80:X,/,
          1,2,27,6,79,3,80:X,/,
          1,2,27,6,82,3,80:X,/,
          1,2,27,6,85,3,80:X,/,
          1,2,27,6,88,3,80:X,/,
          1,2,27,6,91,3,80:X,/,
          1,2,27,6,94,3,80:X,/,
          1,2,27,6,97,3,80:X,/,

          1,2,33,6,70,3,80:X,/,
          1,2,33,6,73,3,80:X,/,
          1,2,33,6,76,3,80:X,/,
          1,2,33,6,79,3,80:X,/,
          1,2,33,6,82,3,80:X,/,
          1,2,33,6,85,3,80:X,/,
          1,2,33,6,88,3,80:X,/,
          1,2,33,6,91,3,80:X,/,
          1,2,33,6,94,3,80:X,/,
          1,2,33,6,97,3,80:X,/,

          1,2,39,6,70,3,80:X,/,
          1,2,39,6,73,3,80:X,/,
          1,2,39,6,76,3,80:X,/,
          1,2,39,6,79,3,80:X,/,
          1,2,39,6,82,3,80:X,/,
          1,2,39,6,85,3,80:X,/,
          1,2,39,6,88,3,80:X,/,
          1,2,39,6,91,3,80:X,/,
          1,2,39,6,94,3,80:X,/,
          1,2,39,6,97,3,80:X,/,

          1,2,45,6,70,3,80:X,/,
          1,2,45,6,73,3,80:X,/,
          1,2,45,6,76,3,80:X,/,
          1,2,45,6,79,3,80:X,/,
          1,2,45,6,82,3,80:X,/,
          1,2,45,6,85,3,80:X,/,
          1,2,45,6,88,3,80:X,/,
          1,2,45,6,91,3,80:X,/,
          1,2,45,6,94,3,80:X,/,
          1,2,45,6,97,3,80:X,/,

          1,2,51,6,70,3,80:X,/,
          1,2,51,6,73,3,80:X,/,
          1,2,51,6,76,3,80:X,/,
          1,2,51,6,79,3,80:X,/,
          1,2,51,6,82,3,80:X,/,
          1,2,51,6,85,3,80:X,/,
          1,2,51,6,88,3,80:X,/,
          1,2,51,6,91,3,80:X,/,
          1,2,51,6,94,3,80:X,/,
          1,2,51,6,97,3,80:X,/,

          1,2,57,6,70,3,80:X,/,
          1,2,57,6,73,3,80:X,/,
          1,2,57,6,76,3,80:X,/,
          1,2,57,6,79,3,80:X,/,
          1,2,57,6,82,3,80:X,/,
          1,2,57,6,85,3,80:X,/,
          1,2,57,6,88,3,80:X,/,
          1,2,57,6,91,3,80:X,/,
          1,2,57,6,94,3,80:X,/,
          1,2,57,6,97,3,80:X)

//CTL6CNTL DD *
  OMIT COND=(3,5,CH,EQ,C' ',OR,10,3,CH,EQ,C' ')
  OUTFIL FNAMES=OUT
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

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: Mon Apr 24, 2006 1:19 pm    Post subject: Reply with quote

Kolusu,

Very clever. 8)

Kind of tedious to code all those statements, but it does work.

Here's a little less tedious version. I removed various redundant operands:

Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD *
1 91
2 82
2 21
3 73
4 64
5 45
//IN2      DD *
1 22222
2 33333
2 44444
2 55555
3 66666
5 77777
//TOOLIN   DD *
  COPY FROM(IN1) TO(T1) USING(CTL1)

  SPLICE FROM(T1) TO(T3) ON(1,1,CH) KEEPNODUPS   -
  WITHEACH WITH(73,3) WITH(76,3)                 -
  WITH(79,3) WITH(82,3) WITH(85,3) WITH(88,3)    -
  WITH(91,3) WITH(94,3) WITH(97,3)

  COPY FROM(IN2) TO(T2) USING(CTL3)

  SPLICE FROM(T2) TO(T4) ON(1,1,CH) KEEPNODUPS   -
  WITHEACH WITH(9,6) WITH(15,6)                  -
  WITH(21,6) WITH(27,6) WITH(33,6) WITH(39,6)    -
  WITH(45,6) WITH(51,6) WITH(57,6)

  SPLICE FROM(CON) TO(T5) ON(1,1,CH) KEEPNODUPS  -
  WITHALL WITH(70,3) WITH(73,3) WITH(76,3)       -
  WITH(79,3) WITH(82,3) WITH(85,3) WITH(88,3)    -
  WITH(91,3) WITH(94,3) WITH(97,3) USING(CTL5)

  COPY FROM(T5) TO(OUT) USING(CTL6)

//T1       DD DSN=&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//T2       DD DSN=&T2,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//T3       DD DSN=&T3,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//T4       DD DSN=&T4,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//T5       DD DSN=&T5,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//CON      DD DSN=&T4,VOL=REF=*.T4,DISP=OLD
//         DD DSN=&T3,VOL=REF=*.T3,DISP=OLD
//OUT DD DSN=&&O1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CTL1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,1))
  OUTREC IFOUTLEN=99,
    IFTHEN=(WHEN=(81,8,ZD,EQ,+1),
      BUILD=(1:1,1,70:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+2),
      BUILD=(1:1,2,73:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+3),
      BUILD=(1:1,2,76:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+4),
      BUILD=(1:1,2,79:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+5),
      BUILD=(1:1,2,82:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+6),
      BUILD=(1:1,2,85:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+7),
      BUILD=(1:1,2,88:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+8),
      BUILD=(1:1,2,91:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+9),
      BUILD=(1:1,2,94:3,3)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+10),
      BUILD=(1:1,2,97:3,3))
//CTL3CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,1))
  OUTREC IFOUTLEN=99,
    IFTHEN=(WHEN=(81,8,ZD,EQ,+1),
      BUILD=(1:1,2,3:03,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+2),
      BUILD=(1:1,2,9:3,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+3),
      BUILD=(1:1,2,15:3,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+4),
      BUILD=(1:1,2,21:3,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+5),
      BUILD=(1:1,2,27:3,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+6),
      BUILD=(1:1,2,33:3,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+7),
      BUILD=(1:1,2,39:3,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+8),
      BUILD=(1:1,2,45:3,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+9),
      BUILD=(1:1,2,51:3,6)),
    IFTHEN=(WHEN=(81,8,ZD,EQ,+10),
      BUILD=(1:1,2,57:3,6))
//CTL5CNTL DD *
  OUTFIL FNAMES=T5,
  OUTREC=(1,2,3,6,70,3,80:X,/,
          1,2,3,6,73,3,/,
          1,2,3,6,76,3,/,
          1,2,3,6,79,3,/,
          1,2,3,6,82,3,/,
          1,2,3,6,85,3,/,
          1,2,3,6,88,3,/,
          1,2,3,6,91,3,/,
          1,2,3,6,94,3,/,
          1,2,3,6,97,3,/,

          1,2,9,6,70,3,/,
          1,2,9,6,73,3,/,
          1,2,9,6,76,3,/,
          1,2,9,6,79,3,/,
          1,2,9,6,82,3,/,
          1,2,9,6,85,3,/,
          1,2,9,6,88,3,/,
          1,2,9,6,91,3,/,
          1,2,9,6,94,3,/,
          1,2,9,6,97,3,/,

          1,2,15,6,70,3,/,
          1,2,15,6,73,3,/,
          1,2,15,6,76,3,/,
          1,2,15,6,79,3,/,
          1,2,15,6,82,3,/,
          1,2,15,6,85,3,/,
          1,2,15,6,88,3,/,
          1,2,15,6,91,3,/,
          1,2,15,6,94,3,/,
          1,2,15,6,97,3,/,

          1,2,21,6,70,3,/,
          1,2,21,6,73,3,/,
          1,2,21,6,76,3,/,
          1,2,21,6,79,3,/,
          1,2,21,6,82,3,/,
          1,2,21,6,85,3,/,
          1,2,21,6,88,3,/,
          1,2,21,6,91,3,/,
          1,2,21,6,94,3,/,
          1,2,21,6,97,3,/,

          1,2,27,6,70,3,/,
          1,2,27,6,73,3,/,
          1,2,27,6,76,3,/,
          1,2,27,6,79,3,/,
          1,2,27,6,82,3,/,
          1,2,27,6,85,3,/,
          1,2,27,6,88,3,/,
          1,2,27,6,91,3,/,
          1,2,27,6,94,3,/,
          1,2,27,6,97,3,/,

          1,2,33,6,70,3,/,
          1,2,33,6,73,3,/,
          1,2,33,6,76,3,/,
          1,2,33,6,79,3,/,
          1,2,33,6,82,3,/,
          1,2,33,6,85,3,/,
          1,2,33,6,88,3,/,
          1,2,33,6,91,3,/,
          1,2,33,6,94,3,/,
          1,2,33,6,97,3,/,

          1,2,39,6,70,3,/,
          1,2,39,6,73,3,/,
          1,2,39,6,76,3,/,
          1,2,39,6,79,3,/,
          1,2,39,6,82,3,/,
          1,2,39,6,85,3,/,
          1,2,39,6,88,3,/,
          1,2,39,6,91,3,/,
          1,2,39,6,94,3,/,
          1,2,39,6,97,3,/,

          1,2,45,6,70,3,/,
          1,2,45,6,73,3,/,
          1,2,45,6,76,3,/,
          1,2,45,6,79,3,/,
          1,2,45,6,82,3,/,
          1,2,45,6,85,3,/,
          1,2,45,6,88,3,/,
          1,2,45,6,91,3,/,
          1,2,45,6,94,3,/,
          1,2,45,6,97,3,/,

          1,2,51,6,70,3,/,
          1,2,51,6,73,3,/,
          1,2,51,6,76,3,/,
          1,2,51,6,79,3,/,
          1,2,51,6,82,3,/,
          1,2,51,6,85,3,/,
          1,2,51,6,88,3,/,
          1,2,51,6,91,3,/,
          1,2,51,6,94,3,/,
          1,2,51,6,97,3,/,

          1,2,57,6,70,3,/,
          1,2,57,6,73,3,/,
          1,2,57,6,76,3,/,
          1,2,57,6,79,3,/,
          1,2,57,6,82,3,/,
          1,2,57,6,85,3,/,
          1,2,57,6,88,3,/,
          1,2,57,6,91,3,/,
          1,2,57,6,94,3,/,
          1,2,57,6,97,3)

//CTL6CNTL DD *
  OMIT COND=(3,5,CH,EQ,C' ',OR,9,3,CH,EQ,C' ')
/*

_________________
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
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Fri Nov 20, 2009 1:44 pm    Post subject: Reply with quote

With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), DFSORT now supports the JOINKEYS function which can do this kind of thing much more easily. For example:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//IN1      DD *
1 22222
2 33333
2 44444
2 55555
3 66666
5 77777
//IN2      DD *
1             91
2             82
2             21
3             73
4             64
5             45
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  JOINKEYS F1=IN1,FIELDS=(1,1,A)
  JOINKEYS F2=IN2,FIELDS=(1,1,A)
  REFORMAT FIELDS=(F1:1,14,F2:15,2)
  OPTION COPY
/*


SORTOUT would have:

Code:

1 22222       91     
2 33333       82     
2 33333       21     
2 44444       82     
2 44444       21     
2 55555       82     
2 55555       21     
3 66666       73     
5 77777       45     

_________________
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
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