Hello,
There are a few errors in the SORT card you've shared.
1. The spaces between 'FIELDS = COPY', is incorrect; correct syntax is: 'SORT FIELDS=COPY'
2. The JOINKEYS statements can use DDNAMES only when you use 'F1=' or 'F2=', under all other cases it uses default *SORT keywords. If you have SYNCSORT manual then please refer that, else you can use the DFSORT manual for JOINKEYS keywords, SYNCSORT keywords use the same structure - at least for the JOINKEYS statements.
bharmf wrote:...
JOINKEYS FILES=FILE1,FIELDS=(5,13,A)
JOINKEYS FILES=FILE2,FIELDS=(5,13,A)
...
3. This is not an error, but more of a good to know and apply; JOINKEYS by default outputs PAIRED records. Basically if you drop the JOIN statement then *SORT will automatically JOIN the keys and output paired records.
4. You've mentioned 13 bytes of key, whereas your input shows 9 bytes of data only; do you want to revisit that?
Aside, here is a simple solution; I've used RECFM=FB, LRECL=80 input, you can tweak it further to fit your need; NOTE, this SORT card can be tweaked further and made cleaner. I'll leave it to you to tweak around it:
//FILE1 DD *
111111111 AAAAAA BBBBBBBB
222222222 BBBBBB CCCCCCCC
333333333 CCCCCCC AAAAAAAA
444444444 CCCCCCC AAAAAAAA
/*
//FILE2 DD *
111111111 AAAAAA BBBBBBBB
222222222 BBBBBB CCCCCCCC
444444444 CCCCCCC AAAAAAAA
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=FILE1,FIELDS=(1,9,A)
JOINKEYS F2=FILE2,FIELDS=(1,9,A)
REFORMAT FIELDS=(F1:1,9,F2:1,9)
SORT FIELDS=COPY
OUTFIL BUILD=(1,9)
/*
Output:
111111111
222222222
444444444
Hope this helps.
Just an afterthought:
a. If both the datasets already have SORTed and in sequence records, then add 'SORTED,NOSEQCK' to avoid resorting of data
b. Both the datasets appear to be superset/subset of each-other, which would mean that the source generating them 'can' be same; if so, why do you want to run the match on them?