I have a below JCL. My input file has 5 fields,
Field1: Position 1 to 3(Primary Key)
Field2: Position 3 to 6
Field3: Position 7 to 9
Field4: Position 10 to 17
Field5: Position 18 to 20
I am trying to Sum two fields on the input file based on the Primary Key.
//SORTIN DD *
CDE00010020170831
CDE100000 ABC
CDE00010020170831
CDE100000 ABC
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=(4,3,ZD,7,3,ZD)
/*
CDE00010020170831
CDE100000 ABC
CDE00010020170831
CDE100000 ABC
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=(4,3,ZD,7,3,ZD)
/*
Actual Result:
CDE20020020170831
Expeced Result:
CDE20020020170831ABC
CDE20020020170831
Expeced Result:
CDE20020020170831ABC
My expectation is when Value for a particular field is empty, take the value from next record. Can this be achieved using SORT?
Thank You.