M$COPY (Dynamic Memory Routine)

Copies a region of memory from one location to another.
Note: This ACUCOBOL-GT library routine is available in this COBOL version. Any compatibility issues in this COBOL system are in the Compatibility Issues section at the end of the topic.

Usage

CALL "M$COPY" 
    USING DEST-PTR, SRC-PTR, NUM-BYTES

Parameters

DEST-PTR USAGE POINTER Contains the address of the first byte of the destination region.
SRC-PTR USAGE POINTER Contains the address of the first byte of the source region.
NUM-BYTES Numeric parameter Indicates the size of the memory region to be copied.

Description

This routine copies NUM-BYTES from the address contained in SRC-PTR to the address contained in DEST-PTR. Note that this routine is relatively dangerous to use. No boundary checking is performed to ensure that the address range is valid, so memory access violations may result if you pass it incorrect data.

This routine is functionally similar to the C$MEMCOPY routine except that parameters are passed by reference instead of by value. For example, you can copy 10 bytes to DEST-PTR from the memory address contained in SRC-PTR with:

     CALL "M$COPY" 
        USING DEST-PTR, SRC-PTR, 10

Compatibility Issues

None.