Map3

Map3 shows how to use the PUT function to place multiple messages on the queue. The TextFile input card 1 specifies a source text file named FileIn2.txt that contains the following structure:


This is Message 001
This is Message 002
This is Message 003
This is Message 004
...
This is Message 099
This is Message 100

Map3 uses these 100 text strings to create 100 messages on the queue named .\queue1 with labels entitled Label001, Label002, and so on, up to Label100.

The MSMQQueue output card 1 defines the PUT > Target setting as Sink, which means that there is no target. The Map Designer will execute the PUT function in the map rule of the MSMQQueue output card 1 for each occurrence of the Body:TextFile object. The Map Designer will call the MSMQ Adapter, which is specified as the first argument of the function "msmq". That means that this PUT function will execute 100 times-once for each message.

Non-printable characters are not displayed in the Rule Bar. They are represented in the Rule cell on the To window as a character.

The File_In.MTT type tree is specified for the TextFile input card as the data source. The type name is File data. The Body type is a component of File with a component range of S (some).

In the TextFile input card settings for Map3, the GET > Source setting is File. The GET > Source > FilePath setting is FileIn2.txt.

The first argument of the PUT function, "msmq", is the adapter alias that specifies the MSMQ Adapter.

The second argument of the PUT function is the adapter command plus the RIGHT function that returns a specified number of characters from a text expression beginning with the rightmost byte of a text item:


               "-QN .\queue1 -T -LABEL Test001" + RIGHT(TEXT(Body:TextFile), 3)

The RIGHT(TEXT(Body:TextFile), 3 function takes the three right-most characters of the Body type on the input card named TextFile. For the first input string This is Message 001, the adapter command is:


-QN .\queue1 -T -LABEL Test001

For the second input string This is Message 002, the adapter command is:


-QN .\queue1 -T -LABEL Test002

And so on, concluding with the last message adapter command:


-QN .\queue1 -T -LABEL Test100

The third parameter of the PUT function specifies the content of the data message that is passed to the adapter. Because the Header adapter command (-HDR) is not specified, all data passed to the adapter should be treated as message bodies.


               "<BODY>" +   SYSTEM(13) + SYSTEM(10) + Body:TextFile + "</BODY>" 
                     + SYSTEM(13) + SYSTEM(10)

The decimal value for a carriage return is 13. The decimal value for a line feed is 10. The carriage return and line feed are obtained using the SYSTEM(13) and SYSTEM(10) functions.

<BODY><CR><LF> is the literal initiator for the message body passed to the adapter and </BODY><CR><LF> is the literal terminator.

The SYSTEM function must be used because <CR> and <LF> are non-printable characters.

Before you run Map3, purge the .\queue1 queue. Run Map3.