http://en.wikipedia.org/wiki/List_of_Oz_characters#Guardian_of_the_Gates wrote:
<<The Guardian of the Codes is a character in several of the Oz books. He is never known by any other name, but he is depicted as a singular character who lives in a small room, based on its description significantly larger than a standard guardhouse, in the wall of the Emerald City.
In The Wonderful Wizard of Oz and The Marvelous Land of Oz, his function is to tie green spectacles around the heads of all visitors to the Emerald City, on the grounds that the glittering rays of the City would cause blindness. These are locked onto all citizens' and visitors' heads, and the Guardian has the only key.
After The Marvelous Land of Oz, he abandoned the practice, for General Jinjur's Army of Revolt and Tippetariushad all entered the city without damage to their eyes. The spectacles were the idea of the Wizard of Oz to make the city appear greener than it actually is. The Guardian of the Codes appears only occasionally after this book, and his duty becomes significantly lighter.
In The Patchwork Girl of Oz when Ojo the Lucky reaches the city, he and his companions are taken into the Guardian's room, where the Soldier with the Green Whiskers tells the Guardian of the Codes that he has a note from Ozma that Ojo is to be taken prisoner. So the Guardian of the Codes removes the traditional prison garb, a white robe that completely covers the prisoner, from a closet and places it on Ojo and leaves the Soldier with the Green Whiskers in charge of him.
In John R. Neill's Oz books, the Guardian of the Codes and the Soldier with the Green Whiskers are frequently shown as friends, but the subsequent books of Jack Snow give the duty to Omby Amby (the Soldier's name), and there is no entry for the Guardian of the Codes in Snow's Who's Who in Oz. In Neill's The Scalawagons of Oz, the Guardian mentions a desire to visit his cousin, Oompa, which may explain, in-universe, why Omby Amby is fulfilling that function. Further confusion is created in the MGM movie, in which both roles are played by Frank Morgan, and publicity referred to the Guardian's equivalent as "the Doorman" and the Soldier's equivalent as "the Guard". No other Guardian of the Codes is described in any of Baum's books, aside from a stout woman who takes over the function during Jinjur's rule. In The Marvelous Land of Oz musical, in which the role was originated by Steve Huke, the Guardian is conflated with the man interviewed doing housework, and he also claims to have a wife and ten children, a claim not made by anyone in the book.
The Guardian of the Codes had his own eponymous song, written in bass clef, in The Wizard of Oz musical extravaganza, by Baum and composer Paul Tietjens, but it was cut after only two performances and never made it to Broadway, although the sheet music was published for consumer use.