InternalCallCzarDll

Internal Call to Czar Dll Interface

Minor Business Rule

Object Name: B4900940

Parent DLL: CTRAN

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose

This function will read the Rating External Function Cache and call the CZAR.DLL to rate the requested load.  After rating, the Rating External Function 

Cache will be updated with the calculated charges.


1.2Setup Notes and Prerequisites


1.Czar32.dll Should be in the directory.
2.The Czar should be installed in the C drive.









1.3Special Logic


2.Technical Specifications


2.1Parameters:

Data Item Data Structure DescriptionI/ORequiredNotes
DTAIError Message IDO

EV01Suppress Error MessageI0-Send error messages 1-Suppress error messages

JOBSJob NumberIYesThis is the primary index to the input caches.

RTNMRate NameIThis is the rate name, to be used as the CZAR tariff name.

PPDJShipment DateIYesThe date of the shipment or load.  

ADDOOrigin Postal CodeIYesThe origin postal code.

ADDZDestination postal CodeIYesThis is the destination postal code.  

FRCGShipment ChargesOTotal Shipment Charges

FRCGMinimum ChargeOThe minimum charge if one applies.

FRCGDeficit Weight ChargeOThe deficit weight charge if one applies.

WGTSShipment Weight BilledOThe total weight that was billed.  This will include any deficit weight.

CTY1Origin City NameIThe Origin city name

ADDSOrigin StateIThe Origin's state code

CTY1Destination City NameIThe Destination city name

ADDSDestination StateIThe Destination state code

FRTPRate TypeIThe Rate Type.


2.2Related Tables 

Table Table Description




2.3Related Business Functions

Source NameFunction Name
N4900930CZAR Interface




2.4Processing 


Initialize CZAR

1.Initialize Data Structure.
2.Load Czar32.dll 

If the initialize fails, return message id '102K' and exit.
3.Load Czar Functions .
  If failed, return message id '102K' and exit.

Initialize InitializeCzar function

If failed, return message id '102K' and exit.


Initialize CZAR header fields:

Record code: 01
Multiple/Single Mode: S

Error/File Mode: E

Complete/Partial Mode: 1

Tariff Name: Rate name from the input data structure

Intrastate Switch: N

Shipment Date:Shipment date from the input data structure, edited with '-'.  Mm-dd-ccyy

Origin Zip Code: Origin Zip Code from input data structure

Origin State: Origin State from input data structure
Origin City: Origin City name from input data structure

Destination Zip Code: Destination Zip Code from input data structure

Destination State: Destination State from input data structure
Destination City: Destination City name from input data structure

Number of Detail Rec: 0  (To be updated again after the detail records have been written and counted.)

Billed Weight: 0 (To be updated by the CZAR interface)

Minimum Charge: 0 (To be updated by the CZAR interface)

Deficit Charge: 0 (To be updated by the CZAR interface)

Total Charge: 0 (To be updated by the CZAR interface)

Single Shipment: N

Use Discounts: N

Return Point Names: N

Carriage Return:

Line Feed:



Initialize CZAR Detail fields.  

Count of detail records
   = 0
Array Index = 0



Perform a loop through the Cache D4900190RE, create one detail record for each cache.


Increment the Count of Detail Records 


Initialize data in the detail structure array for the current array index
:
Record Code: 02

Class:External Freight Key from the Cache D4900190RE

Weight:Shipment Weight from the Cache D4900190RE

Rate:0 (To be updated by the CZAR interface)

Carriage Return:
Line Feed:

Increment array index.

Copy the Count of Detail Records into the Header.


Call the CZAR shipment rating function.


Check for error Code in the Header field.


If an error code is returned

If suppress error messages is not '1', Send the CZAR message text with message id '102L'

Return message id '098F'

Exit


Copy the header information from the CZAR interface to the Input Data Structure:

Billed Weight: Value from header structure
Minimum Charge: 
Value from header structure
Note, the freight rate is defined with 4 decimals and CZAR returns a charge with 2 decimals.
Deficit Charge: Value from header structure
Note, the freight rate is defined with 4 decimals and CZAR returns a charge with 2 decimals.
Total Charge: Value from header structure
Note, the freight rate is defined with 4 decimals and CZAR returns a charge with 2 decimals.


Initialize Array Index=0
Initialize the Cache Cursor  = 0

Perform a loop through the Cache D4900190RE, 


Update the Cache with Interface values

If Rate Type from the input data structure is '1'

Freight Rate:  Rate from CZAR detail structure array.   

Else, if Rate Type from the input data structure is not '1'

Freight Rate:  Charge from CZAR detail structure array.   
Note, the freight rate is defined with 4 decimals and CZAR returns a charge with 2 decimals.


Increment array index.


Terminate CZAR.



^

Data Structure

D4900940 - Internal Call to Czar.dll Interface

Parameter NameData ItemData TypeReq/OptI/O/Both
szErrorMessageIDDTAIcharOPTNONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

cSuppressErrorMessageEV01charOPTNONE

An option that specifies the type of processing for an event.

mnTransportationJobNumberJOBSMATH_NUMERICOPTNONE

The job number (work station ID) which executed the particular job.

szRateNameRTNMcharOPTNONE

The name of the rate which is used to define and calculate a freight charge.

jdDatePromisedPickJuPPDJJDEDATEOPTNONE

The promised shipment date for a sales order. This date represents the day that the item can be shipped from the warehouse.

szPostalCodeOriginADDOcharOPTNONE

The origin postal code of a shipment.

szPostalCodeDestinationADDZcharOPTNONE

The United States ZIP code or the postal code that specifies where a letter is to be routed.  Attach this code to the address for delivery in 
other countries. This code is used as the low end value when doing Postal Code Transaction range processing.

mnShipmentChargeFRCGMATH_NUMERICOPTNONE

The unit or flat amount of a freight charge.

mnMinimumChargeFRCGMATH_NUMERICOPTNONE

The unit or flat amount of a freight charge.

mnDeficitWeightChargeFRCGMATH_NUMERICOPTNONE

The unit or flat amount of a freight charge.

mnShipmentWeightBilledWGTSMATH_NUMERICOPTNONE

The shipment weight is qualified by a Weight Qualifier (WGQ) that identifies the type of weight.

szOriginCityCTY1charOPTNONE

A name that indicates the city associated with the address.

szOriginStateADDScharOPTNONE

A user defined code (00/S) that specifies the state or province. This code is usually a postal service abbreviation.

szDestinationCityCTY1charOPTNONE

A name that indicates the city associated with the address.

szDestinationStateADDScharOPTNONE

A user defined code (00/S) that specifies the state or province. This code is usually a postal service abbreviation.

cRateTypFRTPcharOPTNONE

The type of rate specified in a table.  This could be a fixed amount or percentage, for example.

Related Functions

B4900193 Cache Process Transportation Rating Cache

Related Tables

None