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

Matching 2 files using SYNCSORT


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

New User


Joined: 29 Jan 2007
Posts: 61
Location: Makati City, Philippines

PostPosted: Tue Apr 29, 2008 8:39 am
Reply with quote

I have 2 files

File 1 :

10001STUDENT1

FILE 2:

10001XXXXXXX

The output that i need is:

10001STUDENT1XXXXXXX

Question is: How can i do this using SYNCSORT?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Apr 29, 2008 9:30 am
Reply with quote

Hi,

If I'm not mistaken this question is been answered recently, lemme check the link...

Here I got it..

www.ibmmainframes.com/viewtopic.php?t=30264&highlight=&sid=b86bfc0348d852462a3b6008ea6779fe

oops even the 'author' is same..oh the product is different.

Well, the same solution would work in SyncSort as well, try it; if You have some nasty output then please post the SYSOUT messages & the JCL used.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Apr 29, 2008 10:02 am
Reply with quote

Hi,

Apologies, that's not the solution, You used very similar 'records' for the inputs, so I goofed up... icon_redface.gif

Please use the below JCL

Code:
//DFSORT  EXEC PGM=ICETOOL                                             
//TOOLMSG DD SYSOUT=*                                                 
//DFSMSG  DD SYSOUT=*                                                 
//IN1     DD *                                                         
10001STUDENT1                                                         
//IN2     DD *                                                         
10001XXXXXXX                                                           
//TMP1    DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//OUT     DD sysout=*                                                 
//TOOLIN  DD *                                                         
  COPY FROM(IN1) TO(TMP1) USING(CPY1)                                 
  COPY FROM(IN2) TO(TMP1) USING(CPY2)                                 
  SPLICE FROM(TMP1) TO(OUT) ON(1,5,CH) WITH(14,7)                     
//CPY1CNTL DD *                                                       
  OUTREC FIELDS=(1:1,5,6:6,8,14:7X)                                   
