Wow, that's an AWESOME question. Probably the best I've seen here.
OK, speaking as an officer, here's my thoughts. I'm no more qualified to answer this than anyone else I know--call it an educated guess.
First off, surrender is obviously only a last resort--when you realize that your unit no longer has the means to EFFECTIVELY resist, meaning that you could inflict no meaningful casualties or damage upon the enemy and further resistance would mean your deaths.
Secondly, the code of conduct technically only applies once you become a prisoner of war, so it isn't immediately in effect upon the order of a surrender. You have to actually be a POW.
If I was put in some unimaginable position which required surrender, I would expect my order to be followed. Short of some circumstance like "die in place" orders from above, my surrender order would be a lawful one, meaning those under me would be required to carry it out. I'm supposed to be the one with the info and I'm supposed to have the best understanding of the battlespace. For others beneath me to make their own decisions without knowing the big picture could further endanger us all.
My thoughts would be to escape and evade if at all possible, and definitely leave surrender as a lost possible option.
Honestly though, I can't imagine any enemy we, as Americans, will fight in the near future who would give any quarter to surrendering troops. Better to die on your feet with rifle in hand than to end up beheaded in some sick video for al-Jazeera. If all I had left was my teeth, you can bet I'd be biting some terrorists rather than go quietly and meekly to my death.