Why, after the job bitmask, do you write "63" for the upper ?
in the doc about the itemdb it says:
Upper: Equippable upper-types. Uses the following bitmasks:
1: Normal jobs
2: Upper jobs
4: Baby jobs
So you should put 7 instead of 63
Same thing for the "1024" in Loc.
Try putting 256 for up headgear, 512 for middle, 1 for low, and you add 512 and 256 if you want a hat who take both emplacement (up and mid.
Try this, and tell me.
20137,Enchanted_Magical_Hat,Enchanted_Magical_Hat,5,1000,,200,,2,,0,0xFFFFFFFF,7,2,256,,0,1,1312,{bonus bAllStats,3;},{},{}