M (make)

<< Click to Display Table of Contents >>

Navigation:  Reference > Commands >

M (make)

The form of the M command is:

M col / code,

M col / Ncode,

M col / mask,

M col / Nmask,

M col / B,

M variable / bit,

M variable / Nbit,

M variable / B,

M mvar / (arithmetic expression),

M mvar / N(arithmetic expression),

Variable must be a previously defined svar or mvar.

IMPORTANT: if referring to col (other than col / B) you must use RCP BINARYDATA.

For cols and fields with character data (ASC) you should normally use the DEFINE command instead:

d $127=' ',

d $127='3',

d $127=3,          ! for character data treated as $127-127=3,

d $151-153='222',

 

if $123/n1..2, d $123/1, !instead of using the CT function

 

The M command allows you to add individual bits of a variable or a data location without using a full definition. If "N" (not) is used before the setting, the codes/bits referenced are removed from the data, if they were previously set. All other codes/bits are left unchanged.

If the N is absent, then the codes/bits referenced are added to those already present.

If an arithmetic expression is used with an mvar the value is used to determine the bit to be set or unset. If the value is less than 1 or greater than the length of the mvar then an execution error occurs.

IMPORTANT: If the variable is an svar, then the setting specified replaces any previous setting, since a svar can only have one true bit.

The symbol B is used to make the variable or col empty (all bits/codes are set false).

To replace the contents of an mvar or col, it is necessary to make it blank first, thus

m $127/b.2,

will make $127 a 2 and nothing else, while

m $127/2,

will simply add 2 to any codes already there.

To alter the contents of ivars, wvars and fields, the D (define) command should be used. To set these to 0, the Z (zero) command can be used.

A number of shorthand forms are allowed with the M (make) command. Two or more M (make) commands may be joined together with a period and the word M (make) omitted for the second and subsequent commands. If two or more M (make) commands refer to the same variable or data location, then its name and the slash may be omitted on the second and subsequent commands.

Any N (not) only refers to the code/mask/bit following it.

Examples of M (make) commands:

m $56/3,

m $mpx/n4.n5,

m $321/n346,

m $age/3.$sex/b.2,

m $mbr/b.4.5.21,

m $var/n21.n22.n23.4.$dd3/2.$dd4/b,