×
Menu

Command Line Processing

 

Overview

 
A project can be run or a project's mailing parameters can be adjusted and run from the command line or via a batch file to automate processes. Only the mailing parameters and fileroot can be amended using Project Automation.
 
A Project Definition will need to be created and then called from the command line.
 
Syntax:-
 
SwiftCmd <project path and name>  <optional switches (mailing or fileroot parameters)>
 
or
 
SwiftCmd <project path and name>  <@parametersfile.txt>
 
 
Example:-
 
SwiftCmd ProjectName.xml /Weight=66
 
or
 
SwiftCmd ProjectName.xml @X:\ParamFiles\myparams.txt
 
 
Where myparams.txt contains a list of mailing parameters, for example
 
Format=L
Weight=66
MailType=Bus
 
 

Mailing Parameters

 
Below is a list of generic switches and values available:-
 
Mailing Parameters
Switch
Values
Item Format
/Format=
L = Letter
LL = Large Letter
A3 = A3 Parcel - (Obsolete)
PKT or Parcel = Parcel
Carrier
/Carrier=
RM = Royal Mail
TNT = Whistl (for backwards compatibility)
Whistl = Whistl
UKMail = UKMail
SM = Secured Mail
CP = Citipost
Mailing Type
/MailType=
Adv = Advertising
Bus = Business
Cat = Catalogue
Gen = Genral
Pub = Publishing
Sub = Subscription
Sustainability
/Sustainability=
Standard = Standard
Entry = Entry - (Obsolete)
Inter = Intermediate - (Obsolete)
Service Level
/DeliveryService=
Eco = Economy class
2nd = Second class
1st = First class
Service
/Service=
RM
 
High = High Sort
LowOCR = Low Sort – OCR
LowManual = Low Sort Manual
Cheapest = Cheapest - (Obsolete)
 
DSA's
 
1400 = Access 1400
70 = Access 70
70OCR = Access 70 OCR
Addressing Type
\AddressedCategory=
Partial or Standard
Container
/Container=
Bags = Bag
Trays = Tray
Bundles = Bundles
ALPS = ALPS - (Obsolete)
Container Weight
\ContainerWeight=
Value in grams
Item Weight
/Weight=
Integer or source field name (Mixed Weight) – Royal Mail only
Report Reference
/ReportRef=
Free text
Try Alternative Sorts
/TryAlt=
Y or N
Unsorted
/Sorted=
Unsorted is only available for Royal Mail and UKMail.
These are the three options;

UnsortedInputOrder
UnsortedNatural
Specified
Minimum Selection Size
/MinSelect=
Integer. Must be greater than the default Minimum Selection Size default set by Royal Mail Retail and Wholesale.
Mail Cell Description
/MailCellDesc=
Free text
PAM Sanction
/PAMSanction=
Can be equal TRUE, True or true
Mail Cell Reference
/MailCellRef=
Free text
JIC Opt Out
/JICOptOut=
True or False
JIC Reference
/JICRef=
Free Text
 
 
Below is a list of Whistl (TNT) specific switches and values available:-
 
Mailing Parameters
Switch
Values
Service
/WhistlService=
or
/TNTService=
Standard = Standard
Premier = Premier
Premier Monday = Premier Monday
Account
/WhistAccount=
or
/TNTAccount=
Free text
Mailing House
/WhistlMailingHouse=
or
/TNTMailingHouse=
Free text
Collection Depot
/WhistlDepot=
or
/TNTDepot=
Bolton, Bristol, Bedford or Glasgow
PO (Purchase Order)
/WhistlPO=
or
/TNTPO=
free text (max 40 characters)
Collection Date
/CollectionDate=
CCYY.MM.DD or Auto
Submit Under Size Bags
/WhistlSubmitUnderSizeBags=
or
/TNTSubmitUnderSizeBags=
true or false
 
 
Below is a list of UKMail specific switches and values available:-
 
Mailing Parameters
Switch
Values
Account
/UKMAccount=
Free text
Reject Tariff
/UKMReject=
Bus = Business
Eco = Economy
Collection Date
/CollectionDate=
CCYY.MM.DD or Auto
 
 
Below is a list of Citipost specific switches and values available:-
 
Mailing Parameters
Switch
Values
Whistl National Account Number
/WhistlNationalAcc=
Free text
Whistl Zonal Account Number
/WhistlZonalAcc=
Free text
Citipost Mailing House
/CitipostMailingHouse=
Free text
 
 
Below is a list of generic DSA switches and values available:-
 
Mailing Parameters
Switch
Values
DSA Reference
/DSARef=
free text (maximum of 20 characters. Characters over 20 will be dropped)
Machineable
/Machineable=
Y or N
Zonal
/Zonal=
True, False or Split
 
 
Mailmark Switches:-
 
Mailmark Parameters
Switch
Values
SCID
/SCID=
SCID must be 6 or 7 digits and exist in Mailmark.ini
Zonal SCID
/ZonalSCID=
SCID must be 6 or 7 digits and exist in Mailmark.ini
Return Postcode
/ReturnPostcode=
Postcode must be of a valid format and cased correctly
Mailmark XML (GeMMA)  Output Folder
/MailmarkXMLDir=
Path (must exist)
Batch Reference
/MailmarkBatchRef=
free text (*max 30 characters)
Volume Override
/VolumeOverride=
True or False
Campaign
/MMCampaign=
free text (*max 30 characters)
 
*Truncation rules apply. See appropriate System Setting.
 
Additional Switches:-
 
Additional Parameters
Switch
Values
Input tab
/InputFile=
Path, Filename and Extension
Output tab
/FileRoot=
free text
Data Output Folder
/DataDir=
Path (must exist)
MailngHouse Output Folder
/MailingHouseDir=
Path (must exist)
Future Table
/Future or /Future=
/Future (force use of a future table) or /Future=YYYY.MM.DD (force use of future table from a specific date onwards)
Client Name
/Client=
free text
Project Name
/Project=
free text
Project ID
/ProjectID=
free text
Fixed Width Field Lengths
/FixedOutWidth=
free text
Seed UCID
/SeedUCID=
free text
Item Thickness
/ItemThickness=
must be a numerical value
DPS Strict Matching
/StrictDPSMatch=
True or False
 
 
The /InputFile switch has some limitations. The base project must only contain one input file and the file definition must match
 
 
 

Examples

 
 
Royal Mail:-
 
"C:\SwiftSort\Swift\SwiftCMD.exe" "C:\SwiftSort (Beta)\Definitions\Project Definitions\ProjectName.xml" /Format=L /Service=High /Carrier=RM /MailType=Adv /Sustainability=Entry /Weight=88 "/ReportRef=Auto Campaign"
 
 
TNT:-
 
"C:\SwiftSort\Swift\SwiftCMD.exe" "C:\SwiftSort (Beta)\Definitions\Project Definitions\ProjectName.xml" /Format=L /Carrier=TNT /MailType=Adv /Sustainability=Inter /Service=1400 /Weight=61 "/ReportRef=Auto Campaign" /TNTAccount=0070 /TNT Service=Premier /TNTMailingHouse=9 /TNTDepot=Ashton /CollectionDate=Auto "/DSARef=Pack1 Test"
 
 
UKMail:-
 
"C:\SwiftSort\Swift\SwiftCMD.exe" "C:\SwiftSort (Beta)\Definitions\Project Definitions\ProjectName.xml" /Format=LL /Carrier=UKMail /MailType=Bus /Sustainability=Standard /Service=LowOCR /Weight=161 "/ReportRef=Auto Campaign" /UKMAccount=A12345678 /UMKReject=Eco /CollectionDate=Auto "/DSARef=Pack3 Control"
 
 
Citipost:-
 
