Previous Topic: &MAIDEL

Next Topic: &MAIFIND


&MAIDSFMT

Places the entire current data stream into variables.

&MAIDSFMT { VARS=prefix* [ RANGE=(start,end) ] |
            VARS={ name | ( name, name, ..., name) } |
            STRING &name &name ... &name |
            ARGS [ RANGE=(start,end) ] }

Requests that the current data stream be made available to the procedure by placing it into the variables specified. The data stream is placed into the variables in character format hexadecimal, with each two characters representing one hexadecimal byte. For instance, if a single byte of the data stream contains X'1D', it will be represented in a variable as two characters: 1D.

On completion of &MAIDSFMT the system variable &ZVARCNT is set to the count of variables created or modified by the operation.

Operands:

VARS=

Specifies that the data stream is to be tokenized into the nominated variables before control is returned to the procedure. Tokenization is performed from left to right of the data stream. If necessary, the data stream is broken into sections whose length is the maximum allowed for a single variable or the amount specified. If insufficient variables are provided, some data will not be available to the procedure. The format of the operands associated with VARS= is as follows:

prefix*

Denotes that variables are to be generated automatically during the tokenization process, and that the variable names will be prefix1 prefix2 ... and so on. The RANGE= operand is specified to indicate a starting and ending suffix number. Default is RANGE=(1,64). prefix* cannot be used in conjunction with other variable names.

name

The name of a variable, excluding the &.

name(n)

The same as name, but n denotes the number of bytes of the data stream that are to be placed in the variable.

*(n)

Denotes a skip operation, where n represents the number of bytes of the data stream to be skipped during the tokenization process. Specifying an asterisk by itself is the same as *(1).

STRING

STRING on an &MAIDSFMT statement functions in a similar way to VARS. The data stream is tokenized into the nominated variables before control is returned to the procedure. Tokenization is performed from left to right of the data stream. If necessary, the data stream is broken into sections whose length is the maximum allowed for a single variable, or the amount specified. If insufficient variables are provided, some data will not be available to the procedure. Excess variables will be set to a null value. The formats of the operands associated with STRING are as follows:

&name

The name of a variable including the leading &.

&name(n)

As name, but n denotes the number of bytes of the data stream that are to be placed in the variable.

*(n)

Denotes a skip operation, where n represents the number of bytes of the data stream to be skipped during the tokenization process. Specifying an asterisk by itself is the same as *(1).

ARGS

Denotes that the data stream is to be placed into automatically generated variables of the form &1 through &n, depending on how many are required to hold the text. The RANGE= operand is coded to designate a start number and, optionally, an end number, which delimits the number of variables to be generated. The default is RANGE=(1,64).

Examples: &MAIDSFMT

&MAIDSFMT ARGS RAN GE=(20,30)

Requests that the data stream be placed into the variables &20 through &50. &ZVARCNT will be set to indicate how many variables were created.

&MAIDSFMT VARS=(*(3),A(2),B(3),C,D,E,F)

*(3) indicates that the first 3 bytes of the data stream are ignored, the next 2 bytes are then to be placed in the variable &A, the next three are placed in the variable &B and the rest of the data stream is placed into the variables &C, &D, &F and &F respectively, with each of these variables containing the maximum possible number of characters.

&MAIDSFMT VARS=ABC* RANGE=(1,20)

The data stream is placed into variables &ABC1, &ABC2, and so on, up to &ABC20.

Notes:

&MAIDSFMT is useful to interrogate a data stream more fully than would be possible using &MAIFIND. Data streams could also be archived, for example, for future investigation.

The data stream obtained from the PLU by &MAIDSFMT is used after some modification on an &MAIREPL verb. &MAIREPL totally replaces a data stream received from the PLU.

If there is no data outstanding when an &MAIDSFMT is issued, the current screen image is returned. This allows a script started part way through a session to determine the format and content of the current screen image. The current screen image is also returned if &MAIDSFMT is used in the MAI help procedure. Data is outstanding from the time an &MAIREAD is satisfied until an &MAICONT, &MAIDEL, or another &MAIREAD is issued.

More information:

&MAIFIND

&MAIREAD

&MAICONT

&MAIREPL

&MAIDEL