Formatting Numbers During a Write Action

You can use the Data Exchanger component to format numbers during a Write action. The Data Exchanger component supports Fortran, C, and Java language formatting capabilities.

  1. Double-click the Data Exchanger component icon .

    The Data Exchanger Component Editor appears.

  2. From the Data Exchanger Component Editor, do one of the following:

    • Select the Write action by clicking the pink highlight in the Data Source area.

    • Select the parameter in the Parameters table, and verify that the correct Write action is selected. It will be surrounded by a blue line.

    • Select the action in the Actions list.

  3. Right-click the highlight in the Data Source area, and select Edit Format.

    The Edit Read/Write Format dialog box appears.

    Note: You can also access the Edit Read/Write Format dialog box by double-clicking the action and clicking the Format tab.

  4. Select the type of format:

    Option Description
    <No Format> Remove a format from an existing formatted Write action. The data will be read or written using the default Java rules for numbers. The Java rules always use a period as the decimal point and do not allow thousands separators in integers.
    DecimalFormat Use the Java class java.text.DecimalFormat to format the number. This is similar to COBOL pictures: # for an optional digit, 0 for a required digit, “,” for a thousands separator, “.” for the decimal point. Extra text before or after the number format is included in the output.

    Note: The thousands separator and decimal point are localized to your locale.

    Fortran Enter one format specifier as it would be used in a Fortran formatted WRITE action. Some examples are F5.3, or E12.4. The numeric format may be preceded by a text string (enclosed in single quotation marks) or by a spacing X specifier.
    C printf Enter a C-language printf format string that contains one format specifier (e.g., %4d, %5.2f, or %.5e). Characters before or after the format specifier are included in the output.
    Boolean format Control how Boolean values are printed. Specify values for true and false separated by a comma. For example T, F or .TRUE., .FALSE..
    Java Code Enter a Java expression with a type of java.text.Format. The value of the parameter will be passed to the format(Object) method of this object. This option is for advanced users.

    Note: If you set a write format when writing an array using the Vector or Table format, the output format is applied separately to each array element.

  5. Click Use this format as the default for all new read/write statements if you want all new actions to have the format you selected above.

    Warning: While you can set a format on a Read action, it typically does not work as expected and is not recommended.

  6. Click OK to save your changes and to close the dialog box.