I'm using the SYMNAMES file to join files with JOINKEYS. It work but I have the problem that when I want to build a output file I can't use the fields names on SYSMNAMES because the position of the files are relatives from the begining of the file and as I'm using the REFORMAT card, it don't work correctley...
I meen
//SYMNAMES DD DISP=SHR,DSN=FICHE1
// DD DISP=SHR,DSN=FICHE2
(the files:)
FILE1_REGIS,1,16
FILE1_FIELD1,1,4,CH
FILE1_FIELD2,5,2,CH
FILE1_FIELD3,7,10,CH
FILE2_FIELD,1,17
FILE2_FIELD1,1,4,CH
FILE2_FIEL2,5,7,CH
FILE2_FIELD3,12,6,CH
FILE1 RECORDS:
0001AA1111111111
0002BB2222222222
0003CC3333333333
FILE2_RECORDS:
00020000001YYYYYY
00030000003ZZZZZZ
OUTPUT FILE
0002BB0002BB22222222220
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILE=F1,FIELDS=(FILE1_FIELD1,A),
INCLUDE=(FILE1_FIELD1,EQ,C'0011',AND, )
JOINKEYS FILE=F2,FIELDS=(FILE2_FIELD1,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:FILE1_REGIS,F2:FILE2_REGIS,?),FILL=C'*'
OUTFIL FNAMES=SALIDA,
INCLUDE=(34,1,CH,EQ,C'B'),
BUILD=(FILE1_FIELD1,FILE1_FIELD2,FILE2_FIELD1,FILE2_FIELD2,FILE2_FIELD3)
// DD DISP=SHR,DSN=FICHE2
(the files:)
FILE1_REGIS,1,16
FILE1_FIELD1,1,4,CH
FILE1_FIELD2,5,2,CH
FILE1_FIELD3,7,10,CH
FILE2_FIELD,1,17
FILE2_FIELD1,1,4,CH
FILE2_FIEL2,5,7,CH
FILE2_FIELD3,12,6,CH
FILE1 RECORDS:
0001AA1111111111
0002BB2222222222
0003CC3333333333
FILE2_RECORDS:
00020000001YYYYYY
00030000003ZZZZZZ
OUTPUT FILE
0002BB0002BB22222222220
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILE=F1,FIELDS=(FILE1_FIELD1,A),
INCLUDE=(FILE1_FIELD1,EQ,C'0011',AND, )
JOINKEYS FILE=F2,FIELDS=(FILE2_FIELD1,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:FILE1_REGIS,F2:FILE2_REGIS,?),FILL=C'*'
OUTFIL FNAMES=SALIDA,
INCLUDE=(34,1,CH,EQ,C'B'),
BUILD=(FILE1_FIELD1,FILE1_FIELD2,FILE2_FIELD1,FILE2_FIELD2,FILE2_FIELD3)