Create Pivot table

I would like to use awk to parse a file with three columns in, like:

Chennai,01,1
Chennai,07,1
Chennai,08,3
Chennai,09,6
Chennai,10,12
Chennai,11,19
Chennai,12,10
Chennai,13,12
Kerala,09,2
AP,10,1
AP,11,1
Delhi,13,1
Kerala,13,3
Chennai,00,3
Chennai,01,1
Chennai,02,1
Chennai,07,5
Chennai,08,5
Chennai,09,4
Chennai,10,15
Chennai,11,16
Chennai,12,9
Chennai,13,12

they represent the Circle the hour and the number of transactions.
There are thousand of lines, I would like to generate a single table
with hours as headers, the row name will be the Circle name, and the cells will be the sum of number of transaction for that Circle name
in that particular hour like:

=========== 0 1 2 3 4 5 6 7 ... 23
Chennai xxx xxx xxx ... . . . . . . . . . . . . . .
Kerala xxx xxx xxx ... . . . . . . . . . . . . . .
Delhi xxx xxx xxx ... . . . . . . . . . . . . . .
.
.
.
AP xxx xxx xxx ... . . . . . . . . . . . . . .

I only have access to the standard AWK as operating system HP-UX, no gawk ....

Thanks.

awk -F, 'END {
  printf "%-15s", ("name" OFS)
  for (i = 0; ++i <= 23;)
    printf "%02d%s", i, (i < 23 ? OFS : RS RS)
  for (C in c) {
    printf "%-15s", (C OFS)
    for (i = 0; ++i <= 23;) 
      printf "%02d%s", t[C, sprintf("%02d", i)], (i < 23 ? OFS : RS)              
    }  
 }
{ 
  t[$1, $2] += $3; c[$1]  
  }' infile

Input file is having data, they represent the Producttype,Circle,Hour,Servicetype,Count.
There are thousand of lines, I would like to generate a single table
with hours as headers, the row name will be the Circle|Producttype|Servicetype name,
and the cells will be the sum of number of transaction for that Circle name in that particular hour like:

Producttype,Circle,Hour,Servicetype,Count
Activation,Mumbai,20,13501,514
Activation,Mumbai,20,13502,27
Activation,Kerala,21,13501,1129
Activation,Kerala,21,13502,47
Activation,Mumbai,21,13501,600
Activation,Mumbai,21,13502,27
Activation,Kerala,22,13501,521
Activation,Kerala,22,13501,600
Activation,Kerala,22,13502,15
Activation,Mumbai,22,13501,205
Activation,Mumbai,22,13502,5
Activation,Mumbai,22,13502,500
Activation,Kerala,23,13501,242
Activation,Kerala,23,13502,1
Activation,Mumbai,23,13501,190
Activation,Mumbai,23,13502,1
PlanChange,Kerala,10,13502,18
PlanChange,Kerala,11,13502,11
PlanChange,Kerala,12,13502,2
PlanChange,Mumbai,14,13502,2
PlanChange,Kerala,15,13502,4
PlanChange,Mumbai,15,13502,7
PlanChange,Kerala,16,13502,1
PlanChange,Kerala,18,13502,1
PlanChange,Mumbai,18,13502,2
PlanChange,Mumbai,20,13502,1
PlanChange,Mumbai,21,13502,1
PlanChange,Mumbai,22,13502,4
PlanChange,Mumbai,23,13502,7

Radoulov Code using for Pivot table using awk command.

awk -F, 'END {
printf "%-36s", ("CIRCLE" OFS)
for (i = -1; ++i <= 23;)
printf "%04d%s", i, (i < 23 ? OFS : RS RS)
for (C in c) {
printf "%-38s", (C OFS)
for (i = -1; ++i <= 23;)
printf "%04d%s", t[C, sprintf("%02d", i)], (i < 23 ? OFS : RS)
}
}
{
t[$2,$1,$4,$3] += $5; c[$2,$1,$4]
}' ordercreated.txt

Result showing as

CIRCLE 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023
ORISSAServiceDisconnect13501 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0219 0052
PunjabServiceDisconnect13502 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0004 0000
DelhiVAS13501 0031 0013 0004 0002 0000 0000 0010 0015 0059 0139 2082 0153 0242 0166 0384 0591 0538 0481 0315 0235 0188 2925 2271 1208
DelhiVAS13502 0001 0000 0002 0000 0000 0000 0000 0001 0000 0014 0001 0006 0024 0007 0011 0018 0019 0002 0020 0008 0009 0006 0011 0007
UP(E)Suspend13502 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0002 0001 0001 0000 0000 0000 0000
Instead of above result, wanted result in format as
CIRCLE 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023
ORISSA|ServiceDisconnect|13501 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0219 0052
Punjab|ServiceDisconnect|13502 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0004 0000
Delhi|VAS|13501 0031 0013 0004 0002 0000 0000 0010 0015 0059 0139 2082 0153 0242 0166 0384 0591 0538 0481 0315 0235 0188 2925 2271 1208
Delhi|VAS|13502 0001 0000 0002 0000 0000 0000 0000 0001 0000 0014 0001 0006 0024 0007 0011 0018 0019 0002 0020 0008 0009 0006 0011 0007
UP(E)|Suspend|13502 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0002 0001 0001 0000 0000 0000 0000

try this,

 awk -F"," 'BEGIN{printf "Circle|Producttype|Servicetype|"
for(i=0;i<=23;i++){printf "%04d ",i;}printf "\n";}
NR>1{b[$2"|"$1"|"$4]++;a[$1"|"$2"|"$3"|"$4]+=$5} 
END {for(y in b) {printf "%s\t\t",y;for(i=0;i<=23;i++)
{for(k in a){split(k,x,"|");if(y==x[2]"|"x[1]"|"x[4] && i==int(x[3]))
{printf "%04d ",a[k];z=1} }
if(z==0){printf "%04d ",0;};z=0;}printf "\n";}}' ordercreated.txt