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

Syncsort -display recs in file A,which are matched in File B


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

DFSORT Developer


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

PostPosted: Tue Oct 19, 2010 11:43 pm
Reply with quote

By those rules, shouldn't D1 be in the output? It isn't. I think file2 is the controlling file, but I don't understand exactly how. The example shown doesn't even indicate which input file the output records come from so it's very confusing. We shouldn't have to guess what the OP wants.
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 Oct 19, 2010 11:56 pm
Reply with quote

Hi Frank,

I believe D1 is excluded because it has no match.

Quote:
We shouldn't have to guess what the OP wants.
For sure . . .

I'm not sure if only the "keys" are to be written or if there even is addtional data in a record. . . icon_confused.gif

d
Back to top
View user's profile Send private message
foolsbrain

New User


Joined: 15 Apr 2010
Posts: 11
Location: chennai

PostPosted: Fri Oct 22, 2010 7:12 pm
Reply with quote

Hi Dick,
You are right, the output should contain only the records that are in both files. D1 is rejected because it is not present in File2.

Need to write the O/P using File1 records.
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: Fri Oct 22, 2010 8:17 pm
Reply with quote

Hello,

Quote:
Need to write the O/P using File1 records.
How is the determination made as to which File1 records to keep and which to discard when there is an unequal number in File2?
Back to top
View user's profile Send private message
foolsbrain

New User


Joined: 15 Apr 2010
Posts: 11
Location: chennai

PostPosted: Fri Oct 22, 2010 8:28 pm
Reply with quote

Since we are only matching the key fields of File1 with File2, we can keep any of the matching records.

For example, if A1 is present 5 times in File1 and 3 times in File2, in the output we only need A1 thrice, we can discard any two A1 records.
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: Fri Oct 22, 2010 11:13 pm
Reply with quote

fb,

If I understand what you want correctly, you can use a DFSORT/ICETOOL job like the following:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
A1
A1
B1
C1
A1
C1
C1
D1
//IN2 DD *
A1
B1
C1
B1
C1
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN1) TO(T1) USING(CTL1)
SORT FROM(IN2) TO(T2) USING(CTL1)
COPY JKFROM TO(OUT) USING(CTL2)
//CTL1CNTL DD *
  SORT FIELDS=(1,2,CH,A)
  OUTREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,2))
//CTL2CNTL DD *
  JOINKEYS F1=T1,FIELDS=(1,2,A,81,8,A),SORTED,NOSEQCK
  JOINKEYS F2=T2,FIELDS=(1,2,A,81,8,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,80)
  OPTION COPY
/*
Back to top
View user's profile Send private message
foolsbrain

New User


Joined: 15 Apr 2010
Posts: 11
Location: chennai

PostPosted: Tue Oct 26, 2010 6:03 pm
Reply with quote

Hi Frank,
Thanks for the code...
While trying to execute the above jcl, am getting the below error in copy step. Please help on this.

Code:


         COPY JKFROM TO(OUT) USING(CTL2)
SYT050E  INVALID OPERAND ON "COPY" STATEMENT
SYT030I  OPERATION COMPLETED WITH RETURN CODE 12

SYT015I  PROCESSING MODE CHANGED FROM "STOP" TO "SCAN" DUE TO OPERATION FAILURE
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Oct 26, 2010 6:06 pm
Reply with quote

Methinks that Frank will take no further part in this thread as the product being used in SYNCSORT.

DFSORT and SYNCSORT are competitive products.
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: Tue Oct 26, 2010 8:29 pm
Reply with quote

The job works fine with DFSORT/ICETOOL. The SYT messages indicate you're using Syncsort, not DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on 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 Oct 26, 2010 9:10 pm
Reply with quote

That's why we usually ask to start over a new thread - the OP had DFSORT while foolsbrain posted a related question in between and we all know the end result now! icon_neutral.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Oct 27, 2010 11:54 am
Reply with quote

Anuj Dhawan wrote:
That's why we usually ask to start over a new thread - the OP had DFSORT while foolsbrain posted a related question in between and we all know the end result now! icon_neutral.gif
Will it help if the topic is "cut" into two?. The original topic has grown big for no reason icon_rolleyes.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 -> JCL & VSAM Goto page 1, 2  Next

 


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