//SORT1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN=INFILE1
//SORTJNF2 DD DISP=SHR,DSN=INFILE2
//SORTOF01 DD DSN=OUTFILE1,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SORTOF02 DD DSN=OUTFILE2,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SORTOF03 DD DSN=OUTFILE3,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(8,8,A)
JOINKEYS FILE=F2,FIELDS=(8,8,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F2:1,31,F1:1,31)
SORT FIELDS=COPY
OUTFIL FILES=03,INCLUDE=(1,1,CH,EQ,C' '),BUILD=(32,31)
OUTFIL FILES=02,INCLUDE=(32,1,CH,EQ,C' '),BUILD=(1,31)
OUTFIL FILES=01,SAVE,BUILD=(1,31)
/*
//*
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN=INFILE1
//SORTJNF2 DD DISP=SHR,DSN=INFILE2
//SORTOF01 DD DSN=OUTFILE1,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SORTOF02 DD DSN=OUTFILE2,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SORTOF03 DD DSN=OUTFILE3,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE)
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(8,8,A)
JOINKEYS FILE=F2,FIELDS=(8,8,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F2:1,31,F1:1,31)
SORT FIELDS=COPY
OUTFIL FILES=03,INCLUDE=(1,1,CH,EQ,C' '),BUILD=(32,31)
OUTFIL FILES=02,INCLUDE=(32,1,CH,EQ,C' '),BUILD=(1,31)
OUTFIL FILES=01,SAVE,BUILD=(1,31)
/*
//*
This works perfectly fine but I have got thru only part of my requirement.
My Input Data (not showing in hex format, confusing!!, so giving the equivalents here)
Both file 1 and file 2 has same layout
fields defined as follows
file no 1-13 (packed decimal) - Occupies 1,7 bytes
pol seq 14-21(char) - Occupies 8,8 bytes
amount 22-32 (packed decimal, 2 decimals) - Occupies 16,6 bytes
tran date 34-42 (char) - Occupies 22,10 bytes
File1:
0000000012345AZ0000010000002935010\12\2009
0000000012346AZ0000020000001935010\12\2010
0000000012347AZ0000030000000935010\12\2011
0000000012348AZ0000040000000835010\12\2012
File2:
0000000012346AZ0000020000001935010\12\2010
0000000012347AZ0000030000000935010\12\2011
0000000012348AZ0000040000001835010\12\2012
0000000012349AZ0000050000000735010\12\2013
What I have arrived so far is the 3 output files
a) present in file 1 but not in file 2
b) present in file 2 but not in file 1
c) present in both files
Output required (although the current LRECL I have given as 31, It will be in total 61 bytes for my remarks field)
a) present in file 1 but not in file 2 (additional remark at 32,30 - 'PRESENT only in file1')
b) present in file 2 but not in file 1 (additional remark at 32,30 - 'PRESENT only in file2')
c) present in both files (additional remark at 32,30 - 'DIFF AMOUNT'- numeric value of difference between amount fields file1-file2)
sample output 1:
0000000012346AZ0000020000001935010\12\2010 DIFF AMOUNT : 000000000.00
0000000012347AZ0000030000000935010\12\2011 DIFF AMOUNT : 000000000.00
0000000012348AZ0000040000001835010\12\2012 DIFF AMOUNT :-000000100.00
Anyhelp on letting me to commands or ways I could use to achieve this is much appreciated!!