Mainframe Tutorial-CICS File Control Commands-REWRITE Command

The REWRITE command
{ REWRITE DATASET(filename)|FILE(name) }
[ LENGTH(data-area) ]
[ SYSID(name) ]

DATASET or FILE Specifies a 1 to 8 character name for the dataset as specified using CEDA DEFINE FILE(name)

FROM The source data area

LENGTH Specifies in a half word PIC S9(4) COMP field. This specifies the length of the record to be written. Not needed for fixed length records. Required if SYSID is specified.

SYSID Specifies a 1 to 4 character connection name that represents a remote system.

The RESP field can have the following values:-

DISABLED file is disabled using CEMT SET

DSIDERR File is not defined to CICS. In later systems also indicated by FILENOTFOUND.

DUPREC Occurs if the record contains an alternate key value that already exists, the alternate index does not allow duplicate keys and the alternate index is part of the files upgrade set or access is via the path.

ILLOGIC A serious VSAM error occurred

INVREQ The record was not previously fetched by READ with UPDATE option.

IOERR An IOERR occurred

NOTAUTH The transaction’s definition specified resource Checking and the operator is not authorized to Access the data set.
NOTOPEN the data set is not open

SYSIDERR The system identified by SYSID could not be found.

  • To REWRITE a record you must first read it with UPDATE option. If the file is recoverable, the lock on the CI is held until the task ends or a syncpoint is taken. Else the lock is released when you issue a REWRITE or UNLOCK command.
  • When you rewrite a record, you can change any field except the key field, or change the length of the record.


Computers TopOfBlogs Technology Blogs Mainframe interview question and answers,mainframe jobs,cobol,vsam,jcl,cics,db2,rdbms,mvs,tso,ispf,ibm,hcl,tcs,cts,wibro Blog Directory