sed copy column value add to certain area

I have a base file FILE1 with the following data

FILE1.dat

21111111110001343 000001004OLFXXX029100020091112
21111111110000060 000001004ODL-CH001000020091112
22222222220000780 000001013OLFXXX006500020091112
23333333330001695 000001039OLFXXX030600020091112
23333333330000111 000001039ODL-SP002000020091112
23333333330000060 000001039ODL-CH001000020091112
24444444440001416 000001045OLFXXX011800020091112

......
......
..etc

i want to write a program in .KSH that the FILE2.dat should have only 4 unique records like below appending two new columns spouse_col & child_col at the end of each line based on position.
Remember this should be in while read line do loop

ODL-Ch = child_col , 
ODL-Sp = spouse_col
 
if ODL-SP then grab position 11-18 and copy to the position 50-57
elif ODL-CH then grab position 11-18 and copy to the position 58-65
fi

FILE2.DAT
blue color is mapped to spouse_column and red color mapped to child_column

21111111110001343 000001004OLFXXX029100020091112 0000000 0000060
22222222220000780 000001013OLFXXX006500020091112 0000000 0000000
23333333330001695 000001039OLFXXX030600020091112 0000111 0000060
24444444440001416 000001045OLFXXX011800020091112 0000000 0000000

thanks

That works with your sample data

# IMPORTANT : we assume that the input file is sorted
function Output () { echo "${BASE} ${SP:-0000000}XXX${CH:-0000000}" ; }
{    while read LINE
     do
          #~ echo ${LINE:27:6}
          if [ "${LINE:27:3}" = "OLF" ]
          then
               [ -n "$BASE" ] && Output
               BASE="${LINE}XXX"; SP=""; CH=""
          fi
          [ "${LINE:27:6}" = "ODL-SP" ] && SP=${LINE:10:7}
          [ "${LINE:27:6}" = "ODL-CH" ] && CH=${LINE:10:7}
     done < FILE1.dat
     Output
} > FILE2.dat

You asked a practically identical question here:
The script that I provided there creates this output with your slightly altered FILE1.DAT above:

$> cat FILE2.DAT
21111111110001343 000001004OLFXXX029100020091112 0000000 0000060
22222222220000780 000001013OLFXXX006500020091112 0000000 0000000
23333333330001695 000001039OLFXXX030600020091112 0000111 0000060
24444444440001416 000001045OLFXXX011800020091112 0000000 0000000