Pitching Into, and Out Of, a Jam

How would you define a "jam" in pitching terms? Usually it means 2 or more runners with fewer than 2 outs. Often a pitcher "pitches out of a jam" by limiting the amount of runs scored as the result of getting the third out. Should there be a measure of percentage, that is, out of x jams, the pitcher was able to pitch out of y of them.

What about pitchers that pitch into a jam? That is, let 2 more runners on base with less than 2 outs, say? How would you measure not pitching into jams to begin with? Would you get a -1 for pitching into a jam and then +1 to pitch out of it?