Hi SJF,
When you WRITE w/access is SEQ specified in the SELECT, you get RC=21; if RANDOM or DYNAM is speced, you get RC=22.
You didn't say, but if you're running on a mainframe, have you tried IDCAMS w/the REPLACE option? Save some coding.
HTH, Jack.