|
|
| Author |
Message |
srramesh Currently Banned New User
Joined: 11 Jul 2008 Posts: 10 Location: Chennai
|
|
|
|
Hi tell me syntax for merging two different files?
sysin dd=*
merge fields=(2,3,ch,a)
/*
is it correct?[/img] |
|
| Back to top |
|
 |
References
|
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1130 Location: Mumbai - India
|
|
|
|
ramesh,
| Quote: |
Hi tell me syntax for merging two different files?
|
Refer to the manuals.
It should be
| Code: |
//SYSIN DD *
MERGE FIELDS=(1,5,CH,A,10,5,CH,A)
/*
|
SORTINnn will have input files to be merged. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 244 Location: USA
|
|
|
|
| srramesh wrote: |
Hi tell me syntax for merging two different files?
sysin dd=*
merge fields=(2,3,ch,a)
/*
is it correct?[/img] |
That all depends on what you mean by "merge".
If the 2 files are pre-sequenced with the same sort order, and you simply want your output file to contain all the records from both input files, then you can code the following:
| Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=input.file1
//SORTIN02 DD DSN=input.file2
//SORTOUT DD DSN=output.file
//SYSIN DD *
MERGE FIELDS=(2,3,CH,A)
/* |
However, if they are not pre-sequenced, then you can use the following:
| Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input.file1
// DD DSN=input.file2
//SORTOUT DD DSN=output.file
//SYSIN DD *
SORT FIELDS=(2,3,CH,A)
/* |
If you do not mean "merge" the data sets, but rather "merge" the records (i.e., merge a record from File1 with a record from File2), let me know and I can provide you with the JCL for a SyncSort JOIN application.
Hope this helps. |
|
| Back to top |
|
 |
srramesh Currently Banned New User
Joined: 11 Jul 2008 Posts: 10 Location: Chennai
|
|
|
|
| [img][/img] |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8602 Location: 221 B Baker St
|
|
|
|
Hello,
Better try again. . . Nothing was posted.
It appears you tried to use "img". It is best to use "Code". Please do not try to attach images or screen shots.
When posting, it is a good idea to use Preview so you can see what your post will look like to the forum rather than just what you see in the Reply editor. After Preview, you must click Submit. . . |
|
| Back to top |
|
 |
srramesh Currently Banned New User
Joined: 11 Jul 2008 Posts: 10 Location: Chennai
|
|
|
|
| how to upload my prog...like screenshots... |
|
| Back to top |
|
 |
arcvns
Senior Member
Joined: 17 Oct 2006 Posts: 707 Location: Chennai, India
|
|
|
|
Ramesh,
Cut Paste your code.
Select the entire code...click the "Code" button...
"Preview" to see everything is fine and then Submit.
Thanks,
Arun |
|
| Back to top |
|
 |
Bharath Nadipally
New User
Joined: 24 Jun 2008 Posts: 20 Location: Hyderabad
|
|
|
|
Alissa Margulies,
Is it possible to merge fields using SORT? If so, can u please give me the logic? |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8602 Location: 221 B Baker St
|
|
|
|
Hello,
Sample MERGE code was posted. Does this not meet your requirement?
If not, you need to post sample input data for 2 files and the output you want from the sample input. Please also menton the recfm and lrecl of the 3 files.
If you are not trying to merge 2 files into a 3rd file, please clarify. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 244 Location: USA
|
|
|
|
| Bharath Nadipally wrote: |
| Is it possible to merge fields using SORT? If so, can u please give me the logic? |
Are you asking if SORT can produce a record with some fields from File1 and other fields from File2? YES, using JOIN.
If this is not what you are asking, then you need to provide sample data from both input files and your expected output, as Dick has requested. |
|
| Back to top |
|
 |
Bharath Nadipally
New User
Joined: 24 Jun 2008 Posts: 20 Location: Hyderabad
|
|
|
|
Hi,
My requirement is as below.
File1:
field1
field2
field3
File2:
field4
field5
field6
File3(Output file):
field1 field4
field2 field5
field3 field6 |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8602 Location: 221 B Baker St
|
|
|
|
Hello,
You mention "fields" but what you've posted are records. . .
It will help if you use "real" record and field names and show sample content for those names. Things like account number, amount-due, zip-code, etc.
Keep in mind that a file typically contains records and records contain fields. Every time a file "read" is issued one record is read, not one field.
When posting technical questions it is best to stay with the existing terminology and not introduce new ways of saying things. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 244 Location: USA
|
|
|
|
Bharath,
Is there a common key field between File1 and File2. It does not have to be in the same position for File1 and File2... |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 244 Location: USA
|
|
|
|
| ... Or, do you simply want to pair Record1 from File1 to Record1 of File2, and Record2 from File1 with Record2 of File2, etc... |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4574 Location: San Jose, CA
|
|
| Back to top |
|
 |
|
|