In IMS GSAM (Generalized Sequential Access Method), the status code AF is returned when a variable-length record has an invalid format, such as an incorrect length field. Other status codes like AH indicate a PCB conflict or open error, AI represents an open failure, and AO indicates a physical input/output error.