Z (zero)

<< Click to Display Table of Contents >>

Navigation:  Reference > Commands >

Z (zero)

The form of the Z command is:

Z,

Z variable. variable. ... ,

Z TO FINISH,

The Z command is a shorthand method of setting the value of a variable to zero, or setting all bits false. Z can only be used to clear previously defined variables; it cannot be used for the first definition of a variable.

For fixed format character data files without RCP BINARYDATA, Z can be used to set a col or field to blanks.

If no variables are specified in the command, then all variables in the stage are cleared, except temporary variables if PRESERVE TEMPORARY is set, and the reserved variables . The Z operation is performed by START DATA, but it may sometimes be desirable to clear them without passing START, for example if there is more than one record per input data card read.

Clearing individual variables is sometimes necessary at the Data Stage when processing trailer cards, where one might want to write an IDF record for each trailer record, but not branch to FINISH, and hence to START, until the end of the logical record, when a new serial number is encountered. In this case, trailer variables should be cleared after the WRITE operation or they will retain previously set values for the next trailer record.

If RCP UNDEFINED is used ivars and wvars will be set to U (undefined) by a ZERO command.

IMPORTANT: zeroing a cvar does not set it to blank.

In its standard form, Z can only be used for clearing variables that have previously been defined in the CL script. The last form of the command above is available to clear all variables that have not yet been defined.

Z TO FINISH will zero all variables whose first definition appears after the command and before the FINISH DATA command. This command is useful for trailer surveys to clear out variable contents from the previous trailer.

Z can only be used in a Data Stage.

Examples of Z (zero) commands:

z $var,

z to finish,

z $mv1.$age.$431-433.$i.$wt,