# Sending Variable Length Messages Using TIBCO EMS

You can use TIBCO EMS to send variable length messages.

The following steps explain how to set up Substation ES to send variable length messages using TIBCO EMS.

Examples of these definitions are in the IVP Configuration file and are used by `DPL-BYTES` recipes. The following recipe example shows an example of the Bytes message or the Map message with the DATA field as input and a variable bytes message as output with a max length of 16384.

## Procedure

1. Define a message with only one field, which is OPAQUE.

       -------------Define Fields in a Message ------ Row 1 to 20 of 20
       Command ===>                                                   Scroll =
       (Types: DAT, OPA, MSG, STR, BOL, I8, U8, I16, U16, I32, U32, I64, U64,
               F32, F64, POR, IPA)
         Message Id ===> MSG-IO-OPAQUE
       Sel Type Dec Id  Seq Name
       - --- - --- ---- -----------------------------------------------
           OPA   0    0 0   DATA
                 0    0 0

2. In Buffer Definition, verify that the buffer offset (Start) is set to zero (0).

       -------------------------- Define Fields in a Buffer ------- Row 1 to 18 of 21
       Command ===>                                                   Scroll ==> CSR
         (Types are Str, Text, Pdec, Updec, Zdec, Uzdec, Ubin, Bin, Float, Opa)
         Buffer Id    ===> BUF-BYTES
         Maximum Size ===> 0

       Sel  Type  Start   Len     Dec  Name
       - ------ ------- ------- - -----------------------------------------------
           OPA    0       16384    0   IVP-OPAQUE
                  0       0        0

3. Configure the conversion rule so that only one output field exists and the SZ field is set to M:
   1. Add only one field in the output conversion rule.

          ------------------ Define Msg-Field / Buffer-Field Conversion - Row 1 to 1 of 1
          Command ===>                                                    Scroll ==> CSR

            Conversion Id ===> CVR-IO-BYTE
            Using Message ...: MSG-JMS-BYTE
            Using Buffer ...: BUF-BYTES
            Max Buffer Size ===> 0

          Trunc Reqd BfFld Msg Field                 | Num Buffer Field
            -    -   ----- ------------------------  | ---- -----------------------------
            Y    Y   1     DATA                      | 1   IVP-OPAQUE

   2. Set the conversion rule to the SZ field to M.

          ------------------------------ Conversion Rules ------------ Row 5 to 13 of 13
          Command ===>                                                   Scroll ==> CSR
           (Use ADD command to create a new conversion rule)
           (Use line cmd 'M' to relate Message fields to conversion rules)
                    Max    EMS  S
          Sel Flds Bufsz   Type Z Conversion Id     Message Id       Buffer Id
          - ---- ------- ---- - ---------------- ---------------- ---------------
                 1 0         B  M CVR-IO-BYTE       MSG-JMS-BYTE     BUF-BYTES

Copyright © TIBCO Software Inc. All rights reserved.