"C:\SwiftSort\Swift\SwiftCMD.exe" "C:\SwiftSort (Beta)\Definitions\Project Definitions\ProjectName.xml" /Format=L /Carrier=CP /MailType=Bus /Sustainability=Standard /Service=70CBC /Weight=100 "/ReportRef=Auto Campaign" "/DSARef=Pack 2" /Machineable=Y
 
 
Secured mail:-
 
"C:\SwiftSort\Swift\SwiftCMD.exe" "C:\SwiftSort (Beta)\Definitions\Project Definitions\ProjectName.xml" /Format=L /Carrier=SM /MailType=Bus /Sustainability=Standard /Service=70 /Weight=71 "/ReportRef=Auto Campaign" "/DSARef=Pack 2" /Container=Trays /Machineable=N "/FileRoot=Pack 2 Lives.txt"
 
 
Fixed Width:-
 
"C:\SwiftSort\Swift\SwiftCMD.exe" "C:\SwiftSort (Beta)\Definitions\Project Definitions\ProjectName.xml" /FixedOutWidth="NAME(57),ADDRESS LINE 1(41),ADDRESS LINE 2(41),ADDRESS LINE 3(41),ADDRESS LINE 4(41),ADDRESS LINE 5(41),ADDRESS LINE 6(41),ADDRESS LINE 7(41)"
 

Validation

 
All parameters are validated. If they are found to be incorrect the sort will be aborted. The validation checks are:-
 
 1.     Correct Switches used.
 2.     Switch values are correct.
 3.     Combination of parameters are valid.
 
 

Return Codes

 
A vast amount of Return Codes have been implemented to allow users to define a more considered approach of how to progress via return codes.
 
Return Codes
Definition
0
Completed Successfully
-1
Abandoned Sort
-2
Un-trapped Exception
-3
Conversion Error
-4
Undefined
-5
Invalid Service Level
-6
Invalid Minimum Selection Size
-7
Invalid Item Weight
-8
Input File Does not Exist
-9
No Input Files
-10
Insufficient Volume
-11
Invalid Mailsort
-12
Below Minimum Postcode Level
-13
Suspect Mailsort
-14
Penetration Too Low
-15
No Sort Keys Defined
-16
Invalid Sort Key Element
-17
User Interruption
-18
Excessive Sort Key
-19
Walksort unlicensed
-20
CBC Level Warning
-21
Reject Level Breached
-22
Tray Criteria Not Met
-23
Admail Seeds not included
-100
Undefined Error
-101
Project File not found
-102
Processing cancelled due to error in User options
-103
No Project Defined
-104
System Setting not found
-105
Fixed width field file reader encountered an error
-106
Field Count Conflict
-107
Flat Fixed Record Size Invalid
-108
Multiple /InputFile not allowed
-109
Error Reading Log file / DataDir doesn't exist
-110
Licence does not allow Project Automation
-111
Licence does not allow specified sort
-112
Sort Cancelled by User
-113
Service not permitted
-114
DSA Reference not specified
-115
FileRoot contains invalid character
-116
Client Name contains invalid character
-117
Project ID contains invalid character
-118
Mailing Reference contains invalid character
-119
Mailing Reference not specified
-120
Collection Date is before today
-121
Too many inputs
-122
No Address Fields defined
-123
No Postcode Fields defined
-124
No Town fields defined
-125
Error in field name (invalid character)
-126
General Validation error
-127
Error deleting file
-128
Record Count error
-129
Updates Running
-130
Invalid Account Number
-131
Royal Mail only option
-132
Option Length Exceeded
-133
Invalid Setting
-134
Null Argument
-135
Null User Options
-136
Setting No Permitted
-137
Collection Date Error
-138
Input Directory Does not exist
-139
Unicode Data
-140
Invalid character in the directory
-141
Directory not found
-142
Mailmark.ini not found
-143
No Mailmark Return Postcode set
-144
Supply Chain ID invalid. Must be 6 or 7 digits
-145
Mailmark Return Postcode is not a valid postcode
-146
Mailmark truncation detected
-147
Mailmark Batch Ref Too Long
-148
Mailmark batch Ref Empty
-149
Whistl PO is not valid
-150
Whistl Dummy eManifest is not valid
-151
Service is obsolete
-152
Invalid Volume Override
-153
Zonal is not a valid option
-154
Licence error
-155
Licence has expired
-156
Permissions Null
-157
Licence is not genuine
-158
Licence is not valid
-159
No Lease
-160
Licence not activated
-161
Not licenced
-162
Program Error
-163
System Settings error
-164
Error in CMD options
-165
Invalid fixed width
-166
Invalid ASOG settings
-167
Campaign Name is too long
-168
InvalidAddressedCategory
-169
NullRoyalMail
-170
No Campaign ID
-171
Invalid Delimiter
-172
PAM not Approved
-173
Invalid Collection Depot
-174
Invalid Mailing House
-175
Field Deprecated
-176
Whistl Segment Code Error
-177
Mailmark Barcode Sequence Error
-178
Lock Error
-179
BagStart Error
-180
Invalid UCID
-181
Missing Project Information
-182
Invalid Max Items
 
 

