Using your program |
A macro variable is a string enclosed in a set of percent signs (e.g., %inbox%), used to indicate substitution of other data. You can use macros for many reasons, including, for example, defining a unique file destination, indirectly referencing directory locations (for inboxes, outboxes, etc.), or passing information to an Execute On Successful Send command.
Macro variables are classified in one of three ways:
The following table outlines the macro variables (both reserved and custom) and the various contexts in which they can be used.
Macro Variable | Context | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Source File | Destination Files | SYSTEM Command | Default Host Directory | Default Local User Active Directory | Default Root Directory | Windows/Unix Folders | Custom Variable | Execute-On | Pre/Post Command | LCOPY Archive | Accessible through API | Directories Only | Banner/Welcome Message | |
%system% | X | X | ||||||||||||
%none% | X | X | ||||||||||||
%inbox% | X | X | X | X | X | X | X | X | ||||||
%outbox% | X | X | X | X | X | X | X | X | ||||||
%file% | X | X | ||||||||||||
%sourcefile% | X | X | X | X | ||||||||||
%srcfile% | X | X | X | X | ||||||||||
%sourcefilebase% | X | X | X | X | ||||||||||
%srcfilebase% | X | X | X | X | ||||||||||
%sourcefileext% | X | X | X | X | ||||||||||
%srcfileext% | X | X | X | X | ||||||||||
%destfile% | X | X | X | |||||||||||
%destfilebase% | X | X | X | |||||||||||
%destfileext% | X | X | X | |||||||||||
%date% | X | X | X | X | X | X | X | X | X | |||||
%time% | X | X | X | X | X | X | X | |||||||
%index% | X | X | X | X | X | X | ||||||||
%host% | X | X | X | X | X | X | X | X | X | |||||
%mailbox% | X | X | X | X | X | X | X | X | X | |||||
%status% | X | X | ||||||||||||
%crc% | X | X | ||||||||||||
%filesize% | X | X | ||||||||||||
%transferid% | X | X | X | |||||||||||
%filesin% | X | X | ||||||||||||
%filesout% | X | X | ||||||||||||
%ebms.timestamp.date% | X | |||||||||||||
%ebms.timestamp.time% | X | |||||||||||||
%ebms.action% | X | |||||||||||||
%ebms.service% | X | |||||||||||||
%ebms.cpaid% | X | |||||||||||||
%as2.to% | X | |||||||||||||
%as2.from% | X | |||||||||||||
%as2.subject% | X | |||||||||||||
%oftp.sfiddsn% | X | |||||||||||||
%oftp.sfidorig% | X | |||||||||||||
%oftp.sfiddest% | X | |||||||||||||
%oftp.sfiddesc% | X | |||||||||||||
%as3.to% | X | |||||||||||||
%as3.from% | X | |||||||||||||
%ebics.ordertype% | X | |||||||||||||
%command% | X | X | ||||||||||||
custom directory variable | X | X | X | X | X | X | X | X | X | X | X | |||
system.properties variable | X | X | X | X | X | X | X | X | X | X | X |
It is possible to add general variables to the conf/system.properties file and use them within the contexts outlined in the table. To add a general variable to conf/system.properties, the syntax is: varName=replacementText. For example, if conf/system.properties has the following: myvar=hello, the usage would be %myvar% in the desired location.
Macro variables are valid in certain contexts. The following describes the various contexts in which macro variables are valid. Not all macro variables are valid in all contexts.
Below are some general rules for macro variable use.
Below is the table of all reserved macro variables.
Macro | Description |
---|---|
Framework Macros | |
%system% | References the system-level inbox/outbox/sentbox/receivedbox. |
%none% | For sentbox/receivedbox fields where this option is available to select, this indicates that there should be no associated sent/receivedbox (rather than defaulting to the system values in the absence of a selection) |
%inbox% | References the absolute path of the configured host or local user inbox. |
%outbox% | References the absolute path of the configured host or local user outbox. |
%file% | References the local
file (including the absolute path) involved in the current
operation. For PUT and certain
CHECK commands, %file% is
the source file. For GET,
LCOPY, and certain CHECK
commands %file% is the destination file. See CHECK command. Note: The CHECK command is
only available in Cleo Harmony and Cleo VLTrader applications.
|
%sourcefile% %srcfile% |
References the source file name involved in the current operation. If the source file is local, and it is referenced in the Execute-On context, then the absolute path is included. |
%sourcefilebase% %srcfilebase% |
References the source file name base (everything up to, but not including, the last '.'. |
%sourcefileext% %srcfileext% |
References the source file name extension (everything from, and including, the last '.'. If no extension is contained in the source file, blank is returned. |
%destfile% | References the destination file name involved in the current operation. If the destination file is local, and it is referenced in the Execute-On context, then the absolute path is included. |
%destfilebase% | References the destination file name base (everything up to, but not including, the last '.'. |
%destfileext% | References the destination file name extension (everything from, and including, the last '.'. If no extension is contained in the destination file, blank is returned. |
%date% | Specifies the current date in the format defined in the Macro Date Format setting (system, host, or action level). See Advanced system options for more information about this property. |
%date[+/-#y][+/-#m][+/-#d][,MacroDateFormat=...]% | Specifies a variant of the date as a value in either the past or the future. The '#' character specifies one or more digit values and the order of the +/- fields (y=year, m=month, d=day) dictates the order of the operation, however calendar rules still apply (for example, if the operation causes the day to wrap to the next month then the month value is automatically incremented). The MacroDateFormat parameter variable is case-insensitive. If it is specified with the +/- field(s), it must be specified as the last parameter. If it is not specified, the format defined in the Macro Date Format setting (system, host, or action level) is used. See Advanced system options for more information about this property. |
%time% | Specifies the current time in the format defined in the Macro Time Format setting (system, host, or action level). See Advanced system options for more information about this property. |
%time[+/-#h][+/-#m][+/-#s][,MacroTimeFormat=...]% | Specifies a variant of the time as a value in either the past or the future. The # character specifies one or more digit values and the order of the +/- fields (h=hour, m=minute, s=second) dictates the order of the operation, however calendar rules still apply (for example, if the operation causes the minute to wrap to the next hour then the hour value is automatically incremented). The MacroTimeFormat parameter variable is case-insensitive. If it is specified with the +/- field(s), it must be specified as the last parameter. If it is not specified, the format defined in the Macro Time Format setting (system, host, or action level) is used. See Advanced system options for more information about this property. |
%index% | Specifies the usage of
a daily host index value; often used to help guarantee file
uniqueness. Each host's index is reset to 1 at the beginning of
each day. It is incremented by one every time
%index% is referenced. The minimum number of digits in the index string is determined by the Minimum Number Of Macro Index Digits system option. See Advanced system options for more information. |
%host% | The alias of the host involved in the current operation. |
%mailbox% | The alias of the mailbox involved in the current operation. |
%status% | The status of the current operation. Returned status values are either "Success" or "Warning" (both denote a successful transaction) and "Error" or "Exception" (both denote a failed transaction). |
%crc% | The value of the computed CRC-32 associated with a transferred file. The CRC is computed only when Compute CRC on transfers is active. See Logs for information. This feature is available only for Cleo Harmony and Cleo VLTrader applications. |
%filesize% | The size of a transferred file in measured in bytes. |
%transferid% | The value of the unique ID assigned to a transferred file. This feature is available only for Cleo Harmony and Cleo VLTrader applications. |
%filesin% | The number of files received through within an action. |
%filesout% | The number of files sent through within an action. |
%command% | The full command syntax (only available for the Execute-On context of CHECK commands). |
ebMS Macros | |
%ebms.timestamp.date% | The date portion of the SOAP header's <eb:Timestamp> value. The format of the date is determined by the Macro Date Format setting (system-, host-, or action-level). See Advanced system options for information about Advanced tab under Configure System Options for a definition of this property. This macro will only be resolved when used in the default file name. |
%ebms.timestamp.time% | The time portion of the SOAP header's <eb:Timestamp> value. The format of the time is determined by the 'Macro Time Format' setting (system, host, or action level). See Advanced system options for information about Advanced tab under Configure System Options for a definition of this property. This macro will only be resolved when used in the default file name. |
%ebms.action% %ebms.service% %ebms.cpaid% |
%ebms.action% = the SOAP header's <eb:Action> value. %ebms.service% = the SOAP header's <eb:Service> value. %ebms.cpaid% = the SOAP header's <eb:CPAId> value. These macros will only be resolved when used in the default file name. |
AS2 Macros | |
%as2.to% | The current AS2-To value provided in the received message header. This macro will only be resolved when used in the default file name. |
%as2.from% | The current AS2-From value provided in the received message header. This macro will only be resolved when used in the default file name. |
%as2.subject% | The current Subject value provided in the received message header. This macro will only be resolved when used in the default file name. |
AS3 Macros | |
%as3.to% | The AS3-To name of a client. This macro will only be resolved when used in the SITE command within an action to verify that the AS3 names are properly configured on the VersaLex AS3 server. |
%as3.from% | The AS3-From name of a client. This macro will only be resolved when used in the SITE command within an action to verify that the AS3 names are properly configured on the VersaLex server. |
EBICS Macros | |
%ebics.ordertype% | For EBICS, this macro will resolve to the order type of the EBICS transaction. |
The default %date% setting is yyyyMMdd and the default %time% setting is HHmmssSSS.
To specify a different %date% or %time% format, use a pattern string in the 'Macro Date Format' and 'Macro Time Format' setting (system, host, or action level). See Advanced system options for information about the Advanced tab under Configure System Options for definitions of these properties. Formats may also be specified as part of the macro definition, e.g., %date,MacroDateFormat=yyyyMMdd% and %time,MacroTimeFormat=HHmmssSSS%
In the pattern, all ASCII letters are reserved as pattern letters, which are defined as the following:
Symbol | Meaning | Example |
---|---|---|
G | era designator | AD |
y | year | 2004 |
M | month in year | September & 09 |
d | day in month | 15 |
h | hour in am/pm (1~12) | 12 |
H | hour in day (0~23) | 0 |
m | minute in hour | 30 |
s | second in minute | 24 |
S | millisecond | 352 |
E | day in week | Wednesday |
D | day in year | 259 |
F | day of week in month | 2 (2nd Wed in September) |
w | week in year | 35 |
W | week in month | 2 |
a | am/pm marker | PM |
k | hour in day (1~24) | 24 |
K | hour in am/pm (0~11) | 0 |
z | time zone | Central Standard Time |
' | escape for text | delimiter |
" | single quote | ' |
Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like '.', '#' and '@' will appear in the resulting date or time text even if they are not embraced within single quotes.
Examples Using Pattern Strings:
%date% Format Pattern | Result |
---|---|
MM-dd-yyyy | 09-15-2004 |
EEE_MMM_d_yy | Wed_September_15_04 |
%time% Format Pattern | Result |
---|---|
h_mm_a | 12_08_PM |
K_mma-z | 0_00PM-CST |
Destination File Examples:
Action Command | Destination File Result |
---|---|
PUT test.edi %date%_%time%.edi | 20090714_131524352.edi |
PUT test.edi %date-1d,MacroDateFormat=MMdd%.edi | 0713.edi |
GET test.edi %srcfile%%date%-%time%-%index% | test.edi20090714-131524352-1 |
LCOPY test.edi %date%_%time%.%srcfileext% | 20090714_131524352.edi |
LCOPY test.edi %%%date%_%time% | %20090714_131524352 |
Source File Examples:
Action Command | Source File Result |
---|---|
PUT %inbox%\%date%\test.edi | inbox\20090714\test.edi |
PUT %inbox%\%date,MacroDateFormat=yyyy% | inbox\2009\test.edi |
PUT %outbox%\%mailbox%\* | outbox\myMailbox\* |
Execute-On Examples:
After successful execution of 'LCOPY test.edi test2.edi':
Execute On Successful Copy System Command | System Command Result |
---|---|
cmd.exe /c copy "%destfile%" "c:\temp\%destfilebase%.copy" | cmd.exe /c copy "c:\LexiCom\inbox\test2.edi" "c:\temp\test2.copy" |
cmd.exe /c ExecuteOnCopy.bat "%destfile%" "c:\temp\%destfilebase%.copy" | cmd.exe /c ExecuteOnCopy.bat "c:\LexiCom\inbox\test2.edi" "c:\temp\test2.copy" |
Default Host Directory Examples:
Assume the system-level inbox is 'myInbox\' and the custom directory variable, '%custom1%', is set to '\\filsvr01\serverInbox\'.
Host Default Directory (Inbox) Setting | Resolved Location |
---|---|
%custom1% | \\filsvr01\serverInbox\ |
%custom1%\inbox1 | \\filsvr01\serverInbox\inbox1 |
%system% | myInbox\ |
%system%\inbox1 | myInbox\inbox1 |