Skip to content

Element <ama-generate>

Purpose: Render configured AMA/EDIFACT messages and their associated artifacts and packages.

Why: Use it to assemble deterministic EDIFACT messages, sidecars, and package artifacts for one delivery.

Example

1
<ama-generate defaultEdifactProfileRef="uoc3_comma" variablePrefix="__" variableSuffix="__"/>

Decision guide

Business value: Makes a partner delivery reproducible from declared templates, variables, outputs, and packaging.

  • Use when

    • A data model must produce configured AMA/EDIFACT files and associated delivery artifacts.
  • Choose another approach when

    • The requirement is ordinary record generation, a generic file export, or an unbounded stream.
  • Prerequisites

    • Declare local templates, outputs, and any referenced EDIFACT profiles.
  • Alternatives

    • Use generate for general record and artifact generation. (See: <generate>)

Complete examples

Render profiled EDIFACT output and package its artifacts

Use the AMA family when partner-specific EDIFACT separators, templates, output names, side artifacts, and archive packaging must be modeled together.

ama-edifact-package/templates/order.template.edi
1
UNH+__message_id__+ORDERS:D:96A:UN'
ama-edifact-package/datamimic.xml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<setup rngSeed="42">
    <ama-generate defaultEdifactProfileRef="unoc3" variablePrefix="__" variableSuffix="__">
        <edifactProfiles>
            <profile id="unoc3" decimal="." data="+" comp=":" release="?" term="'"/>
        </edifactProfiles>
        <templates>
            <template id="order_template"
                      path="templates/order.template.edi"
                      edifactProfileRef="unoc3"
                      sourceScripted="True"/>
        </templates>
        <variable name="message_id" generator="IncrementGenerator"/>
        <output type="ORDERS" templateRef="order_template" filename="ORDERS___message_id__"/>
        <artifact type="edi_outputs" folder="edi"/>
        <artifact type="edifact_trace_csv" filename="ORDERS___message_id___trace.csv"/>
        <package type="zip" filename="ORDERS___message_id__.zip"/>
    </ama-generate>
</setup>

Rules and invalid combinations

I621 — Parser AMA Reference Invalid

AMA {reference_kind} '{reference}' is invalid: {reason}

Why: The AMA block contains a duplicate identifier or an unresolved local reference.

Resolution: Declare each profile and template once, then reference an existing identifier.

Full rule

Allowed parents / Allowed children

Allowed parents: else, else-if, if, setup, while

Allowed children:

artifact, edifactProfiles, output, package, template, templates, variable

Attributes

Show all 7 attributes

defaultEdifactProfileRef

Default EDIFACT profile reference id.

optional; string; Default: null.

encoding

Encoding override for AMA outputs.

optional; string; Default: null.

name

Name of the AMA generate block.

optional; string; Default: "AmaGenerateModel".

outputDir

Output directory for generated EDI files (transitional).

optional; string; Default: null.

separator

CSV separator for AMA trace outputs.

optional; string; Default: null.

variablePrefix

Variable name prefix for AMA templates.

optional; string; Default: null.

variableSuffix

Variable name suffix for AMA templates.

optional; string; Default: null.