# tibemsMsg_CreateCopy

Function

## Purpose

Create a copy of the message object.

## C Declaration

    tibems_status tibemsMsg_CreateCopy(
        const tibemsMsg message,
        tibemsMsg* copy );

## COBOL Call

    CALL "tibemsMsg_CreateCopy"
         USING BY VALUE message,
               BY REFERENCE copy,
               RETURNING tibems-status
    END-CALL.

Note: `message` and `copy` have usage pointer.

## Parameters

Parameter | Description
--- | ---
`message` | Copy this message.
`copy` | Store a pointer to the new copy.

## Remarks

Create a new message by copying an existing message.

The copy is completely independent of the original message. Pointer data in fields are independent copies of the original values.

This function copies the entire message, including headers, properties, and body data.

This function allocates the storage for the copy. The duration of the copy is independent of the original message. Your program owns the messages that it creates, and must destroy those messages to reclaim the storage. That is, each call to this function must be paired with a call to `tibemsMsg_Destroy`.

## See Also

`tibemsMsg_Destroy`

Copyright © Cloud Software Group, Inc. All rights reserved.