One of the common functions I have to do is assign each record in a feature class with a unique identifier–normally just a sequential number from 1 to N. In ArcView 3.x, the formula was simply “rec + 1” if I wanted to start with the number 1.
In ArcGIS, the process got a little more complex–you had to write a little VBA in Field Calculator as described by ESRI.
While this option still exists in ArcGIS 10, I believe it will disappear when 10.1 comes out and VBA support is completely eliminated. But it is doable using Python which will continue to be supported.
Googling around, I did not find an exact answer but Dave Verbyla, Professor of GIS/Remote Sensing at the University of Alaska has a posted some samples that served as a good starting point.
In the Pre-Logic Script Code box, I declare a variable (counter) and a function. Then in the formula, I call the function.
counter = 0 def uniqueID(): global counter counter += 1 return counter
While composing this post, I actually wanted a concatenated value; “OC” plus an 8 character numeric sequential number starting at OC00000001 so the actual code is shown below: