SMAKE


NCHAR

 

The SMAKE instruction allows dynamic creation of a DIM or NCHAR character string variable. The greatest feature of SMAKE is that very large DIM or NCHAR variables may be created by a program once it loads into memory. This is accomplished without the disk space overhead the program would require if the variable were defined in the User Data Area (UDA). The instruction uses the following format:

 

 

[label]

SMAKE

{dest},{size}

 

Where:

label

Optional. A Program Execution Label.

dest

Required. A previously defined POINTER for the variable created.

size

Required. A previously defined Numeric Variable, Expression, or decimal constant indicating the size of the variable to create.

Flags Affected: ZERO

Note the following:

  1. {dest} must be a DIM or NCHAR Pointer Definition or a compiler error occurs.

  2. SMAKE attempts to create a character string variable of the specified size (blank-filled with both the Form Pointer and Length Pointer set to zero) using {dest} as its label.

  3. If {size} equals zero or insufficient memory is available to create {dest}, the ZERO Condition Flag is set.

  4. Variables created through SMAKE no longer exist after a ROLLOUT and must be recreated if they are referenced after a rollback operation.

  5. Space allocated by an SMAKE instruction is not released until program termination. Performing a second SMAKE using the same pointer unlinks the pointer from the first memory allocation but does not free the memory for reassignment to another pointer.

  6. DMAKE is similar to SMAKE except that the buffer allocation is performed using the operating system's memory allocation functions.

 

 

See Also: Example Code, Character String Instructions

 



PL/B Language Reference SINSERT SPLICE