View previous topic :: View next topic
|
Author |
Message |
jaytolliver
New User
Joined: 14 Feb 2006 Posts: 2
|
|
|
|
Hello, I'm looking for a means of coping one column of data (from input dsn #1) to another column of data (from input dsn #2) to form output dataset.
example
input#1:
a2345
b1234
input#2
DataA1
DataB2
DataB4
output:
co a2345 gro(dataa1) own(dataa1)
co a2345 gro(datab2) own(datab2)
co a2345 gro(datab4) own(datab4)
co b1234 gro(dataa1) own(dataa1)
co b1234 gro(datab2) own(datab2)
co b1234 gro(datab4) own(datab4)
Essentially, I'm copy a list of userID to a string of groups. I'm sure this has been addressed before, but I have not be successful in finding examples on how to address this... any assistance would be appreciated. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have SyncSort? Does your version support JNFnCNTL files for JOINKEYS? |
|
Back to top |
|
|
bodatrinadh
Active User
Joined: 05 Jan 2007 Posts: 101 Location: chennai (India)
|
|
|
|
Check this code --
Code: |
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD *
A2345
B1234
//SORTJNF2 DD *
DATAA1
DATAB2
DATAB4
//SORTOUT DD SYSOUT=*
//JNF1CNTL DD *
INREC OVERLAY=(81:C'0000')
//JNF2CNTL DD *
INREC OVERLAY=(81:C'0000')
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(81,4,A)
JOINKEYS FILES=F2,FIELDS=(81,4,A)
REFORMAT FIELDS=(F1:1,80,F2:1,80)
SORT FIELDS=COPY
OUTREC FIELDS=(C'CO ',1,5,X,C'GRO(',81,6,C')',X,C'OWN(',81,6,C')')
|
Output -
Code: |
CO A2345 GRO(DATAA1) OWN(DATAA1)
CO A2345 GRO(DATAB2) OWN(DATAB2)
CO A2345 GRO(DATAB4) OWN(DATAB4)
CO B1234 GRO(DATAA1) OWN(DATAA1)
CO B1234 GRO(DATAB2) OWN(DATAB2)
CO B1234 GRO(DATAB4) OWN(DATAB4)
|
Thanks,
-3nadh |
|
Back to top |
|
|
jaytolliver
New User
Joined: 14 Feb 2006 Posts: 2
|
|
|
|
excellent.. thanks to all |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You only need one byte, with the same value, set in each of the JNFnCNTL files.
Can be INREC BUILD instead of OUTREC FIELDS.
FIELDS is overloaded, and exists in INREC/OUTREC/OUTFIL for backwards-compatibility. |
|
Back to top |
|
|
|