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

Syncsort - File Compare with SPLICE Comand


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
biswaranjan

New User


Joined: 06 May 2010
Posts: 17
Location: INDIA

PostPosted: Mon May 17, 2010 9:35 pm
Reply with quote

Hi,

I'm trying to compare two files and acheice the below points.

My requirement is:
-----------------------------
1)OUT1 should contain the records which are present only in IN1, but not in IN2.

2)OUT2 should contain the records which are present only in IN2, but not in IN1.

3)OUT12 should contain the records which are present in both IN1 and IN2.

IN1:
375206319452271 BISWARANJAN 10100681.ABXS.SE
375206321701130 MANAS 10100681.MNOP.SE
375206321704385 SONAL 10100681.QRST.SE

IN2:
375212349452279 DEVID 10100681.ABXS.SE
375206319452271 BISWARANJAN 10100681.ABXS.SE
375206321704385 SONAL 10100681.QRST.SE





Code:

 //IN1 DD DSN=NC0218A.TEST.TEST1,DISP=SHR                               
 //IN2 DD DSN=NC0218A.TEST.TEST2,DISP=SHR                               
 //OUT12 DD DSN=NC0218A.TEST.OUT12,DISP=(MOD,CATLG),                     
 //        DCB=(LRECL=50,RECFM=FB,BLKSIZE=500)                           
 //OUT1 DD DSN=NC0218A.TEST.OUT1,DISP=(MOD,CATLG),DCB=*.IN1             
 //OUT2 DD DSN=NC0218A.TEST.OUT2,DISP=(MOD,CATLG),DCB=*.IN1             
 //T1 DD DSN=&&TEMP,UNIT=SYSDA,SPACE=(TRK,(5,5)),                       
 //  DISP=(MOD,PASS),DCB=*.IN1                                           
 //TOOLIN   DD  *                                                       
  COPY FROM(IN1) TO(T1) USING(CTL1)                                     
  COPY FROM(IN2) TO(T1) USING(CTL2)                                     
  SPLICE FROM(T1) TO(OUT12) ON(1,15,CH) ON(17,11,CH) ON(29,16,CH) -     
  KEEPNODUPS WITH(48,1) USING(CTL3)                                                 
 //CTL1CNTL DD *                                                         
  OUTREC FIELDS=(1,44,46:C'11')                                         
 //CTL2CNTL DD *                                                         
  OUTREC FIELDS=(1,44,46:C'22')                                         
//CTL3CNTL DD *                                                   
 OUTFIL FNAMES=OUT12,INCLUDE=(46,2,CH,EQ,C'12'),OUTREC=(1,44)     
 OUTFIL FNAMES=OUT1,INCLUDE=(46,2,CH,EQ,C'11'),OUTREC=(1,44)       
 OUTFIL FNAMES=OUT2,INCLUDE=(46,2,CH,EQ,C'22'),OUTREC=(1,44)       
//SYSOUT   DD  SYSOUT=*                                           



The WITH command in SPLICE is creating a problem.

File Layout:

A/C No: 1 to 15
Name : 17 to 27
bid : 29 to 44

Please let me know the changes needed.

Regards,
Biswa
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 May 17, 2010 10:36 pm
Reply with quote

You have several errors in your job including using LRECL=50 for the output data sets instead of LRECL=44, and a mismatch between your WITH(48,1) field and your 46:C'11' and 46:C'22' ids.

Here's a DFSORT/ICETOOL job that will do what I think you want:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=NC0218A.TEST.TEST1,DISP=SHR (FB/44)
//IN2 DD DSN=NC0218A.TEST.TEST2,DISP=SHR (FB/44)
//OUT12 DD DSN=...  output12 (FB/44)
//OUT1  DD DSN=...  output1 (FB/44)
//OUT2  DD DSN=...  output2 (FB/44)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),
//  DISP=(MOD,PASS)
//TOOLIN   DD  *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT12) ON(1,15,CH) ON(17,11,CH) ON(29,16,CH) -
  KEEPNODUPS WITH(45,1) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC OVERLAY=(45:C'11')
