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

Merge 2 files


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

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Thu Oct 14, 2010 6:50 pm
Reply with quote

Hi I need to join 2 file of FB 786 Length

FIle 1:-
Code:
111111111XPABCDEF
222222222XP121342
333333333XP312412


FILE2:-
Code:
111111111XPABSEFF
222222222XP121323
333333333XP3124321


OUTPUT:-
Code:
111111111XPABCDEF
111111111XPABSEFF
222222222XP121342
222222222XP121323
333333333XP312412
333333333XP3124321


Please help me to do this
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Oct 14, 2010 7:00 pm
Reply with quote

Surely a simple sort using both files concatenated to SORTIN would do the trick.
Back to top
View user's profile Send private message
Narendra Bade

New User


Joined: 12 Oct 2010
Posts: 13
Location: Pune

PostPosted: Thu Oct 14, 2010 7:10 pm
Reply with quote

000001 //GD02A JOB NAREN,A100,TIME=(,1),MSGCLASS=A,NOTIFY=&SYSUID,
000002 // REGION=4M
000003 //STEPD EXEC PGM=SORT
000004 //SORTIN DD DSN=GD02.NAREN1.PDS(II),DISP=SHR
000005 //SORTOUT DD DSN=GD02.NAREN1.PDS(II),DISP=SHR
000006 //SYSOUT DD SYSOUT=*
000007 //SYSIN DD *
000008 SORT FIELDS=(1,4,CH,A)
000009 /*
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Oct 14, 2010 7:20 pm
Reply with quote

Narendra Bade wrote:
000001 //GD02A JOB NAREN,A100,TIME=(,1),MSGCLASS=A,NOTIFY=&SYSUID,
000002 // REGION=4M
000003 //STEPD EXEC PGM=SORT
000004 //SORTIN DD DSN=GD02.NAREN1.PDS(II),DISP=SHR
000005 //SORTOUT DD DSN=GD02.NAREN1.PDS(II),DISP=SHR
000006 //SYSOUT DD SYSOUT=*
000007 //SYSIN DD *
000008 SORT FIELDS=(1,4,CH,A)
000009 /*

And this relates to shrivatsa's question how?
Back to top
View user's profile Send private message
Narendra Bade

New User


Joined: 12 Oct 2010
Posts: 13
Location: Pune

PostPosted: Thu Oct 14, 2010 7:43 pm
Reply with quote

hey sorry , just replace
SORT FIELDS=(1,4,CH,A) as MERGE FIELDS=(1,4,CH,A)
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Oct 14, 2010 7:49 pm
Reply with quote

1,4,CH,A

Any reason that we should know about for choosing these values.
How do YOU know the key field without the OP telling us
- - - Aaaaaaaaaaaah, must be psychic day icon_lol.gif

Until such time as the OP would care to explain EXACTLY what is required, we can sit here and take guesses until the cows come home and still be none the wiser.

so shrivatsa, we await your detailed description of exactly what is required and any rules / variations / other things that we should be aware of.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Oct 14, 2010 8:00 pm
Reply with quote

Narendra Bade wrote:
hey sorry , just replace
SORT FIELDS=(1,4,CH,A) as MERGE FIELDS=(1,4,CH,A)

And maybe actually determining what the merge keys would be?

And maybe adding another input data set?

And maybe not overwriting the very data set that the job step is using as input?

And maybe showing a couple or three other things that the TS needs to know?

I am strongly of the opinion that the senior members of these fora are correct in their requiring that querents show a little initiative. I do not, however, think that the proper way to get them to do so is to give them garbage and then sit back smirking whilst they struggle with it.
Back to top
View user's profile Send private message
Narendra Bade

New User


Joined: 12 Oct 2010
Posts: 13
Location: Pune

PostPosted: Thu Oct 14, 2010 8:14 pm
Reply with quote

Hey , Whatever do you guys saying , I am not getting.
I want to help from my end , if it is wrong then you should correct me or leave it.
Without giving answer , I dont know , what you guys discussing wested things.

And I stringly believe this forum is for learner who want learn it and Expert who want to share their knowledge. Correct if i am wrong??
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Oct 14, 2010 8:18 pm
Reply with quote

how will that create the TS's desired output of:

1st record file 1
1st record file 2
2nd record file 1
2nd record file 2
3rd record file 1
3rd record file 2
4th record file 1
4th record file 2

pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee read.
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: Thu Oct 14, 2010 8:42 pm
Reply with quote

Hello,

Quote:
I want to help from my end , if it is wrong then you should correct me or leave it.
If you want to help, post only "solutions" that you have tested and confirmed work correctly for the posted requirement. You should expect some "flack" when you post information that does not relate to the question and/or is just wrong.

Quote:
And I stringly believe this forum is for learner who want learn it and Expert who want to share their knowledge. Correct if i am wrong??
Yes, you are wrong.

This forum is intended for people who have already done considerable learning - not students and freshers. For students and freshers, we have a separate forum:
www.ibmmainframeforum.com/
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Thu Oct 14, 2010 8:50 pm
Reply with quote

Looks like, I'm missing soemthing...actually, for the sample inputs and output - the sort card from Narendra should work (the MERGE one), and for that matter any key of length from 1-10 should work. But as shrivatsa mentioned about LRECL=786, it might or might not work. However for the sample of input/output given:
Code:
//STEP001  EXEC PGM=SORT     
//SORTIN1 DD *               
111111111XPABCDEF             
222222222XP121342             
333333333XP312412             
//SORTIN2 DD *               
111111111XPABSEFF             
222222222XP121323             
333333333XP3124321           
//SORTOUT DD SYSOUT=*         
//SYSIN DD *                 
  MERGE FIELDS=(1,4,CH,A)     
//SYSOUT DD SYSOUT=*         
//*                           

SORTOUT:
Code:
111111111XPABCDEF
111111111XPABSEFF
222222222XP121342
222222222XP121323
333333333XP312412
333333333XP3124321
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: Thu Oct 14, 2010 9:35 pm
Reply with quote

Hi Anuj,

Quote:
Looks like, I'm missing soemthing...
Yes, MERGE requires 2 input files and the "solution" has only one. . .
Code:
000001 //GD02A JOB NAREN,A100,TIME=(,1),MSGCLASS=A,NOTIFY=&SYSUID,
000002 // REGION=4M
000003 //STEPD EXEC PGM=SORT
000004 //SORTIN DD DSN=GD02.NAREN1.PDS(II),DISP=SHR
000005 //SORTOUT DD DSN=GD02.NAREN1.PDS(II),DISP=SHR
000006 //SYSOUT DD SYSOUT=*
000007 //SYSIN DD *
000008 SORT FIELDS=(1,4,CH,A)
000009 /*


Yours has 2 input files. . .

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

Superior Member


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

PostPosted: Thu Oct 14, 2010 9:41 pm
Reply with quote

oh well, ill effect of working in office at 9:40 in evening - I can not do better than this!

Thank you Dick. icon_smile.gif
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Oct 15, 2010 12:05 am
Reply with quote

This thread has gone down a typical path:

1) TS throws out a question that is void of much useful information

2) An expert is able to provide a concise (and correct) response

3) A not so expert throws out an incorrect solution

4) The feeding frenzy begins, and the TS is nowhere to be found

Good entertainment I must say
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Oct 15, 2010 12:07 am
Reply with quote

and at a good price
Back to top
View user's profile Send private message
ThiruvenkatNathan

New User


Joined: 12 Oct 2010
Posts: 27
Location: Bangladesh

PostPosted: Tue Oct 19, 2010 11:58 am
Reply with quote

@ expat , dick , Anuj , dbz

hi.. as far as i have known you guys are the most knowledgable persons in this forum and you try to help each n every one of 'em who posts queries.. and i have just one request from my end..

> Please stop helping ungreatful people who dont even care to reply and waste your precious time .. And please dont give the direct solution if they have not r(eferred)tfm or s(earched)tfw.. and i am ashamed to point out one major thing which is only ppl from India ( my country ) do this most of the time .. icon_sad.gif

sorry if i had been rude ( and i hope i dont get any warning from admin ) but i thought this needed to be said.. My kind request is please assist those who deserve and those who come up with challenging queries..

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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 19, 2010 12:26 pm
Reply with quote

Hi Nathan!
that' s more easy to say than to do it effectively
too often when we refer people to the manuals or as I do, often close the replies with
Quote:
given your attitude
it would be useful for you to read and meditate on
How To Ask Questions The Smart Way
catb.org/~esr/faqs/smart-questions.html
to make the most out of the questions You ask


a discussion starts on how we are not helpful at all
not to talk when the TS whines about
- I need ASAP ( get a paid for consultant )
- I thought to ask here to save time ( so You can just waste our time )
- I know I should ask my support but they ... ( a forum is not a foster home for poor organization's orphans )
- I am unable to find the manual ( if You are not even able to find the manuals an IT career might not be the proper choice )
- add as many stupid excuses as You want

I had some heavy discussion on people not asking their peers and
the excuse was that India is a very competitive environment and asking a peer would shed a bad light on the person seeking informations
I made a nasty comment and ... the fight started

and ... most of the times the answer could be found by searching the forums, looking at the manuals, or googling

naah! icon_biggrin.gif You were not rude at all
Back to top
View user's profile Send private message
ThiruvenkatNathan

New User


Joined: 12 Oct 2010
Posts: 27
Location: Bangladesh

PostPosted: Tue Oct 19, 2010 12:46 pm
Reply with quote

Hi Enrico ,

From your previous posts in this forum i found out your link on " how to ask questions in a smart way " long time ago and learned a lot ( really lot ) on the basic manners which we are supposed to have..

And most of the times , like you said questions can be resolved if we just have a look at it carefully.. I have seen many of 'em post the actual code and asking solution !!

Have some Professional ethics people . And another thing is may be a filter can be designed to remove the queries once it is posted which have the subject line " asap , urgent , help plzz ".. because obvioulsy they might be stupid questions asked without being researched upon as you can see that they are " in urgent need of help !! "

And thank you so much for that link.. Very very helpful icon_smile.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

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top