IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SPLICE option in DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Iratxe

New User


Joined: 21 Feb 2006
Posts: 24

PostPosted: Tue Jun 17, 2008 3:39 pm
Reply with quote

I´ve got two files, the first one is the master and the second is the conditioner.

File1
Code:

XX  NI10000001A  XXXXX  XX  NI40000007G  XXXXX
XX  NI10000002B  XXXXX  XX  NI50000009I  XXXXX
XX  NI20000003C  XXXXX  XX  NI20000004D  XXXXX
XX  NI20000004D  XXXXX  XX  NI50000010J  XXXXX
XX  NI30000005E  XXXXX  XX  NI10000001A  XXXXX
XX  NI30000006F  XXXXX  XX  NI40000008H  XXXXX
XX  NI40000007G  XXXXX  XX  NI30000005E  XXXXX

File2
Code:

YYYY  NI10000002B  YYYYYYYY
YYYY  NI20000003C  YYYYYYYY
YYYY  NI20000004D  YYYYYYYY
YYYY  NI40000008H  YYYYYYYY
YYYY  NI50000010J  YYYYYYYY


Now, when NI* from file1 is equal to NI* from file2 I obtain an output OUT1 like this:
Code:

YYYY NI50000009I YYYYYYYY
YYYY NI50000010J YYYYYYYY


For those that don´t match I obtain another output out2 like this:
Code:

YYYY NOEXISTEENT YYYYYYYY
YYYY NOEXISTEENT YYYYYYYY


For all this I using this icetool:
Code:

//PASOUT01 EXEC PGM=ICETOOL                                       
//TOOLMSG DD SYSOUT=*                                             
//DFSMSG DD SYSOUT=*                                               
//IN1    DD DSN=SIC.DESA.SEC.FICH.MAESTRO,DISP=SHR                 
//IN2    DD DSN=SIC.DESA.SEC.FICH.CONDICI,DISP=SHR                 
//TMP1   DD DSN=SIC.DESA.WRK.TMP1,DISP=OLD                         
//TMP2   DD DSN=SIC.DESA.WRK.TMP2,DISP=OLD                         
//CONCAT DD DSN=SIC.DESA.WRK.TMP2,VOL=REF=*.TMP2,DISP=(OLD,PASS)   
//       DD DSN=SIC.DESA.WRK.TMP1,VOL=REF=*.TMP1,DISP=(OLD,PASS)   
//TMP3   DD DSN=SIC.DESA.WRK.TMP3,DISP=OLD                         
//TMP4   DD DSN=SIC.DESA.WRK.TMP4,DISP=OLD                         
//OUT1   DD DSN=SIC.DESA.SEC.FICH.MATCH,DISP=OLD                   
//OUT2   DD DSN=SIC.DESA.SEC.FICH.NOMATCH,DISP=OLD                 
//TOOLIN DD *                                                     
  COPY FROM(IN1) TO(TMP1) USING(SEL1)                             
  COPY FROM(IN2) TO(TMP2) USING(SEL2)                             
  SELECT FROM(CONCAT) TO(TMP3) ON(9,11,CH) ALLDUPS                 
  SELECT FROM(CONCAT) TO(TMP4) ON(9,11,CH) NODUPS                 
  SPLICE FROM(TMP3) TO(OUT1) ON(9,11,CH) WITH(9,11) WITH(33,11) - 
         USING(SEL3)                                                   
  SORT FROM(TMP4) TO(OUT2) USING(SEL4)                                 