/*                                                                     
//CPY2CNTL DD *                                                       
  OUTREC FIELDS=(1:1,5,14:6,7)                                         
/*                                                                     


Quote:
If I'm not mistaken
I was on mistake... icon_evil.gif
Back to top
View user's profile Send private message
sprikitik

New User


Joined: 29 Jan 2007
Posts: 61
Location: Makati City, Philippines

PostPosted: Tue Apr 29, 2008 10:11 am
Reply with quote

Anuj D. wrote:
Hi,

Apologies, that's not the solution, You used very similar 'records' for the inputs, so I goofed up... icon_redface.gif

Please use the below JCL

Code:
//DFSORT  EXEC PGM=ICETOOL                                             
//TOOLMSG DD SYSOUT=*                                                 
//DFSMSG  DD SYSOUT=*                                                 
//IN1     DD *                                                         
10001STUDENT1                                                         
//IN2     DD *                                                         
10001XXXXXXX                                                           
//TMP1    DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//OUT     DD sysout=*                                                 
//TOOLIN  DD *                                                         
  COPY FROM(IN1) TO(TMP1) USING(CPY1)                                 
  COPY FROM(IN2) TO(TMP1) USING(CPY2)                                 
  SPLICE FROM(TMP1) TO(OUT) ON(1,5,CH) WITH(14,7)                     
//CPY1CNTL DD *                                                       
  OUTREC FIELDS=(1:1,5,6:6,8,14:7X)                                   
/*                                                                     
//CPY2CNTL DD *                                                       
  OUTREC FIELDS=(1:1,5,14:6,7)                                         
/*                                                                     


Quote:
If I'm not mistaken
I was on mistake... icon_evil.gif



Hi,

Thanks for the reply..

Will this work for the following example? :

file 1:

10001STUDENT1
10002STUDENT2

file 2:

10001XXXXXXX

output file:
10001STUDENT1XXXXXXX
10002STUDENT2

Thanks!
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Apr 29, 2008 10:35 am
Reply with quote

Hi,

No, it will not; it would work with this type of input instead,

Code:
//IN1     DD * 
10001STUDENT1   
10002STUDENT2   
//IN2     DD * 
10001XXXXXXX   
10002XXXXXXX   


Well, you've posted the same question in DFSORT as well & this time I'm not goofing up.

P.S. : A mild suggestion, unless You've something specific to point out from the previous post, please don't "quote" the previous post, just reply it.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Apr 29, 2008 9:22 pm
Reply with quote

sprikitik,

Try this SyncSort job:
Code:
//SORT1 EXEC PGM=SORT               
//SORTJNF1 DD *                     
10001STUDENT1                       
10002STUDENT2                       
//SORTJNF2 DD *                     
10001XXXXXXX                         
//SORTOUT DD SYSOUT=*               
//SYSOUT DD SYSOUT=*     
//SYSIN DD *               
  JOINKEYS FILES=F1,FIELDS=(1,5,A)   
  JOINKEYS FILES=F2,FIELDS=(1,5,A)   
  JOIN UNPAIRED                     
  REFORMAT FIELDS=(F1:1,13,F2:6,7)   
  SORT FIELDS=COPY                   
/*

The following output is produced:
Code:
10001STUDENT1XXXXXXX 
10002STUDENT2         
Back to top
View user's profile Send private message
sprikitik

New User


Joined: 29 Jan 2007
Posts: 61
Location: Makati City, Philippines

PostPosted: Tue Aug 26, 2008 8:25 am
Reply with quote

Hi,

What if i want to write only those records with NO match? How will i do that?

Thanks,
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 26, 2008 10:07 am
Reply with quote

Quote:
What if i want to write only those records with NO match


Post sample input/output records and what exactly you want to achieve.
Your initial requirement was to extract only matching records.

Thanks,
Arun
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Aug 26, 2008 12:31 pm
Reply with quote

Hi Alissa Margulies,
I tried jcl posted by you, i got

ICE005A 0 STATEMENT DEFINER ERROR

on control cards.

What does it mean?

does it mean that i dont have syscsort?
here is sort out


Code:

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                             
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 07:42 ON TUE
            JOINKEYS FILES=F1,FIELDS=(1,5,A)                                 
            £                                                               
ICE005A 0 STATEMENT DEFINER ERROR                                           
            JOINKEYS FILES=F2,FIELDS=(1,5,A)                                 
            £                                                               
ICE005A 0 STATEMENT DEFINER ERROR                                           
            JOIN UNPAIRED                                                   
            £                                                               
ICE005A 0 STATEMENT DEFINER ERROR                                           
            REFORMAT FIELDS=(F1:1,13,F2:6,7)                                 
            £                                                               
ICE005A 0 STATEMENT DEFINER ERROR                                           
            SORT FIELDS=COPY                                                 
ICE056A 0 SORTIN   NOT DEFINED                             
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E7-K24705
ICE052I 3 END OF DFSORT
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:33 pm
Reply with quote

Sambhaji,

Quote:
I tried jcl posted by you, i got

ICE005A 0 STATEMENT DEFINER ERROR

on control cards.

What does it mean?

does it mean that i dont have syscsort?


ICE messages indicate that you are using DFSORT and not SYNCSORT. JOINKEYS is for SYNCSORT.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 26, 2008 12:37 pm
Reply with quote

Sambhaji,

Do a search in DFSORT forum. You'll find lot of examples for file-matching using DFSORT.

Thanks,
Arun
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Aug 26, 2008 12:37 pm
Reply with quote

thanks Aaru for very quick reply.
how to find whether i have syncsort or not?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:38 pm
Reply with quote

Sambhaji,

In case you have the same requirement, Try using the JCL which Anuj had posted which uses ICETOOL (DFSORT).

Post if you face any issue.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 26, 2008 12:45 pm
Reply with quote

Sambhaji,

ICE messages are issued by DFSORT whereas Syncsort issues WER messages in your SYSOUT. Most of the shops will have only either of these sort products installed.

Thanks,
Arun
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Aug 26, 2008 12:46 pm
Reply with quote

Quote:
how to find whether i have syncsort or not?


it has been told zillions times...
look at ( better if You read also ) the sysout of the sort step,

it should be clear what sort product You are using

but, another hint...
if the messages start with

WER that' s SYNCSORT
ICE that' s DFSORT
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:47 pm
Reply with quote

Sambhaji,

Quote:
how to find whether i have syncsort or not?


You can identify that with the messages that you get from the SORT job.

ICE - Indicates that you are using DFSORT
WER - Indicates that you are using SYNCSORT

Both are competitive products. In your case the messages start with ICE and hence it uses DFSORT. Also the term "dfsort" is also displayed in the spool.


Code:
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 07:42 ON TUE


From Frank's Post:



Quote:
If your site is using DFSORT, then PGM=ICETOOL invokes DFSORT's ICETOOL and you will see ICE messages in TOOLMSG and DFSMSG. If your site is using Syncsort, then PGM=ICETOOL invokes Syncsort's SYNCTOOL (because Syncsort ships ICETOOL as an alias for SYNCTOOL) and you will see SYT messages in TOOLMSG and WER messages in DFSMSG.


Hope this Helps.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top