Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
Please, use code/tags to provide code/data!
Also, what have you tried yourself to achieve the requirement?
Quote: |
If the key is present in file 1 only then write the record from 2nd file with prefix as DE |
This is not possible as there is no matching data in F2. Maybe you meant F1 (aka 1st DSN)? |
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
See this sample for FB80 input. Adapt this to your requirement.
Code: |
//WHATEVER EXEC PGM=SORT
//F1 DD *
12345678912ABCDEF
23456789123ABC
34567891234DEF
/*
//F2 DD *
12345678912ABCDEF
23456789123ABCD
45678912345XYZ
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=F1,FIELDS=(1,11,A)
JOINKEYS F2=F2,FIELDS=(1,11,A)
JOIN UNPAIRED
REFORMAT FIELDS=(?,F1:1,80,F2:1,80)
OUTFIL FNAMES=(SORTOUT),
OMIT=(1,1,CH,EQ,C'B',AND,2,80,CH,EQ,82,80,CH),
REMOVECC,
IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),BUILD=(C'AD',82,80)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),BUILD=(C'DE',2,80)),
IFTHEN=(WHEN=NONE,BUILD=(C'CH',82,80))
END
/* |
|
|