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

How to retain duplicates in the o/p file using SPLICE opertr


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

New User


Joined: 03 May 2007
Posts: 20
Location: bangalore

PostPosted: Mon Sep 01, 2008 5:57 pm
Reply with quote

Hi All,

I have two Input files both having same record length of 160. The common keys on which ICETOOL should compare these two files are not located in same column positions (i.e., On 1st file it is from 147 - 148 and on the second fil it is from 1 - 2). After comparison I want the matching records to be in one file and non matching records to be in other file. I also want to retain the duplicates of both matching and non-matching records in the output files.

Lets take the foll scenario:

Infile1 :
At positon 147-148 (binary)
10
10
10
10
10
20
30

Infile 2:
At positon 1-2 (binary)
10
25

The expected output files are:
OUTFILE1:
10
10
10
10
10

OUTFILE1:
20
30

The outfiles got with the following job are:
OUTFILE1:
10

OUTFILE2:
10
10
10
10
20
30

Below is the job i am currently using:
Code:

//STEP01   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//QTR1FILE DD DSN=INFILE1,DISP=OLD
//RT7CLSCD DD DSN=INFILE2,DISP=OLD
//OUT1     DD DSN=OUTFILE1,
//            SPACE=(CYL,(10,10),RLSE),
//            DISP=(,CATLG,CATLG)
//OUT2     DD DSN=OUTFILE2,
//            SPACE=(CYL,(10,10),RLSE),
//            DISP=(,CATLG,CATLG)
//T1       DD DSN=&&T1,DISP=(MOD,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))
//TOOLIN   DD *
  COPY FROM(QTR1FILE) TO(T1) USING(CTL1)
  COPY FROM(RT7CLSCD) TO(T1) USING(CTL4)
  SPLICE FROM(T1) TO(OUT1) ON(147,2,BI) WITHALL -
  WITH(182,1) KEEPNODUPS  USING(CTL5)
/*
//CTL1CNTL DD *
* MARK FILE1 RECORDS WITH '11'
  OUTREC FIELDS=(1,160,181:C'11')
/*
//CTL4CNTL DD *
* MARK FILE2 RECORDS WITH '44'
  OUTREC FIELDS=(147:1,2,181:C'44')
/*
//CTL5CNTL DD *
* WRITE MATCHING RECORDS TO OUT12 FILE.  REMOVE ID.
  OUTFIL FNAMES=OUT1,INCLUDE=(181,2,CH,EQ,C'14'),OUTREC=(1,160)
* WRITE FILE1 ONLY RECORDS TO OUT1 FILE.  REMOVE ID.
  OUTFIL FNAMES=OUT2,INCLUDE=(181,2,CH,EQ,C'11'),OUTREC=(1,160)
/*
//OUT      DD SYSOUT=*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Sep 01, 2008 11:22 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//QTR1FILE DD DSN=INFILE1,DISP=OLD
//RT7CLSCD DD DSN=INFILE2,DISP=OLD
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1     DD DSN=OUTFILE1,
//            SPACE=(CYL,(10,10),RLSE),
//            DISP=(,CATLG,CATLG)
//OUT2     DD DSN=OUTFILE2,
//            SPACE=(CYL,(10,10),RLSE),
//            DISP=(,CATLG,CATLG)
//TOOLIN DD *
COPY FROM(RT7CLSCD) TO(T1) USING(CTL1)
COPY FROM(QTR1FILE1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(147,2,BI) KEEPBASE KEEPNODUPS -
  WITHALL WITH(1,161) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(147:1,2,161:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(161:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(161,2,CH,EQ,C'VB'),
    BUILD=(1,160)
  OUTFIL FNAMES=OUT2,INCLUDE=(161,2,CH,EQ,C'VV'),
    BUILD=(1,160)
/*
Back to top
View user's profile Send private message
obulisankar

New User


Joined: 03 May 2007
Posts: 20
Location: bangalore

PostPosted: Tue Sep 02, 2008 3:34 pm
Reply with quote

Thanks a lot Frank!!!!!! It was of great help. icon_biggrin.gif
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 FTP VB File from Mainframe retaining ... JCL & VSAM 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top