/*                                                                     
//SEL1CNTL DD *                                                       
  OUTREC FIELDS=(C'01  ',1,76)                                         
/*                                                                     
//SEL2CNTL DD *                                                       
  OUTREC FIELDS=(C'02',1,78)                                           
/*                                                                     
//SEL3CNTL DD *                                                       
  SORT FIELDS=(9,11,CH,A)                                             
  OPTION EQUALS                                                       
  OUTFIL FNAMES=OUT1,OUTREC=(3,6,33,11,20,7,56X)                       
/*                                                                     
//SEL4CNTL DD *                                                       
  SORT FIELDS=(9,11,CH,A)                                             
  OUTFIL FNAMES=OUT2,                                                 
          INCLUDE=(1,2,CH,EQ,C'02'),                                   
          OUTREC=(3,6,C'NOEXISTEENT',18,63)           
/*                                                   
//*                                                   


Now, my problem appears when I´ve got dups in the conditioner file (file2). I don´t know how I can manage with this.
The new files are like this:
File1:
Code:

XX  NI10000001A  XXXXX  XX  NI40000007G  XXXXX
XX  NI10000002B  XXXXX  XX  NI50000009I  XXXXX
XX  NI20000003C  XXXXX  XX  NI20000004D  XXXXX
XX  NI20000004D  XXXXX  XX  NI50000010J  XXXXX
XX  NI30000005E  XXXXX  XX  NI10000001A  XXXXX
XX  NI30000006F  XXXXX  XX  NI40000008H  XXXXX
XX  NI40000007G  XXXXX  XX  NI30000005E  XXXXX

File2:
Code:

YYYY  NI10000002B  YYYYYYYY
YYYY  NI10000002B  YYYYYYYY
YYYY  NI10000002B  YYYYYYYY
YYYY  NI10000002B  YYYYYYYY
YYYY  NI20000003C  YYYYYYYY
YYYY  NI20000004D  YYYYYYYY
YYYY  NI40000008H  YYYYYYYY
YYYY  NI50000010J  YYYYYYYY

and out1 should be like this:
OUT1 like this:
Code:

YYYY NI50000009I YYYYYYYY
YYYY NI50000009I YYYYYYYY
YYYY NI50000009I YYYYYYYY
YYYY NI50000009I YYYYYYYY
YYYY NI50000010J YYYYYYYY


Can SPLICE solve this for me?

Thanks very much,

Iratxe
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 17, 2008 9:55 pm
Reply with quote

Iratxe,

We can reduce the number of passes to get the desired results. Please answer the following questions

1. What is the LRECL and RECFM of both input and output files
2. What is the position, format and length of the key in both files
3. Can the key have duplicates in any of the files?
Back to top
View user's profile Send private message
Iratxe

New User


Joined: 21 Feb 2006
Posts: 24

PostPosted: Wed Jun 18, 2008 1:31 pm
Reply with quote

Hello,

Here you have:

1. What is the LRECL and RECFM of both input and output files
LRECL=80 RECFM=FB
2. What is the position, format and length of the key in both files
Position=9 Format=CH Length=11
3. Can the key have duplicates in any of the files?
Only in the second one (File 2).

Thanks very much,
Iratxe
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 18, 2008 10:00 pm
Reply with quote

Iratxe,

The following DFSORT/JCL will give you the desired results. I assumed that the filed you want to pick from file1 is at pos 33 for by 11 bytes


Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN1      DD *                                             
----+----1----+----2----+----3----+----4----+----5----+----6-
XX      NI10000001A  XXXXX  XX  NI40000007G  XXXXX           
XX      NI10000002B  XXXXX  XX  NI50000009I  XXXXX           
XX      NI20000003C  XXXXX  XX  NI20000004D  XXXXX           
XX      NI20000004D  XXXXX  XX  NI50000010J  XXXXX           
XX      NI30000005E  XXXXX  XX  NI10000001A  XXXXX           
XX      NI30000006F  XXXXX  XX  NI40000008H  XXXXX           
XX      NI40000007G  XXXXX  XX  NI30000005E  XXXXX           
//IN2      DD *                                             
YYYY    NI10000002B  YYYYYYYY                               
YYYY    NI10000002B  YYYYYYYY                               
YYYY    NI20000003C  YYYYYYYY                               
YYYY    NI20000004D  YYYYYYYY                               
YYYY    NI40000008H  YYYYYYYY                               
YYYY    NI50000010J  YYYYYYYY                               
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT1     DD SYSOUT=*                                       
//OUT2     DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  COPY FROM(IN1) USING(CTL1)                                 
  COPY FROM(IN2) USING(CTL2)                                 
  SPLICE FROM(T1) TO(OUT1) ON(9,11,CH) KEEPNODUPS -         
  WITHALL WITH(01,80) WITH(93,1) USING(CTL3)                 
//CTL1CNTL DD *                                             
  OUTFIL FNAMES=T1,BUILD=(9:9,11,81:33,11,C'11')             
//CTL2CNTL DD *                                             
  OUTFIL FNAMES=T1,OVERLAY=(81:11X,C'22')                   
//CTL3CNTL DD *                                             
  OUTFIL FNAMES=OUT1,INCLUDE=(92,2,CH,EQ,C'12'),             
  BUILD=(1,8,9:81,11,20,60)                                 
  OUTFIL FNAMES=OUT2,INCLUDE=(92,2,CH,EQ,C'22'),             
  BUILD=(1,8,C'NONEXISTENT',20,60)                           
/*                                                           


The output from this job is

out1 file:
Code:

YYYY    NI50000009I  YYYYYYYY
YYYY    NI50000009I  YYYYYYYY
YYYY    NI20000004D  YYYYYYYY
YYYY    NI50000010J  YYYYYYYY


Out2 file
Code:

YYYY    NONEXISTENT  YYYYYYYY
YYYY    NONEXISTENT  YYYYYYYY
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts SCOPE PENDING option -check data DB2 2
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top