/*
//CTL2CNTL DD *
  OUTREC OVERLAY=(45:C'22')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT12,INCLUDE=(45,2,CH,EQ,C'21'),OUTREC=(1,44)
  OUTFIL FNAMES=OUT1,INCLUDE=(45,2,CH,EQ,C'11'),OUTREC=(1,44)
  OUTFIL FNAMES=OUT2,INCLUDE=(45,2,CH,EQ,C'22'),OUTREC=(1,44)
/*
Back to top
View user's profile Send private message
biswaranjan

New User


Joined: 06 May 2010
Posts: 17
Location: INDIA

PostPosted: Tue May 18, 2010 9:17 am
Reply with quote

Hi Frank,

I'm getting the below error in CTL3.

Code:

 COPY FROM(IN1) TO(T1) USING(CTL1)                                   
SYNCSORT CALLED WITH IDENTIFIER "0001"                               
OPERATION COMPLETED WITH RETURN CODE 0                               
                                                                     
 COPY FROM(IN2) TO(T1) USING(CTL2)                                   
SYNCSORT CALLED WITH IDENTIFIER "0002"                               
OPERATION COMPLETED WITH RETURN CODE 0                               
                                                                     
 SPLICE FROM(T1) TO(OUT12) ON(1,15,CH) ON(17,11,CH) ON(29,16,CH) -   
 KEEPNODUPS WITH(45,1) USING(CTL3)                                   
SYNCSORT CALLED WITH IDENTIFIER "0003"                               
SYNCSORT COMPLETED UNSUCCESSFULLY                                   
OPERATION COMPLETED WITH RETURN CODE 16                             
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 18, 2010 9:22 am
Reply with quote

biswaranjan wrote:
Hi Frank,

I'm getting the below error in CTL3.

Code:

 COPY FROM(IN1) TO(T1) USING(CTL1)                                   
SYNCSORT CALLED WITH IDENTIFIER "0001"                               
OPERATION COMPLETED WITH RETURN CODE 0                               
                                                                     
 COPY FROM(IN2) TO(T1) USING(CTL2)                                   
SYNCSORT CALLED WITH IDENTIFIER "0002"                               
OPERATION COMPLETED WITH RETURN CODE 0                               
                                                                     
 SPLICE FROM(T1) TO(OUT12) ON(1,15,CH) ON(17,11,CH) ON(29,16,CH) -   
 KEEPNODUPS WITH(45,1) USING(CTL3)                                   
SYNCSORT CALLED WITH IDENTIFIER "0003"                               
SYNCSORT COMPLETED UNSUCCESSFULLY                                   
OPERATION COMPLETED WITH RETURN CODE 16                             

Gentleman,
You have SYNCSORT installed not DFSORT. Frank has given the solution for DFSORT.
Back to top
View user's profile Send private message
biswaranjan

New User


Joined: 06 May 2010
Posts: 17
Location: INDIA

PostPosted: Tue May 18, 2010 9:32 am
Reply with quote

Hi Sambhaji,

Is it like SYNCSORT doesn't support SPLICE command?
If not how to acheive the required result?

Regards,
Biswa
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue May 18, 2010 9:40 am
Reply with quote

Hello,

Which release of Syncsort are you using? This is shown on the informational output from the step.
Back to top
View user's profile Send private message
biswaranjan

New User


Joined: 06 May 2010
Posts: 17
Location: INDIA

PostPosted: Tue May 18, 2010 9:44 am
Reply with quote

SYNCSORT FOR Z/OS 1.3.2.1RI U.S. PATENTS: 4210961, 5117495 (C) 2007 SYNCSORT INC.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue May 18, 2010 9:50 am
Reply with quote

Hello,

I'm not connected to the network where the Syncsort documentation is stored, but i believe SPLICE is available in your release.

I also believe there is diagnostic info that you chose not to post. . . Among other things, the message ids are missing. . . These need to always be posted.

It will probably help someone help you if you post the complete jcl and control statements - not what you believe is needed (a very common time-waster) icon_wink.gif
Back to top
View user's profile Send private message
biswaranjan

New User


Joined: 06 May 2010
Posts: 17
Location: INDIA

PostPosted: Tue May 18, 2010 9:54 am
Reply with quote

This is the JCL along with control cards which was posted and suggested by Frank. Let me know if this is what you are looking at.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=NC0218A.TEST.TEST1,DISP=SHR (FB/44)
//IN2 DD DSN=NC0218A.TEST.TEST2,DISP=SHR (FB/44)
//OUT12 DD DSN=...  output12 (FB/44)
//OUT1  DD DSN=...  output1 (FB/44)
//OUT2  DD DSN=...  output2 (FB/44)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),
//  DISP=(MOD,PASS)
//TOOLIN   DD  *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT12) ON(1,15,CH) ON(17,11,CH) ON(29,16,CH) -
  KEEPNODUPS WITH(45,1) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC OVERLAY=(45:C'11')
/*
//CTL2CNTL DD *
  OUTREC OVERLAY=(45:C'22')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT12,INCLUDE=(45,2,CH,EQ,C'21'),OUTREC=(1,44)
  OUTFIL FNAMES=OUT1,INCLUDE=(45,2,CH,EQ,C'11'),OUTREC=(1,44)
  OUTFIL FNAMES=OUT2,INCLUDE=(45,2,CH,EQ,C'22'),OUTREC=(1,44)
/*
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue May 18, 2010 9:59 am
Reply with quote

Hello,

Please also post the complete informational output.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 18, 2010 10:05 am
Reply with quote

biswaranjan wrote:
Hi Sambhaji,

Is it like SYNCSORT doesn't support SPLICE command?
If not how to acheive the required result?

Regards,
Biswa

Yes it does. I am not sure from which release it is available.

but there are similar requirements have been discussed in JCL part of the forum
www.ibmmainframes.com/viewtopic.php?t=36269&highlight=match+unmatch
www.ibmmainframes.com/viewtopic.php?t=44749&highlight=match+unmatch
www.ibmmainframes.com/viewtopic.php?t=15955&highlight=match+unmatch
Back to top
View user's profile Send private message
Corey Hardy

New User


Joined: 14 Apr 2010
Posts: 9
Location: Virginia

PostPosted: Tue May 18, 2010 11:10 pm
Reply with quote

Below is an alternative solution using the JOINKEYS feature:

Code:

//IBMFHELP EXEC PGM=SORT,COND=(0,LT)                                   
//*                                                                     
//******************************************************************   
//*THIS SORT WILL COMPARE THE INPUT FILES AND WRITE THE DATA TO 1 OF 3 
//*FILES:                                                               
//*     1). UNIQUE RECORDS FROM F1                                     
//*     2). UNIQUE RECORDS FROM F2                                     
//*     3). MATCHING RECORDS OR RECORDS FOUND ON F1 & F2               
//******************************************************************   
//*                                                                     
//SORTJNF1 DD *                                                         
375206319452271 BISWARANJAN 10100681.ABXS.SE                           
375206321701130 MANAS 10100681.MNOP.SE                                 
375206321704385 SONAL 10100681.QRST.SE                                 
//SORTJNF2 DD *                                                         
375212349452279 DEVID 10100681.ABXS.SE                                 
375206319452271 BISWARANJAN 10100681.ABXS.SE                           
375206321704385 SONAL 10100681.QRST.SE                                 
//*                                                                     
//SYSIN    DD *                                                         
 JOINKEYS FILE=F1,FIELDS=(001,044,A)   *JNF1                           
 JOINKEYS FILE=F2,FIELDS=(001,044,A)   *JNF2                           
 JOIN UNPAIRED                                                         
 REFORMAT FIELDS=(F1:001,044,                                           
                  F2:001,044)                                           
  SORT   FIELDS=COPY                                                   
  OUTFIL FNAMES=OUT1,                                                   
    INCLUDE=(45,01,CH,EQ,C' '),                                         
         OUTREC=(01:001,044,                                           
                 46:C'11')                                             
  OUTFIL FNAMES=OUT2,                                                   
    INCLUDE=(01,01,CH,EQ,C' '),                                         
         OUTREC=(01:045,044,                                           
                 46:C'22')                                             
  OUTFIL FNAMES=OUT12,                                                 
    INCLUDE=(01,44,CH,EQ,45,44,CH),                                     
         OUTREC=(01:001,044,                                           
                 46:C'12')                                             
//*                                                                     
//OUT1     DD SYSOUT=*                                                 
//OUT2     DD SYSOUT=*                                                 
//OUT12    DD SYSOUT=*   



Results:

OUT1:
Code:

********************************* TOP OF DATA **********************************
375206321701130 MANAS 10100681.MNOP.SE       11                                 
******************************** BOTTOM OF DATA ********************************


OUT2:

Code:


********************************* TOP OF DATA **********************************
375212349452279 DEVID 10100681.ABXS.SE       22                                 
******************************** BOTTOM OF DATA ********************************


OUT3:
Code:

********************************* TOP OF DATA **********************************
375206319452271 BISWARANJAN 10100681.ABXS.SE 12                                 
375206321704385 SONAL 10100681.QRST.SE       12                                 
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
biswaranjan

New User


Joined: 06 May 2010
Posts: 17
Location: INDIA

PostPosted: Wed May 26, 2010 1:32 pm
Reply with quote

Hi Frank,

If I just want to acheive.

1)OUT1 should contain the records which are present only in IN1, but not in IN2.

Is it like I have to create temp. files for OUT2 and OUT12 file with SPLICE command?

Code:
//IN1 DD DSN=NC0218A.TEST.TEST1,DISP=SHR                               
//IN2 DD DSN=NC0218A.TEST.TEST2,DISP=SHR                               
//OUT12 DD DSN=&&TEMP,DISP=(NEW,CATLG),                               
//        DCB=(LRECL=44,RECFM=FB,BLKSIZE=440)                         
//OUT1 DD DSN=NC0218A.TEST.OUT1,DISP=(NEW,CATLG),                     
//        DCB=(LRECL=44,RECFM=FB,BLKSIZE=440)                         
//OUT2 DD DSN=&&TEMP,DISP=(NEW,CATLG),                                 
//        DCB=(LRECL=44,RECFM=FB,BLKSIZE=440)                         
//T1 DD DSN=&&TEMP,UNIT=SYSDA,SPACE=(TRK,(5,5)),                       
//  DISP=(MOD,PASS),DCB=*.IN1                                         
//TOOLIN   DD  *                                                       
 COPY FROM(IN1) TO(T1) USING(CTL1)                                     
 COPY FROM(IN2) TO(T1) USING(CTL2)                                     
 SPLICE FROM(T1) TO(OUT12) ON(1,15,CH) ON(17,11,CH) ON(29,16,CH) -     
 KEEPNODUPS WITH(45,1) USING(CTL3)                                     
//CTL1CNTL DD *                                                       
 OUTREC FIELDS=(1,44,45:C'11')                                         
//CTL2CNTL DD *                                                       
 OUTREC FIELDS=(1,44,45:C'22')                                         
//CTL3CNTL DD *                                                   
 OUTFIL FNAMES=OUT12,INCLUDE=(45,2,CH,EQ,C'21'),OUTREC=(1,44)     
 OUTFIL FNAMES=OUT1,INCLUDE=(45,2,CH,EQ,C'11'),OUTREC=(1,44)       
 OUTFIL FNAMES=OUT2,INCLUDE=(45,2,CH,EQ,C'22'),OUTREC=(1,44)       
//SYSOUT   DD  SYSOUT=*                                           


Can you please let me know how WITH(45,1) works? Meaning what does 45,1 stands for?

In CTL1 and CTL2 "11" and "22" got added at 45 and 46th position.
How the key "21" is added and compared?
//CTL3CNTL DD *
OUTFIL FNAMES=OUT12,INCLUDE=(45,2,CH,EQ,C'21'),OUTREC=(1,44)

Temp file T1 contains:

Code:

375206319452271 BISWARANJAN 10100690.ABXS.SE11
375206321701130 MANAS       10100681.MNOP.SE11
375206321704385 SONAL       10100681.QRST.SE11
375212349452279 DEVID       10100681.ABXS.SE22
375206319452271 BISWARANJAN 10100681.ABXS.SE22
375206321704385 SONAL       10100681.QRST.SE22
375207777777777 MITALI      10100689.ABCD.SE22
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed May 26, 2010 3:55 pm
Reply with quote

biswaranjan,

You have the latest release of SyncSort installed. Why not go for the JOIN solution already provided. You can further simplify it by adding the SAVE parameter instead of the INCLUDE for OUT12 dd to capture the remaining records as below
Code:
  OUTFIL FNAMES=OUT12,SAVE,                                                 
    OUTREC=(

Frank is a DFSORT developer, he does not answer questions on SyncSort .
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
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