Use macros to dynamically create unique file names for Optim™ processes. A macro is resolved
when a process is run. When specified, a macro remains in the request,
so that a new name is generated each time the request is executed.
For example, during an Extract Process,
type one or more macros in the Extract File box. The name of a unique
Extract File is generated each time the Extract Request is run.
Specify a macro name as follows:
prefix<
macro1[,literal1][,macro2][,literal2]...[,macroN][,literalN] >suffix
where:
- prefix
- A character prefix name (for example, ‘Extract').
- macro1-n
- An Optim-defined macro or a Windows environment variable name (for example,
‘$USER'). All macros after macro1 are optional.
- literal1-n
- An optional text string that is inserted in the
file name, unchanged (for example, ‘workstation').
- suffix
- A character suffix name (for example, ‘.XF').
Rules and Guidelines
When creating a file name macro, follow these rules
and guidelines:
- The total length of the resolved file name cannot
exceed 255 characters.
- Any characters (letters, numbers, spaces, or symbols)
that are valid for a file name are permitted for the prefix and suffix.
- Macros and literals can be separated by spaces or
commas.
- All macros in a file name must be enclosed in a
single set of angle brackets (i.e., < $MM $DD $YY >)
- A file name can include an Optim Macro or a Windows environment variable. All Optim macros must begin with a
$ symbol (e.g., $USER), and all Windows environment
variable macros must be enclosed in % symbols (e.g., %NETUSER%).
- Macro names are not case sensitive.
- The number of macros and literals permitted is limited
only by the length of the resulting file name.
- Only the prefix and suffix are validated at the
time a process request is edited. When the request is executed, the
name is generated and validated. If the resulting file name is invalid,
the process will fail.
Optim Macros
Use these Optim macros
to generate unique file names. Each macro name is followed by a description
of the result it produces.
- $DAY
- The current day of the week in text format (i.e., Sunday through
Saturday).
- $DD
- The day of the month in numeric format (i.e., 01 through 31).
- $DE
- The day of the week in European numeric format (i.e., 1 through
7, where 1 = Monday).
- $DW or $D
- The day of the week in numeric format (i.e., 1 through 7, where
1 = Sunday).
- $DY or $DDD
- The day of the year in numeric format (i.e., 01 through 366).
- $HH
- The hour in numeric format (i.e., 00 through 23).
- $HHMM
- The hour and minute in numeric format (i.e., 0000 through 2359).
- $MIN
- The minute in numeric format (i.e., 00 through 59).
- $MM
- The month in numeric format (i.e., 01 through 12).
- $MON
- The month in abbreviated text format (i.e., Jan through Dec).
- $OBJNAME
- The name of the object (table or view)
Note: The $OBJNAME macro
is valid only in a Convert request when the output file is CSV, XML
or ECM format. For additional information refer to the Move
User Manual section for Convert requests.
- $SEQ and $SEQn
- A numeric Optim Directory
Sequence Number (i.e., 0 through 2,147,483,647).
The Optim Directory holds a sequence
number that is used exclusively by the $SEQ and $SEQn macros. This
sequence number is incremented by a single digit each time the macro
generates a number.The $SEQn macro generates a number
of n places, including leading zeros, if needed.
For example, if the Optim Directory
Sequence Number is 9 when the $SEQ4 macro is used to generate a file
name, the macro returns the value 0010:
Macro:
EXTRACT<$MON
$YYYY SEQ $SEQ4>.XF
File Name:
C:\ProgramFiles\Softech\RT\DATA\EXTRACTNov2000SEQ0010.XF
- $SS
- The second in numeric format (i.e., 00 through 59).
- $USER
- The operating system User ID.
- $WE
- The week of the year in European numeric format, where Monday
is the first day of the week (i.e., 00 through 52).
- $WW
- The week of the year in numeric format, where Sunday is the first
day of the week. (i.e., 00 through 52).
- $YY
- The current year in two-digit numeric format (e.g., 00 through
99).