Using Enhanced File Names

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:

Optim Macros

Use the following Optim macros to generate unique file names:

Macro Result
$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)
$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).