HOME | NEXT | PREVIOUS |
A Record Description File (RDF) is used by LDSU to "map" data in an input file to attributes in the LDAP directory or to define the format of an output file containing LDAP Directory attribute values on an Export.
The RDF contains a series of steps (like a program) which are executed in order by LDSU. There are two types of RDFs: Input and Output.
An Input RDF is used to translate a Input File into a temporary file (called a metafile by LDSU). The metafile contains a single record for each record (which can be multiple lines) in the input_file. This single record contains all the RDN's and ATTR's that are identified in the layout file. An Input RDF, therefore, contains statements which assign values to the RDN and ATTR values.
An Output RDF is used to format Output Files from a metafile. An Output RDF, therefore, contains statements which write values to the Output File.
An RDF may also contain conditional logic which decides what values should be written where based on other values.
An RDF may also contain logic which allows records to be ignored in an input file or not written to an output file.
The format of an RDF statement is one of the following:
The format of an action (or else-action) clause differs depending on whether
the RDF is being used to define an
input or
output file.
When the RDF is used for reading a foreign directory input file,
the format of an action (or else_action) clause is:
The Destination field must be an LDAP Directory attribute which is listed in
LDSU_LAYOUT.DAT (as an RDN or ATTR).
The Source field may be one the following:
The meaning of the terms used in a input record location or field are:
Some examples of Input File Action Lines are:
If the same destination keyword is repeated, the source values are
concatenated together:
When the RDF is used for creating a foreign directory output file,
the format of an action (or else_action) clause is:
The Destination field can be one of two formats:
The Source field may be one the following:
The meaning of the terms used in a Output Record Location are:
The Variable Length Field Value (N-*-#) means to write the
OUTPUT_FIELD_SEPARATOR character (default: a tab) followed by the source value
at the end of Line N. When using this syntax, the first field should use
the N.1.# syntax to avoid starting the line with OUTPUT_FIELD_SEPARATOR.
Output Record Location and Variable Length Field Value formats can be
interchanged in the same RDF file:
An RDF conditional starts with a question mark (?) character and terminates
with a colon (:) character. The question mark can be thought of being an
"IF" and the colon a "THEN". (And the second, optional colon an "ELSE").
The conditional logic allows fields to be compared using EQUAL (==),
NOT EQUAL (!=), NOT (!), SUBSTRING OF (<<), and
NOT A SUBSTRING OF (!<) operators:
Fields used in conditionals can be one of the following:
All comparisons are case insensitive (e.g. "a" equals "A").
Comparisons can be combined by use of logical AND (&&) and OR (||)
operators:
Parenthesis can also be used for complex conditionals:
The boolean NOT (!) operator can also be used:
An optional ELSE conditional statement after a second colon (':')
may be specified:
If a conditional is specifed, the action line can be "IGNORE".
This causes any input record which matched this condition to not be used.
For example, the following will skip any records that contain the substring
"admin" in field 2 in the input record.
The conditional can also contain the reserved words: ADD, MOD, and DEL.
These conditionals can be tested to see if LDSU is currently using an
ADD, MODIFY, or DELETE input file (for TRANSACTION Mode) or output file
(for CHANGES Mode).
For example, the following CHANGES mode output RDF may contain:
This allows a single RDF to be used in TRANSACTION and CHANGES mode
even thought the Add, Modify, and Delete files need to generate different
values.
RDF Functions can be used to assign a string value. They can be used
as:
The following RDF Functions are available:
The Tilde (~) character has a special meaning in TRANSACTION and CHANGES1
mode when comparing records. If the value for an attribute in the input
file is set to "~", then the attribute will not be modified in TRANSACTION
mode or not considered changed in CHANGES mode.
This is useful when the input file doesn't have the LDAP Directory
value for some records and doesn't want to change the value
in the Directory (Modify TRANSACTION mode) or cause an
change to occur (CHANGES Mode).
For example, in TRANSACTION Mode, a Modify RDF can contain:
This will cause the "ldapfield" to be updated to "NEWVALUE"
under certain conditions but will remain unchanged under others.
RDF comments start with a ! character in column 1.
RDF lines may be continued on the next line by ending a line with the
hypen ('-') character:
Each line in a RDF must be less than 256 characters.
All continuation lines which form one record must be less than 512
characters combined.
Whitespace characters (space, tab) outside of double quotes are ignored.
The above examples usually show tokens separated by a single space character
but that is only used for clarity and is not required.
RDF action format for Input Files
emailORGNAME = "Sales" ! constant string
emailSURNAME = 2.1.10 ! 1st 10 characters of line 2
emailGIVENNAME = 1-1 ! 1st field of line 1
emailUSE1 = 1-2.1.10 ! 1st 10 chars of 2nd field of line 1
emailUSE2 = 1-3-2.1.10 ! 1st 10 chars of 2nd sub-field of
! 3rd field of line 1
emailUSE3 = 1-3-2.11.# ! characters 11 until the end of the 2nd
! sub-field of the 3rd field of line 1
surname = emailSURNAME ! LDAP Directory keyword
rfc822mailbox = $GSUB(cn," ",".") ! function to replace spaces with dots
rfc822mailbox = "@xyz.com" ! and add a constant string
commonName = 1-1 ! These three lines are combined
commonName = " " ! together to create the value
commonName = 1-2 ! for the commonName attribute
RDF action format for Output Files
!
! Output: "Mailbox
RDF conditional format
? field == "STRING" : ! True if field equals STRING
? field1 != field2 : ! True if field1 does not equal field2
? field << "STRING" : ! True if field is a substring of STRING
? field !< "STRING" : ! True if field not a substring of STRING
? field : ! True if field is non-blank
? !field : ! True if field is blank
? field == "A" || field == "B" : ! True if field is A or B
? field != "A" && field != "B" : ! True if field not A or B
? field << "AB" || field == "E" : ! True if field is a substring
! of AB or field equals E
? (field == "A" || (field != "B" && field1 != field2) ) :
? !(field == "A" || field == "B") : ! True if field is not A or B
? !field : ! True if field is blank
? 1.1.10 : description = 1.1.10 : description = "Default"
instead of having to do:
? 1.1.10 : description = 1.1.10
? !1.1.10 : description = "Default"
RDF IGNORE clause
? "admin" << 1-2 : IGNORE
ADD, MOD, DEL conditionals
? ADD : "Create" = 1.*.#
? MOD : "Modify" = 1.*.#
? DEL : "Delete" = 1.*.#
RDF Functions
Function Description
$GSUB(field, "old", "new")
subsitute ALL occurences of old to new in field
$SUB(field, "old", "new")
sub first occurence of old to new in field
$LSUB(field, "old", "new")
sub last occurence of old to new in field
$TOUPPER(field)
return field in uppercase
$TOLOWER(field)
return field in lowercase
$TOASCII(field)
return 7-bit ascii field
$SUBSTR(field, "start", "length")
return a subfield. "start" is the starting character in field
(1-N). "length" is the number of characters to return (up to end of field).
$DATE("format")
return a field in the desired time format. Refer to
strftime C function for valid values for "format"
$LENGTH(field)
return the length of the field in ascii
$NORMALIZE(field)
return the field w/o leading/trailing/multiple spaces
$SYSTEM(command[, arg1, arg2])
run a custom script to get a value
$INDEX(field, "num", "separator")
return substring #num(1-N) in field using separator to define
substrings. (e.g. $INDEX("A-B-C", "2", "-") would return "B").
Other RDF syntax Rules
Tilde
? 1-1 == "ABC" : ldapfield = "NEWVALUE" : ldapfield = "~"
Comments
Line Continuation
? (1-1 == "TEST") || (1-2 != "ORG1" && 1-2 !="ORG2") : -
organization = "ABCD" : -
organization = "EFGH"
Maximum Line Length
Whitespace
HOME | NEXT | PREVIOUS |
Copyright © Digital Equipment Corporation 1998