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

Matching File A vs File B, to keep data from file B.


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

New User


Joined: 31 Jul 2008
Posts: 18
Location: Massachusetts

PostPosted: Wed Nov 26, 2008 12:42 am
Reply with quote

Hi Folks,

I have this jcl:

Code:
//STEP9      EXEC DISKSORT                                   
//SORTMSG    DD SYSOUT=R                                     
//SORTIN     DD DSN=FILE A,DISP=SHR
//           DD DSN=FILE B,DISP=SHR
//SORTOUT    DD SYSOUT=R                                     
//SORTXSUM   DD DSN=FILE C,DISP=SHR
//SYSIN      DD *                                             
 SORT FIELDS=(1,8,CH,A)                                       
 SUM FIELDS=NONE,XSUM                                         
/*                                                           
//                                                           


This is working as intented and is doing what it needs to be done it is taking and comparing the first 8 characters of both datasets by character in ascending order, if there are any duplicates found. Export them to a certain dsn. Now imagine if there was data on FILE B that was needed and FILE A is just used for the first 8 characters on each record.

Right now I am getting "most" of the data I need but some records are outputting to FILE C with just the first 8 characters.

Any suggestions?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Nov 26, 2008 1:10 am
Reply with quote

Which SORT utility are you running?
Back to top
View user's profile Send private message
relur197

New User


Joined: 31 Jul 2008
Posts: 18
Location: Massachusetts

PostPosted: Wed Nov 26, 2008 1:11 am
Reply with quote

SyncSort
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Nov 26, 2008 1:15 am
Reply with quote

You can probably use the JOIN feature, but before I can provide you with the control statements, I need a little more information. For starters, the RECFM and LRECL would be helpful. Also, can you provide some sample data for your 2 input files and what you want included in your output? For example, do you only want records from File A in the output?
Back to top
View user's profile Send private message
relur197

New User


Joined: 31 Jul 2008
Posts: 18
Location: Massachusetts

PostPosted: Wed Nov 26, 2008 1:22 am
Reply with quote

This is the output from my current sort.

The LRECL of each is 80.
The RECFM is Fixed Block.

This is "FILE C"

Code:


ACVRUAL4                      0.29
ACVRUAL7                      1.09
ACVRUBKP                      26.73
ACVRULC1                           
ACVRULC2                      0.69
ACVRULC3                           
ACVRULC4                      0.35
ACVRULC5                           
ACVRULC7                      2.1 
ACVRULC8                           
ACVRURPA                      0.35
ACVRURPB                           
ACVRURP1                      0.15
ACVRURP2                           
ACVRURP3                      0.37
ACVRURP4                           
ACVRUVNA                      0.38
ACVRUVNB                           
ACVRUVNC                      0.65
ACVRUVND                           
ACVRUVNE                      0.56
ACVRUVNF                           
ACVRUVNG                      0.35
ACVRUVNZ                           
ACVRUVN1                      1.18
ACVRUVN2                           



This is "FILE A"

Code:


ACVRUAL1               
ACVRUAL2               
ACVRUAL4               
ACVRUAL6               
ACVRUAL7               
ACVRUAL8               
ACVRUBKP               
ACVRULC1               
ACVRULC2               
ACVRULC3               
ACVRULC4               
ACVRULC5               
ACVRULC6               
ACVRULC7               
ACVRULC8               
ACVRURPA               
ACVRURPB               
ACVRURP1               
ACVRURP2               
ACVRURP3               
ACVRURP4               
ACVRUVNA               
ACVRUVNB               
ACVRUVNC               
ACVRUVND               
ACVRUVNE               



This is "FILE B"

Code:


ACF40                         5.41
ACVRUAL4                      0.29
ACVRUAL7                      1.09
ACVRUBKP                      26.73
ACVRULC1                      1.1 
ACVRULC2                      0.69
ACVRULC3                      0.89
ACVRULC4                      0.35
ACVRULC5                      0.02
ACVRULC7                      2.1 
ACVRULC8                      0.19
ACVRURPA                      0.35
ACVRURPB                      0.34
ACVRURP1                      0.15
ACVRURP2                      0.2 
ACVRURP3                      0.37
ACVRURP4                      0.32
ACVRUVNA                      0.38
ACVRUVNB                      0.37
ACVRUVNC                      0.65
ACVRUVND                      0.37
ACVRUVNE                      0.56
ACVRUVNF                      0.37
ACVRUVNG                      0.35
ACVRUVNZ                      0.03
ACVRUVN1                      1.18



Right now, what you can see happening in FILE C is that when it is performing the check for the duplicate it is getting "one than the other" with the decimal number.

Yes, what I cant figure out is to have only the records from this case "FILE B" to be included in "FILE C". Maybe taking the route of checking for duplicate as matching was a bad idea...
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Nov 26, 2008 1:40 am
Reply with quote

relur197,

If you have Syncsort for z/OS 1.2 or above, you can easily do this using the JOIN feature as Alissa pointed out. Which version are you using? You can find this info on the top of the SYSOUT.
Back to top
View user's profile Send private message
relur197

New User


Joined: 31 Jul 2008
Posts: 18
Location: Massachusetts

PostPosted: Wed Nov 26, 2008 1:42 am
Reply with quote

SYNCSORT FOR Z/OS 1.3.0.2R
Back to top
View user's profile Send private message
relur197

New User


Joined: 31 Jul 2008
Posts: 18
Location: Massachusetts

PostPosted: Wed Nov 26, 2008 1:42 am
Reply with quote

Darnit, I can't edit my post. Anyway, I am looking into the join control statement now. I will return with anything I have found. Thanks
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Nov 26, 2008 1:46 am
Reply with quote

Try this JCL instead:

Code:
//STEP   EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTJNF1 DD DSN=FILE.A,DISP=SHR
//SORTJNF2 DD DSN=FILE.B,DISP=SHR
//SORTOUT  DD DSN=FILE.C,...
//SYSIN    DD *                                             
   JOINKEYS FILE=F1,FIELDS=(1,8,A)                               
   JOINKEYS FILE=F2,FIELDS=(1,8,A)
   REFORMAT FIELDS=(F2:1,80)
   SORT FIELDS=COPY
/*                                                           
Back to top
View user's profile Send private message
relur197

New User


Joined: 31 Jul 2008
Posts: 18
Location: Massachusetts

PostPosted: Wed Nov 26, 2008 2:24 am
Reply with quote

I can't thank you enough alissa.

Enjoy the holiday arcvns and alissa.
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 How to split large record length file... DFSORT/ICETOOL 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top