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

Fetching records of a file via SYNCSORT


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

New User


Joined: 26 Sep 2007
Posts: 25
Location: chennai

PostPosted: Fri Dec 07, 2007 9:56 pm
Reply with quote

Hi all,

I have the following requirement.

There are two files with some similar records(say file A has more records then file B). My intention is to get those records which are in file A and NOT in file B (i..e.. A - B).

Krishna
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Dec 07, 2007 10:03 pm
Reply with quote

Krishna,

If you are interested in using DFSORT util, follow the link -

www.ibmmainframes.com/viewtopic.php?t=5797&highlight=compare
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 Dec 07, 2007 10:40 pm
Reply with quote

Krishna,

You haven't given enough information.

Please show an example of the records in each input file (relevant fields only) and what you expect for the output records. If input fileA can have duplicates within it, show that in your example. If input fileB can have duplicates within it, show that in your example.

Give the starting position, length and format of the relevant fields.

Give the RECFM and LRECL of each input file.
Back to top
View user's profile Send private message
skrishnavijay

New User


Joined: 26 Sep 2007
Posts: 25
Location: chennai

PostPosted: Fri Dec 07, 2007 11:07 pm
Reply with quote

File 1:

LRECL=80, (1,21,CH,A) Key position

000000000000000000024|........
000000000000000000132|........
000000000000000000024|........
000000000000000001879|........
000000000000000002134|........
000000000000012084883|........
000000000000000321833|........
000000000000000002134|........
000000000000000032156|........

File 2:

LRECL=80, (34,21,CH,A) Key position

..............................000000000000000000024|........
..............................000000000000000000132|........
..............................000000000000000000024|........
..............................000000000000000001879|........
..............................000000000000000002134|........
..............................000000000000000321833|........
..............................000000000000012084883|........

here File2 is subset of File1. I want records in File1 and NOT in File2.
I need to concern about Key field only and both file1 and file2 have duplicates.

Hope I am clear.

Thanks in advance,
Krishna
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 Dec 07, 2007 11:50 pm
Reply with quote

Quote:
Hope I am clear.


Not really.

I assume you're matching by key, not by relative record number ... right?

It would have helped if you'd showed what you expect for output as I asked you to. Do you just expect this record from File1 for output?

000000000000000032156|........

If you have multiple records with the same key in file1 without a match in file2, do you want all of those file1 records for output, or just one of them.
For example, if file1 had:

000000000000000000892|........
000000000000000000892|........
000000000000000000892|........

would you want all three records for output or just one?
Back to top
View user's profile Send private message
skrishnavijay

New User


Joined: 26 Sep 2007
Posts: 25
Location: chennai

PostPosted: Mon Dec 10, 2007 10:48 am
Reply with quote

Thanks for your patience.

I forgot to mention that my input & output files are fixed length(FB 80)

Yes.

As you said I want one of the records(duplicates) in file1 those doesn't have a match in file2 (I want the full record from file1)

Also we are using SYNCSORT. Could you please help me in this regard ?

Thanks in advance,
Krishna
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Dec 10, 2007 1:36 pm
Reply with quote

skrishnavijay,

Please check with the following code for for your requirement.
Code:
// EXEC PGM=SORT                     
//SORTJNF1 DD *                       
000000000000000000024|........       
000000000000000000132|........       
000000000000000000024|........       
000000000000000001879|........       
000000000000000002134|........       
000000000000012084883|........       
000000000000000321833|........       
000000000000000002134|........       
000000000000000032156|........       
/*                                   
//SORTJNF2 DD *                       
.................................000000000000000000024|........   
.................................000000000000000000132|........   
.................................000000000000000000024|........   
.................................000000000000000001879|........   
.................................000000000000000002134|........   
.................................000000000000000321833|........   
.................................000000000000012084883|........   
/*                                                               
//SORTOUT DD SYSOUT=*                                             
//SYSOUT DD SYSOUT=*                                             
//SYSIN DD *                                                     
 JOINKEYS FILE=F1,FIELDS=(1,21,A)                                 
 JOINKEYS FILE=F2,FIELDS=(34,21,A)                               
 JOIN UNPAIRED,F1,ONLY                                           
 SORT FIELDS=(1,21,CH,A)                                         
 SUM FIELDS=NONE                                                 
/*                                                               
//

Output:
Code:
000000000000000032156|........
Back to top
View user's profile Send private message
skrishnavijay

New User


Joined: 26 Sep 2007
Posts: 25
Location: chennai

PostPosted: Mon Dec 10, 2007 3:34 pm
Reply with quote

Thanks a lot Shankar......!!

You are very helpful... Its working gr8.......!!!


Thanks,
Krishna
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
Search our Forums:

Back to Top