Link/Unlink Data Definition (LNKDTADFN)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Link Data Definition (LNKDTADFN) command links or unlinks file definitions in a dictionary, program-described files, or externally-described files.

Restriction: A file cannot be linked if it is already linked. However, a definition can be linked to several files at the same time.

Note: If file text and the file definition are not the same, a new version of the definition is created.

Top

Parameters

Keyword Description Choices Notes
OPTION Option *LINK, *UNLINK Required, Positional 1
FILE Data base file Single values: *ALL
Other values: Qualified object name
Required, Positional 2
Qualifier 1: Data base file Name
Qualifier 2: Library Name, *LIBL, *CURLIB
DTADCT Data dictionary Name Optional
DFN File definition Name Optional
CRTDATE Creation date Date, *FIRST Optional
Top

Option (OPTION)

Specifies the action that is performed on the program-described file, externally-described file, or file definition.

Note: Externally-described files can only be unlinked.

This is a required parameter.

The possible values are:

*LINK
The program-described file or file definition is linked.
*UNLINK
The program-described file, externally-described file, or the file definition is unlinked.
Top

Data base file (FILE)

Specifies the name and library of the program-described file or externally-described file to be linked or unlinked.

This is a required parameter.

The possible file values are:

*ALL
All program-described files linked to definitions in the specified dictionary are unlinked. This value is valid only if *UNLINK is also specified for the Option prompt (OPTION parameter) and a dictionary name is also specified for the Data dictionary prompt (DTADCT parameter). This value is not valid for externally-described files.
library-name/file-name
Specify the name of the database file being linked or unlinked.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the thread is used to locate the file. If no library is specified as the current library for the job, the QGPL library is used.
name
Specify the name of the library to be searched.
Top

Data dictionary (DTADCT)

Specifies the name of the dictionary that contains the file definition being linked or unlinked to the program-described file. A name is required if *LINK is specified for the Option prompt (OPTION parameter), or if *ALL is specified for the Data base file prompt (FILE parameter) and *UNLINK is specified for the Option prompt (OPTION parameter).

Top

File definition (DFN)

Specifies the name of the file definition being linked to the program-described file. This parameter is not applicable if *UNLINK is specified for the Option prompt (OPTION parameter).

Top

Creation date (CRTDATE)

Specifies the creation date of the file definition being linked to the program-described file. This information is ignored if *UNLINK is specified for the Option prompt (OPTION parameter).

The possible values are:

*FIRST
The file definition with the specified definition name and the earliest creation date is used.
creation-date
Specify the creation date of the file definition being linked to the program-described file.
Top

Examples

LNKDTADFN   OPTION(*LINK)  FILE(MYLIB/MYFILE)
            DTADCT(MINE)  DFN(MYDEF)

This command links definition MYDEF in dictionary MINE, to the program-described database file MYFILE located in library MYLIB.

Top

Error messages

*ESCAPE Messages

CPF2E9B
Definition &1 not found.
CPF2FE0
Error occurred while opening dictionary &1.
CPF2FE1
Error occurred while closing dictionary &1.
CPF2FE2
Dictionary &1 currently in use.
CPF2FE3
System cross reference file is in error.
CPF2FE4
System cross reference file not available.
CPF2F02
Not authorized to use dictionary &1.
CPF2F07
Dictionary &1 in error.
CPF2F08
Dictionary &1 not found.
CPF2F6A
File &2 in &3 not valid for LNKDTADFN.
CPF2F6C
All files were not unlinked.
CPF2F61
File &2 in &3 currently in use.
CPF2F7B
File &2 not linked. Record lengths not equal.
CPF2F7C
Start key position &1 splits field &2.
CPF2F7D
End key position &1 splits field &2.
CPF2F7F
File &2 in &3 is already linked.
CPF2F76
Only file definitions for physical files can be linked.
CPF2F77
File not keyed. Cannot link to keyed file definition.
CPF2F78
Definition &1 in error.
CPF2F79
Key fields do not match.
CPF2F80
File &2 in &3 is not linked.
CPF9812
File &1 in library &2 not found.
CPF9820
Not authorized to use library &1.
CPF9822
Not authorized to file &1 in library &2.
CPF9845
Error occurred while opening file &1.
CPF9846
Error while processing file &1 in library &2.
CPF9847
Error occurred while closing file &1 in library &2.
Top