FixGetMyname Function

Get the node name of this node. This function works whether or not the FIX is running.

Syntax

Function FixGetMyname (Myname, MaxSize)

Properties

The FixGetMyname function syntax has these parts:

Part

Description

object

An object expression that evaluates to an object in the Applies To list.

Myname

String. Returns the name of the current node.

MaxSize

Long. The maximum size, in bytes, to return in Myname.

Return Value

Long.

Value

Description

FTK_OK

Successful.

FTK_BAD_LENGTH

String length too small.

FTK_NODENAME_NOT_DEFINED

No node name defined for this node.

FTK_BAD_MHANDLE

Pointer to non-writable memory passed in.

FTK_NO_MESSAGE

No message exists for error.

FTK_BAD_LENGTH

String length too small.

Remarks

The maximum size for MyName (MaxSize) is NODE_NAME_SIZE.

The MyName parameter must be declared either as a fixed-length string of 9 characters before calling FixGetMyName. For example, initialize the MyName parameter in the following way:

Dim Myname As String * 9 'init variable

Myname = " " 'clear variable before usage

When the length of the Myname string (the node name) does not fill the maximum size (9 characters), the returned string contains NULL.  To remove the NULL from the VBA string, you can use the following code snippet:

rtn = FixGetMyname(Myname, 9)

StrMyNode = ""

For i = 1 To len(Myname)

rtn = Mid(Myname, i, 1)

If Asc(rtn) >= 65 And (Asc(rtn) <= 95) Then 'check if I'm Alpha

StrMyNode = StrMyNode & rtn

Else

If Asc(rtn) >= 48 And (Asc(rtn) <= 57) Then 'Check if I'm numeric

StrMyNode = StrMyNode & rtn

End If

End If

Next i

In addition, you may want to check for characters such as the underscore (_) and other valid characters used in a node name. The previous example assumes that your node name only contains the characters A to Z, or the numbers 1 to 9.