cutting fields and doing trim in awk

hi,
I have this code:

#!/usr/bin/ksh

#SERVICES
gzcat *SERVICES* | awk '  
{
SUBSCRIBERNUMBER=substr($0,1,20) 
SUBSCRIBERNUMBER=trim(SUBSCRIBERNUMBER)
SERVICECODE=substr($0,22,61) 
SERVICECODE=trim(SERVICECODE)
STARTDD=substr($0,63,72) 
STARTDD=trim(STARTDD)
STARTDT=substr($0,74,81) 
STARTDT=trim(STARTDT)
ENDDD=substr($0,83,92)
ENDDD=trim(ENDDD)
ENDDT=substr($0,94,101) 
ENDDT=trim(ENDDT)
BASICSERVICE=substr($0,103,150) 
BASICSERVICE=trim(BASICSERVICE)
print SUBSCRIBERNUMBER","SERVICECODE","STARTDD","STARTDT","ENDDD","ENDDT","BASICSERVICE}
function ltrim(s) { gsub(/^ +/, "", s); return s }
function rtrim(s) { gsub(/ +$/, "", s); return s }
function trim(s)  { return rtrim(ltrim(s)); }
'

this code should slice a file that has fixed positions and then clean the spaces for each fields and in the end save it like a csv file.
I'm missing something and it is not creating the final lines correctly, it is replicating fields.
insted of and output like:

SUBSCRIBERNUMBER","SERVICECODE","STARTDD","STARTDT","ENDDD","ENDDT","BASICSERVICE

i have:

03002000001         ,NWD                                      2006-04-08 16:14:02 ,2006-04-08 16:14:02                     NORM                            ,16:14:02                     NORM                                            ,                    NORM                                            ,         NORM                                            ,NORM                                            

can someone help me out on this?

best regards,
Ricardo Tom�s

Hi,
I found the problem.
No need for an answer. The error was simple: too much time without sleeping and working :S