PDUPLICATE procedure

Duplicates a pointer, with all its components (R.W. Payne).

No options

Parameters

OLDPOINTER = pointers Pointers to duplicate
NEWPOINTER = pointers Duplicated pointers

Description

PDUPLICATE is useful when you want to duplicate the complete tree of data structures to which a pointer points. So, it duplicates not only the pointer itself, but all the structures to which it points. Also, if any of these structures is itself a pointer, the structures to which that too points will be duplicated.

The pointer to be duplicated is specified by the OLDPOINTER parameter, and the duplicated pointer is saved by the NEWPOINTER parameter.

Options: none.

Parameters: OLDPOINTER, NEWPOINTER.

Method

PDUPLICATE calls itself recursively to duplicate any pointers inside OLDPOINTER. The individual data structures are duplicated by the DUPLICATE directive.

See also

Directives: DUPLICATE, POINTER.

Commands for: Data structures.

Example

CAPTION    'PDUPLICATE example'; STYLE=meta
SCALAR     S1,S2,S3; VALUE=1,2,3
POINTER    [VALUES=S1,S2] P2
&          [VALUES=P2,S3] P1
PRINT      #P1
PDUPLICATE P1; NEWPOINTER=D1
PRINT      #D1
Updated on March 6, 2019

Was this article helpful?