Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Matching 2 files using SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sprikitik

New User


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

PostPosted: Tue Apr 29, 2008 8:39 am    Post subject: Matching 2 files using SYNCSORT
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

Senior Member


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

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

Hi,

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

Here I got it..

http://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

Senior Member


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

PostPosted: Tue Apr 29, 2008 10:02 am    Post subject:
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: 58
Location: Makati City, Philippines

PostPosted: Tue Apr 29, 2008 10:11 am    Post subject:
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

Senior Member


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

PostPosted: Tue Apr 29, 2008 10:35 am    Post subject:
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: 500
Location: USA

PostPosted: Tue Apr 29, 2008 9:22 pm    Post subject:
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: 58
Location: Makati City, Philippines

PostPosted: Tue Aug 26, 2008 8:25 am    Post subject: Reply to: Matching 2 files using SYNCSORT
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: 2165
Location: @my desk

PostPosted: Tue Aug 26, 2008 10:07 am    Post subject:
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    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:33 pm    Post subject: Reply to: Matching 2 files using SYNCSORT
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: 2165
Location: @my desk

PostPosted: Tue Aug 26, 2008 12:37 pm    Post subject:
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    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:38 pm    Post subject: Reply to: Matching 2 files using SYNCSORT
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: 2165
Location: @my desk

PostPosted: Tue Aug 26, 2008 12:45 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Tue Aug 26, 2008 12:46 pm    Post subject: Reply to: Matching 2 files using SYNCSORT
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: 1288
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:47 pm    Post subject: Reply to: Matching 2 files using SYNCSORT
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us