user1667: I'm writing a PGN file parser, and need to know in which situations you don't need to write the rank/file of a piece that makes the move. I can think of the following:

only one piece can conduct the move according to the rules of movement (i.e. attempting to move a bishop horizontally - that's obvious).
both pieces can move to the given square, but all but one are obstructed by other pieces
all but one of the pieces are pinned and moving them would expose the king to check

Anything else I'm missing? 
I'd also like to add some seemingly ambiguous situations:

Black to move. Is Nc5+ valid PGN, or would it be Nbc5+? Is Nc5 valid, or would it be Nec5?

Black to move. Is Rg7# / Rg7+ valid PGN, or do I need to specify the rank here?
What if two pieces can move to the same square, but one of the moves would result in threefold repetition, and the game doesn't stop instantly?
What if two pieces can move to the same square, one of those moves forces a mate-in-one on the moving side, and the move is labeled "!!"? :)

user1485: From the PGN specification (http://www6.chessclub.com/help/PGN-spec):

Neither the appearance nor the absence of either a check or
  checkmating indicator is used for disambiguation purposes.  This means
  that if two (or more) pieces of the same type can move to the same
  square the differences in checking status of the moves does not
  allieviate the need for the standard rank and file disabiguation
  described above.  (Note that a difference in checking status for the
  above may occur only in the case of a discovered check.)

This means you have to specify files respectively ranks in your two diagram examples.
My understanding is that you need to disambiguate in the last two situations you describe as well. 

1667: <p>I'm writing a PGN file parser, and need to know in which situations you don't need to write the rank/file of a piece that makes the move. I can think of the following:</p>

<ul>
<li><p>only one piece can conduct the move according to the rules of movement (i.e. attempting to move a bishop horizontally - that's obvious).</p></li>
<li><p>both pieces can move to the given square, but all but one are obstructed by other pieces</p></li>
<li><p>all but one of the pieces are pinned and moving them would expose the king to check</p></li>
</ul>

<p>Anything else I'm missing? </p>

<p>I'd also like to add some seemingly ambiguous situations:</p>

<p><img src="https://i.stack.imgur.com/GjWux.png" alt="Position #1"></p>

<p>Black to move. Is Nc5+ valid PGN, or would it be Nbc5+? Is Nc5 valid, or would it be Nec5?</p>

<p><img src="https://i.stack.imgur.com/AdiFG.png" alt="Position #2"></p>

<p>Black to move. Is Rg7# / Rg7+ valid PGN, or do I need to specify the rank here?</p>

<p>What if two pieces can move to the same square, but one of the moves would result in threefold repetition, and the game doesn't stop instantly?</p>

<p>What if two pieces can move to the same square, one of those moves forces a mate-in-one on the moving side, and the move is labeled "!!"? :)</p>
 1485: <p>From the PGN specification (<a href="http://www6.chessclub.com/help/PGN-spec" rel="noreferrer">http://www6.chessclub.com/help/PGN-spec</a>):</p>

<blockquote>
  <p>Neither the appearance nor the absence of either a check or
  checkmating indicator is used for disambiguation purposes.  This means
  that if two (or more) pieces of the same type can move to the same
  square the differences in checking status of the moves does not
  allieviate the need for the standard rank and file disabiguation
  described above.  (Note that a difference in checking status for the
  above may occur only in the case of a discovered check.)</p>
</blockquote>

<p>This means you have to specify files respectively ranks in your two diagram examples.</p>

<p>My understanding is that you need to disambiguate in the last two situations you describe as well. </p>
