View previous topic :: View next topic |
Author |
Message |
webel Beginner
Joined: 01 Dec 2006 Posts: 2 Topics: 1
|
Posted: Mon Jan 22, 2007 8:17 am Post subject: Syncsort - tacking on one record to multiple records |
|
|
Hi; I'm trying to combine one file entry row of a fixed value to multiple rows in another file. There is no key to join on. I just want to tack the first file to each entry in the second file. For example:
File 1: 22JAN2007
File 2: aaa bbb ccc
zzz yyy xxx
I'd like the output file to look like:
22JAN2007 aaa bbb ccc
22JAN2007 zzz yyy xxx
I'm not a syncsort expert...I'm sure this can be done, but not quite sure how.... |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Mon Jan 22, 2007 9:32 am Post subject: |
|
|
webel,
You can use symbols to pass constant values. Try this job. I assumed that your input files are both 80 bytes Fb recfm. We generate a symbol named "FILE1_VALUE" from file1 and use it later to attach the constant to all records in file2
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
22JAN2007
//SORTOUT DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
OPTION STOPAFT=1
SORT FIELDS=COPY
OUTREC FIELDS=(C'FILE1_VALUE,C''',01,09,
C'''',80:X)
/*
//STEP0200 EXEC PGM=SORT
//SYMNAMES DD DSN=&T1,DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAA BBB CCC
ZZZ YYY XXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(FILE1_VALUE,01,80)
/*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
webel Beginner
Joined: 01 Dec 2006 Posts: 2 Topics: 1
|
Posted: Mon Jan 22, 2007 12:39 pm Post subject: |
|
|
Hi kolusu; Thanks, that worked perfectly!  |
|
Back to top |
|
 |
nagarajan.dharani Beginner
Joined: 04 Apr 2007 Posts: 20 Topics: 4
|
Posted: Fri May 25, 2007 8:25 am Post subject: |
|
|
Hi,
I am trying with the below code. If the OPTION STOPAFT=1 is not given
the sort card fails with duplicate symbol definition as this sort card process
only 1 record from the input file. If I have multiple records in the file and is it possible to store the values for the FILE1_VALUE as an array.
Thanks,
Dharani
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
22JAN2007
//SORTOUT DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
OPTION STOPAFT=1
SORT FIELDS=COPY
OUTREC FIELDS=(C'FILE1_VALUE,C''',01,09,
C'''',80:X)
/*
//STEP0200 EXEC PGM=SORT
//SYMNAMES DD DSN=&T1,DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAA BBB CCC
ZZZ YYY XXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(FILE1_VALUE,01,80)
|
|
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Fri May 25, 2007 8:29 am Post subject: |
|
|
Quote: |
If I have multiple records in the file and is it possible to store the values for the FILE1_VALUE as an array.
|
nagarajan.dharani,
Show us an example data and also show us how you would like to use that data in the next step
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
nagarajan.dharani Beginner
Joined: 04 Apr 2007 Posts: 20 Topics: 4
|
Posted: Fri May 25, 2007 9:14 am Post subject: |
|
|
Hi kolusu,
Following is my requirement
I have two files file1 and file2. I am sorting the file1 and i have a include cond in this sort. Include cond is field1 in file1 should be present in a set of values
The set of values are from a field of all the records in file2.
Example in file2 there are many records. Following are the filed2 values in file2
field2
1
3
5
7
9
file1 should be sorted out with an include cond (filed1 is equal to (1,3,5,7,9))
Can you pls let me know if this is possible?
Thnx,
Dharani |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Fri May 25, 2007 9:21 am Post subject: |
|
|
nagarajan.dharani,
That's 2 file match and has been covered many times here. Search for "joinkeys" in the utilities forum and you will find many examples
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
nagarajan.dharani Beginner
Joined: 04 Apr 2007 Posts: 20 Topics: 4
|
Posted: Fri May 25, 2007 10:50 am Post subject: |
|
|
Kolusu,
I am not able to get the exact code. Can you pls help me out?
Thanks,
Dharani |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri May 25, 2007 6:11 pm Post subject: |
|
|
nagarajan.dharani,
Most of the frequently asked questions are already covered in our exclusive FAQ pages. Please check them before posting your queries.
Check here for JCL/SORT FAQs...
http://www.mvsforums.com/helpboards/viewforum.php?f=22
Thanks,
Phantom |
|
Back to top |
|
 |
|
|