joinfield error for the name of field (wildcat)

Discussion created by helenak on May 17, 2012
System ArcGIS 9.3

I want to make join based on a field C**** (C3438 or C9123).
However, I do not know how to describe the field for the gp.joinfield code as below.
(python also show it as a syntax error.)
Please kindly help and thank you.

##Script Name: latitude of north or south limit
##Description: Extract latitude of north and south boundary of B or NB range size
##Created By: Elaine Kuo
##Date: 12/05/2012

#Import standard library modules
import arcgisscripting
import os

#Create the Geoprocessor object
gp = arcgisscripting.create(9.3)

#Set the input workspace
#GP.workspace = sys.argv[1]
#Set the workspace.
gp.Workspace= "H:/temp/test1"

#Set the output workspace
#outWorkspace = sys.argv[2]
#Set the workspace. List all of the feature classes in the dataset
outWorkspace= "H:/temp"

#Get a list of the featureclasses in the input folder
fcs = gp.ListFeatureClasses()

# Loop through every item in the list that was just generated
for fc in fcs:

    # Break out the name, no path or extension, using the describe object.
    desc = gp.describe(fc)
    featureName = desc.name

    # Add a field to this shapefile, of type LONG
    gp.AddField (fc, "NorthLat", "double", 6,6)
    gp.AddField (fc, "SouthLat", "double", 6,6)    

#   Get a list of the fields in the featureclass
    fields = gp.ListFields(fc, "C*", "String")
    # Loop through every item in the list that was just generated 
    for field in fields:

        gp.toolbox = "Data Management"

        # Select records to be deleted (C*, i.e. C7658)
        # Make temporary featureclasses
        query = "\"%s\" = 'S'" % field.Name

        # get latitude of north and south limits
        ext = gp.describe("output.shp").extent
        NorthLat = ext.YMax
        SouthLat = ext.YMin        
        gp.CalculateField_management("output.shp", "NorthLat",str(NorthLat))
        gp.CalculateField_management("output.shp", "SouthLat",str(SouthLat))

        #Validate the new feature class name for the output workspace.
        outFeatureClass = outWorkspace + os.sep +gp.ValidateTableName(fc,outWorkspace)

        # copy temporary shapefile to fc
        gp.CopyFeatures("output.shp", outFeatureClass)

        gp.joinfield (fc, \"%s\", outFeatureClass, \"%s\")
        # clear memory of temporary shapefile

print gp.GetMessages()