append existing file with zeroes bsed on position

Hi i am trying to append value with 0 to an existing file in the position 50-56 & 58-64 only where empty space is there

Rule:
1 row already has some value and i do not want to change anything for this row.
2nd record below you see the position 50-64 is empty, i want to replace with 0000000 from position 50-56 & 58-64.
3rd record same like 2nd record.
4th record same like 2nd record
5th record empty space is there only position 58-64.
6th record same like 2nd record.
7th record.......
8th record.........
..........
........etc.
like wise i may have many records in FILE1.

I want to write a program in .KSH where it append the FILE1 with zeroes on the position mention above and want the outfile FILE2. All the records will begin with no 2.

Any help is appreciated.

FILE1:

26666666660000001 B86860003OLFXXX592123320081227 0000002 0000003-
27777777770000653-B94030001OLFXXX000000120081227
28888888880000654-E71060001OLFXXX000000220081227
29999999990000655 E71060002OLFXXX000000320081227
21112223330000101 E71060002OLFXXX000000320081227 0000102
22222222220000201 E71060002OLFXXX000000320081227

FILE2:

26666666660000001 B86860003OLFXXX592123320081227 0000002 0000003-
27777777770000653-B94030001OLFXXX000000120081227 0000000 0000000
28888888880000654-E71060001OLFXXX000000220081227 0000000 0000000
29999999990000655 E71060002OLFXXX000000320081227 0000000 0000000
21112223330000101 E71060002OLFXXX000000320081227 0000102 0000000
22222222220000201 E71060002OLFXXX000000320081227 0000000 0000000

thanks

awk -F'[ |-]' '{$0=(NF==3)?$0 OFS f:((NF==2)?$0 OFS f OFS f:$0)}1' f="0000000" file

thanks danmero !!

I am getting the following error when i run your code

>awk -F'[ |-]' '{$0=(NF==3)?$0 OFS f:((NF==2)?$0 OFS f OFS f:$0)}1' f="0000000" wedtest3_appnd_zero.txt

awk: syntax error near line 1
awk: illegal statement near line 1
awk: syntax error near line 1
awk: bailing out near line 1

BTW in your code where is the input file parameter and output file parameter.

thnks

Use gawk, nawk or /usr/xpg4/bin/awk on Solaris.
file is the input and you can redirect the output to another file(2).