understanding awk in this script

i am analyzing a query written by another developer ,need to understand part of script
am looking at a code ..and it converts comma files to pipe delimited and also takes away quotes from any columns,
source field format: 2510,"Debbie",NewYork
changes to
target: 2510|Debbie|NewYork

*************Script********
Line 1 cat $out_location/BACI_1000|\
Line 2 awk -v sep=' "" ' \ {
Line 3for (i=1;i<=length($0);i++)
Line 4 {ch=substr($0,i,1)
Line 5if (ch==sep)(inside-!inside}
Line 6if (inside&&ch=="|")
Line 7ch=","
Line 8 printf("%s".ch)
Line 9}
Line 10printf("\n")
Line 11}'>$out_location/aci_10temp

i am not sure why in line 1 is BACI_1000| with a pipe is referred instead of only ACI_1000
line 2 : what is SEP i know IFS is used for field separator ..is it same..also same line why is back slash used before curly brackets
line3:think it searches for lenght of column what does $0 refer here.. i know it refers to command itself in general but not clear
line 4:check for length of column in field 1
line 5:did not understand...(what is inside?)
line 6:did not understand
line 7: did not understand
line 8:does it print the column after removing quotes

please indent the code and use [CODE] tags