Split: File into multiple and keeping the same 3 lines from input into all output files

The following code will split the infile into multiple files. However, I need it to insert the same first 3 lines from the original input file into each splitted file. How do I modify my script below to do so:

print -n "Enter file name to split? " ; read infile
if [ -z "$infile" ]
then
echo "Invalid file name entered ..."
exit 255
fi
print -n "Enter Number of files to split it into? " ; read numf
if echo $numf | egrep -q '^[2-9]{1}$'; then
echo
else
echo "Invalid number <$numf> entered. Entry must be numeric and 1 digits in length and between 2 and 9 ..."
exit 255
fi
echo "Splitting file $infile into $numf files ....."
sleep 2
awk '{a[NR]=$0}END{for(i=1;i<=NR;i++)print a > "'split.$infile.'" 1+int(n*((i-1)/NR))}' n=$numf $infile
echo "Done...."

Show the input you have and the output you want please.

Replace

awk '{a[NR]=$0}END{for(i=1;i<=NR;i++)print a > "'split.$infile.'" 1+int(n*((i-1)/NR))}' n=$numf $infile

with

awk 'NR<=3{a=(a"")?a RS $0:$0;next}
NR==4{for(i=1;i<=n;i++) print a > "split." FILENAME i}
{print > "split." FILENAME ((d=(NR-3)%n)?d:n)}' n=$numf "$infile"

Thank you. I ran it using your new awk. Then I combined them using cat file1 ..etc > combined-file to see if missed any entries after removing the first 3 lines from file 2 ..etc. Then i did a diff combined-file <original input combine file before the split>, I get a discrapancy I think due to some hidden format characters changes in the new split file. When I used my version of the awk i get none. How can fix it?

Here is a sample of discrapancies due to some formatting issue of the new AWK:

3255a3096,3097 <- Not in the files, but shows when doing a diff
> |9787771000|
> |9787772000|
3256a3099,3100 <-- causing a diff !!
> |9787804000|

Thanks

---------- Post updated at 04:05 PM ---------- Previous update was at 03:03 PM ----------

Input file:

|cast_me_query|Continue|
|name_list|0002|queue_status=active|
|begin|
1235456677777777
2169058906897090
4893859489485958
0977256252716167

Basically i will need to keep the first 3 lines in all split files. for ex:

file1:

|cast_me_query|Continue|
|name_list|0002|queue_status=active|
|begin|
1235456677777777
2169058906897090

file2:

|cast_me_query|Continue|
|name_list|0002|queue_status=active|
|begin|
4893859489485958
0977256252716167

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

no output after run the command, but you will have several new files generated : file1 file2 etc.

awk 'NR<4{s=s==""?$0:s RS $0;next} {a=s RS $0;getline;print a RS $0 > "file" ++i ;a=""}' infile