I need create two output files:
- The first, with the same structure that input FILE1 + FIELD2, FIELD4 and FILE5 of FILE2. In this OUTPUT FILE1 write records that found at two files
I am guessing that you had a typo , you actually need field 1 from file2.
Assuming that FIELD2 of file 1 and FIELD3 of file2 have only positive numbers, then the following DFSORT JCL will give you the desired results. If you have negative numbers then we need to normalize the packed decimal fields before joining. Let me know if that is the case.
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=Your input file 1 of lrecl 18,DISP=SHR
//INB DD DSN=Your input file 2 of lrecl 16,DISP=SHR
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *