MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Syncsort - tacking on one record to multiple records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
webel
Beginner


Joined: 01 Dec 2006
Posts: 2
Topics: 1

PostPosted: Mon Jan 22, 2007 8:17 am    Post subject: Syncsort - tacking on one record to multiple records Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Mon Jan 22, 2007 9:32 am    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
webel
Beginner


Joined: 01 Dec 2006
Posts: 2
Topics: 1

PostPosted: Mon Jan 22, 2007 12:39 pm    Post subject: Reply with quote

Hi kolusu; Thanks, that worked perfectly! Very Happy
Back to top
View user's profile Send private message
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Fri May 25, 2007 8:25 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Fri May 25, 2007 8:29 am    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Fri May 25, 2007 9:14 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Fri May 25, 2007 9:21 am    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nagarajan.dharani
Beginner


Joined: 04 Apr 2007
Posts: 20
Topics: 4

PostPosted: Fri May 25, 2007 10:50 am    Post subject: Reply with quote

Kolusu,

I am not able to get the exact code. Can you pls help me out?

Thanks,
Dharani
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Fri May 25, 2007 10:56 am    Post subject: Reply with quote

nagarajan.dharani,

http://www.mvsforums.com/helpboards/viewtopic.php?p=22582#22582

http://www.mvsforums.com/helpboards/viewtopic.php?t=5399
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri May 25, 2007 6:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group