The Colon Edit Descriptor: :

The colon edit descriptor : is used to terminate format scanning immediately if there is no more data items in the READ and WRITE list. The form of this descriptor is as follows:

:

Example

Let us take a look at a common problem with format scanning. We want to print a set of integers such that each row has five integers and a blank line should be printed between two output lines. Your instinct would give you the following format:
(1X, 5I3 / )
This is a perfect format. After printing five integers, we see a slash which terminates the current output line. Then, format scanning continues and sees the closing right parenthesis. This would produce a blank line before going back to the beginning of format to print the next five integers. But, it may not do the job. Let us put this format to test. The following is a simple program (Click here to download a copy):
PROGRAM  ColonTest
   IMPLICIT  NONE
   INTEGER                      :: i, n
   CHARACTER(LEN=15), PARAMETER :: DashLine = "---------------"

   READ(*,*)  n
   WRITE(*,"(1X,5I3/)")   (i, i = 1, n)
   WRITE(*,"(1X,a)")      DashLine
   WRITE(*,"(1X,5I3:/)")  (i, i = 1, n)
   WRITE(*,"(1X,a)")      DashLine
END PROGRAM  ColonTest
If we input 15 for variable n, we have the following result:
         1    1    2
....5....0....5....0
   1  2  3  4  5 <----+
                      |                   
   6  7  8  9 10      +-- printed by the first WRITE (no colon)
                      |
  11 12 13 14 15      |
                 <----+
 ---------------
   1  2  3  4  5 <----+
                      |
   6  7  8  9 10      +-- printed by the second WRITE (with colon)
                      |
  11 12 13 14 15 <----+
 ---------------
It is clearly shown by the above output that after the fifteenth number is printed, format scanning continues and sees the / before encountering the closing right parenthesis. As a result, we have an extra blank line! However, if we add a colon between 5I3 and / so that after the last number on an output line is printed and there is no unprocessed data items, format scanning stops. Thus, after the fifteenth data item is printed, format scanning encounters : and stops there. As a result, no extra blank line is printed.

Ok, you might want to say: I don't care the extra blank line because it does no harm. Yes, it is true. So, let us use 13 for variable n and here is the result:

         1    1    2
....5....0....5....0
   1  2  3  4  5 <----+
                      |                   
   6  7  8  9 10      +-- printed by the first WRITE (no colon)
                      |
  11 12 13       <----+
 ---------------
   1  2  3  4  5 <----+
                      |
   6  7  8  9 10      +-- printed by the second WRITE (with colon)
                      |
  11 12 13       <----+
 ---------------
Now the blank line disappears. Why? Because only thirteen integers are printed, after the thirteenth one is printed, the next available edit descriptor is I5 and consequently format scanning stops there with no chance to encounter the /. The result is that no extra blank line is printed.

This teaches us a lesson: When you want to stop format scanning early, use the colon edit descriptor. This is commonly used to fine tune the input/output for the last line.