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

Match from 1st file and write the 2nd file


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

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 6:11 pm
Reply with quote

FIle1
Code:

BABY12345
BOBY12345
POPY12345
JABBY7765   


File2
Code:

ABBY45678
BABY09875   CA
JABBY5566   DR
JABBY1123   GA
LABBY9900
QABY1100
BABY00997   DR
POPY00998   CA
POPY22334   MA



Output should be
File3
Code:

BABY09875   CA
JABBY5566   DR
BABY00997   DR
POPY00998   CA



First 4 char is the keys for file1 and file2.File2 has to match with file1 with keys(1,4) and File2 to have either CA or DR. (or) File 1 has to match with File2 with keys(1,4) and file 2 have to have either CA or DR.


Could someone tell me the possible way to get this kind of output.
I have spend lot of effort to do this. but still the output is not as expected.

Thanks in advance.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat Mar 09, 2013 6:20 pm
Reply with quote

And now?
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 6:22 pm
Reply with quote

Peter,

please find my updated post.

Thanks
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 6:56 pm
Reply with quote

Could someone help me out?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Mar 09, 2013 7:00 pm
Reply with quote

JOINKEYS will do the matching for you. INCLUDE on a JNFnCNTL file can be used to only match the CA/DR.

File 2 matching File 1 is the same as File 1 matching File 2, so I'm not sure why you repeated it.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sat Mar 09, 2013 7:52 pm
Reply with quote

what happened to
ibmmainframes.com/viewtopic.php?t=60553&highlight=

shall I delete it ???
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 8:22 pm
Reply with quote

Hi Enrico,

please delete the below topic.

ibmmainframes.com/viewtopic.php?t=60553&highlight=

Can you please provide me a snippet for this topic?

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

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 8:24 pm
Reply with quote

Hi Bill Woodger,

can you please help me with an example?

it will be helpful

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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sat Mar 09, 2013 8:35 pm
Reply with quote

please stop soliciting for replies

You should remember that
replying is on voluntary base
on our own time
free of charge

in less PC words when and if we feel like

and furthermore is saturday

for a question like the current one there are even too many examples on the forum

do a bit of research
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 9:00 pm
Reply with quote

icon_sad.gif icon_sad.gif icon_sad.gif icon_cry.gif

Examples in forums are confusing like anything.

Can any one please give an example for my requirement?

wanna go home????
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Mar 09, 2013 9:19 pm
Reply with quote

Code:

  JOINKEYS F1=INA,FIELDS=(1,4,A)         
  JOINKEYS F2=INB,FIELDS=(1,4,A)         
  REFORMAT FIELDS=(F1:1,12,F2:13,2)
  OPTION COPY

//JNF2CNTL DD *
  INCLUDE COND=(13,2,SS,EQ,C'CA,DR')
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 9:45 pm
Reply with quote

getting this error
Code:

       JOINKEYS F1=INA,FIELDS=(1,10,A)         
                *                             
       JOINKEYS F2=INB,FIELDS=(1,10,A)         
                *                             
       REFORMAT FIELDS=(F1:1,10,F2:36,5465)   
       OPTION COPY                             
 WER268A  JOINKEYS STATEMENT: SYNTAX ERROR     
 WER268A  JOINKEYS STATEMENT: SYNTAX ERROR     
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 10:23 pm
Reply with quote

Bill Woodger


Thank you so much for your help.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Mar 09, 2013 10:28 pm
Reply with quote

Change F1 and F2 to FILES=F1 and F2
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Sat Mar 09, 2013 10:31 pm
Reply with quote

it is working fine..

Thanks again
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Mar 10, 2013 4:22 am
Reply with quote

For non-SyncSort 1.4 users, move the INCLUDE to OUTFIL INCLUDE=.
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top