Copy From LDIF (CPYFRMLDIF)

The Copy From LDIF (CPYFRMLDIF) command is used to copy directory entries from a LDAP Data Interchange Format (LDIF) stream file to the directory for a Directory Server instance. The Directory Server provides a Lightweight Directory Access Protocol (LDAP) server on IBM i. The command can only be used to add new entries to the directory, it cannot change or delete entries already in the directory.

Restriction: You must do or satisfy one of the following conditions to use this command:

Parameters

Keyword Description Choices Notes
LDIFSTMF LDIF stream file Path name Required, Positional 1
INSTANCE Instance Name, QUSRDIR Optional, Positional 2
ADMIN Administrator Element list Optional
Element 1: Distinguished name Character value
Element 2: Password Character value
REPLICATE Replicate imported data *YES, *NO Optional

LDIF stream file (LDIFSTMF)

Specifies the integrated file system path to the LDAP Data Interchange Format (LDIF) stream file.

This is a required parameter.

path-name
Specify the path name of the LDIF stream file that contains the directory entries to be copied into the directory for the Directory Server instance.

Instance (INSTANCE)

Specifies the Directory Server instance name whose directory the directory entries are copied to.

QUSRDIR
The name of the system default Directory Server instance.
name
Specify a Directory Server instance name. The name has a minimum of one character and a maximum of eight characters.

Administrator (ADMIN)

Specifies the Directory Server administrator. If not specified, the user must have *ALLOBJ and *IOSYSCFG special authorities.

Element 1: Distinguished name

character-value
Specify the distinguished name for the Directory Server administrator, for example, cn=administrator. A maximum of 50 characters is allowed.

Element 2: Password

character-value
Specify the password for the Directory Server administrator. The password is case sensitive and must be enclosed in apostrophes. A maximum of 50 characters is allowed.

Replicate imported data (REPLICATE)

Specifies whether copied directory entries should be replicated to replica Directory Servers. This option could be used, for example, when initializing an additional master server so that it does not attempt to replicate data to Directory Servers already containing these directory entries.

*YES
Copied directory entries are replicated.
*NO
Copied directory entries are not replicated.

Examples

Example 1: Copy to the QUSRDIR Directory

CPYFRMLDIF   LDIFSTMF('/ldap/qusrdir.ldif') INSTANCE(QUSRDIR)

This command copies the directory entries from the qusrdir.ldif stream file in the ldap directory to the Directory Server directory for the QUSRDIR instance. The user running the command this way must have all object (*ALLOBJ) and input/output system Configuration (*IOSYSCFG) special authorities.

Example 2: Copy to the QUSRDIR Directory and Replicate

CPYFRMLDIF   LDIFSTMF('/ldap/qusrdir.ldif') INSTANCE(QUSRDIR)
             REPLICATE(*YES) ADMIN('cn=admin' 'secret')

This command copies the directory entries from the qusrdir.ldif stream file in the ldap directory to the Directory Server directory for the QUSRDIR instance. The copied data will be replicated to the replica Directory Servers.

Example 3: Copy to the DOGGIES Directory

CPYFRMLDIF   LDIFSTMF('/ldap/doggies.ldif') INSTANCE(DOGGIES)
             ADMIN('cn=fluffy' 'poodle')

This command copies the directory entries from the doggies.ldif stream file in the ldap directory to the Directory Server directory for the DOGGIES instance.

Error messages

*ESCAPE Messages

GLD0202
Administrator DN or password not correct.
GLD0213
Error opening or creating file.
GLD0215
Directory server instance &1 not found.
GLD0218
Not enough authority or incorrect distinguished name and password specified.
GLD0225
&1 items added to directory, &2 items not added.
GLD0226
Client request rejected. Directory server is read only.