Return Codes - Usage

 
Example 1:-
 
This example shows a simple way of how to use the 'Completed Successfully' Return Code (0). Any Return Code other than '0' is considered a failure.
 
 
"C:\SwiftSort\Swift\SwiftCMD.exe" "C:\SwiftSort\Definitions\Project Definitions\ProjectName.xml" /Service=cheapest
 
echo Return Code = %ERRORLEVEL%
 
if %ERRORLEVEL% neq 0 GOTO Failed
echo ****  SUCCESSFUL  ****
goto End
 
:Failed
echo ****  FAILED  ****
 
:End
echo Completed Successfully
 
 
Example 2:-
 
This example tries to sort to Advertising Mail Intermediate Level (95% DPS Accuracy), If it fails, it evaluates the probable cause and retries at Entry Level if volume permits.
 
 
REM Run base CBC @ Intermediate Level (95% DPS)
"C:\Program Files (x86)\SoftwareBureau\Swift\Sort\SwiftCMD.exe" "C:\ProgramData\SoftwareBureau\Swift\Sort\Definitions\ProjectDefinitions\CBC.xml"
 
echo Return Code = %ERRORLEVEL%
 
REM If unsuccessful CBC 95% (Intermeditae) evaluate Return Code
if %ERRORLEVEL% neq 0 GOTO Evaluate
goto Successful_at_CBC95
 
 
 
:Evaluate
 
REM Check Volume
if %ERRORLEVEL% equ -10 GOTO Insufficient_Volume
REM If suspect try CBC 90% (Entry)
if %ERRORLEVEL% equ -13 GOTO Try_CBC90
goto Failed
 
 
 
:Try_CBC90
 
"C:\Program Files (x86)\SoftwareBureau\Swift\Sort\SwiftCMD.exe" "C:\ProgramData\SoftwareBureau\Swift\Sort\Definitions\ProjectDefinitions\CBC.xml" /Sustainability=Entry
if %ERRORLEVEL% neq 0 GOTO Failed
goto Successful_at_CBC90
 
 
 
:Failed
 
echo Unable to CBC this data at either level Return Code = ** %ERRORLEVEL% ** not catered for
goto End
 
 
 
:Insufficient_Volume
 
echo Unable to CBC this data due to insufficient volume
goto End
 
 
 
:Successful_at_CBC90
 
echo Successful CBC @ 90%
goto End
 
 
 
:Successful_at_CBC95
 
echo Successful CBC @ 95%
goto End
 
 
 
:End
 
 
 
 
 

Tip

 
An Environment Variable (Path) can be setup so that SwiftSortCMD can be called and run from any directory on the machine. Environment Variables are set in the Windows OS System Properties. Example of use:-
 
SwiftCMD.exe "C:\SwiftSort\Definitions\Project Definitions\ProjectName.xml" /Service=cheapest
 
 
 
SwiftSort and its resources can be kept up to date via the command line, see the Applying Updates topic for further information.