EDI
edifact parseedifact parseedifact checkedifact checkedifact writeedifact writeedifact to_rowsedifact to_rowsedifact contrledifact contrlx12 parsex12 parsex12 checkx12 checkx12 writex12 writex12 to_rowsx12 to_rowsx12 ack_997x12 ack_997

edifact parse <path_or_text>


Description

    Read an EDIFACT interchange: {separators, interchange: {syntax, syntax_version, sender, sender_qualifier, receiver, receiver_qualifier, date, time, control_ref, unb}, groups (with UNG), messages: [{type, version, release, agency, association, ref, group_ref, unh, segments: [{tag, elements: [[components]], repetitions}]}], warnings}. UNA, UNB, UNZ, UNH, UNT, UNG and UNE are not in segments. The occurrences after the first of a repeated element (syntax 4) are in repetitions, by element index

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
admin
edifact parse "UNB+UNOC:3+1234567890123:14+3210987654321:14+200315:1030+ICR1'UNH+M1+ORDERS:D:96A:UN'BGM+220+PO-12345+9'DTM+137:20200315:102'NAD+BY+1234567890123::9'NAD+SU+3210987654321::9'CUX+2:EUR:9'LIN+1++4000862141404:EN'IMD+F++:::BLUE WIDGET ?+ PLUS'QTY+21:48:PCE'PRI+AAA:12.50'UNS+S'CNT+2:1'UNT+13+M1'UNZ+1+ICR1'"
mentdb
{"separators": {"component": ":", "element": "+", "decimal": ".", "release": "?", "repetition": "", "segment": "'", "una": false}, "interchange": {"syntax": "UNOC", "syntax_version": "3", "sender": "1234567890123", "sender_qualifier": "14", "receiver": "3210987654321", "receiver_qualifier": "14", "date": "200315", "time": "1030", "control_ref": "ICR1", "unb": [["UNOC", "3"], ["1234567890123", "14"], ["3210987654321", "14"], ["200315", "1030"], ["ICR1"]]}, "messages": [{"type": "ORDERS", "version": "D", "release": "96A", "agency": "UN", "ref": "M1", "unh": [["M1"], ["ORDERS", "D", "96A", "UN"]], "segments": [{"tag": "BGM", "elements": [["220"], ["PO-12345"], ["9"]]}, {"tag": "DTM", "elements": [["137", "20200315", "102"]]}, {"tag": "NAD", "elements": [["BY"], ["1234567890123", "", "9"]]}, {"tag": "NAD", "elements": [["SU"], ["3210987654321", "", "9"]]}, {"tag": "CUX", "elements": [["2", "EUR", "9"]]}, {"tag": "LIN", "elements": [["1"], [""], ["4000862141404", "EN"]]}, {"tag": "IMD", "elements": [["F"], [""], ["", "", "", "BLUE WIDGET + PLUS"]]}, {"tag": "QTY", "elements": [["21", "48", "PCE"]]}, {"tag": "PRI", "elements": [["AAA", "12.50"]]}, {"tag": "UNS", "elements": [["S"]]}, {"tag": "CNT", "elements": [["2", "1"]]}]}], "warnings": []}
Any separators given by UNA
admin
edifact parse "UNA|~.! ^UNB~UNOC|3~A~B~200401|0900~9^UNH~1~T|D|96A|UN^AAA~x!~y~q|r^UNT~3~1^UNZ~1~9^"
mentdb
{"separators": {"component": "|", "element": "~", "decimal": ".", "release": "!", "repetition": "", "segment": "^", "una": true}, "interchange": {"syntax": "UNOC", "syntax_version": "3", "sender": "A", "sender_qualifier": "", "receiver": "B", "receiver_qualifier": "", "date": "200401", "time": "0900", "control_ref": "9", "unb": [["UNOC", "3"], ["A"], ["B"], ["200401", "0900"], ["9"]]}, "messages": [{"type": "T", "version": "D", "release": "96A", "agency": "UN", "ref": "1", "unh": [["1"], ["T", "D", "96A", "UN"]], "segments": [{"tag": "AAA", "elements": [["x~y"], ["q", "r"]]}]}], "warnings": []}
Syntax version 4: the * separates repetitions, ?* is a star
admin
edifact parse "UNB+UNOC:4+A+B+20200401:0900+9'UNH+1+T:D:01B:UN'AAA+a:b*c:d+x?*y'UNT+3+1'UNZ+1+9'"
mentdb
{"separators": {"component": ":", "element": "+", "decimal": ".", "release": "?", "repetition": "*", "segment": "'", "una": false}, "interchange": {"syntax": "UNOC", "syntax_version": "4", "sender": "A", "sender_qualifier": "", "receiver": "B", "receiver_qualifier": "", "date": "20200401", "time": "0900", "control_ref": "9", "unb": [["UNOC", "4"], ["A"], ["B"], ["20200401", "0900"], ["9"]]}, "messages": [{"type": "T", "version": "D", "release": "01B", "agency": "UN", "ref": "1", "unh": [["1"], ["T", "D", "01B", "UN"]], "segments": [{"tag": "AAA", "elements": [["a", "b"], ["x*y"]], "repetitions": {"0": [["c", "d"]]}}]}], "warnings": []}

edifact parse <path_or_text> <json_params>


Description

    Read with parameters: strict (true), encoding (overrides the charset of UNB for a file: UNOA, UNOB and UNOC are read as ISO-8859-1, UNOD to UNOL as the matching ISO-8859 part, UNOY and UNOW as UTF-8), input (auto, text or path), keep_line_breaks (false)

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
    json_params:   The parameters - String - required
admin
edifact parse "UNB+UNOC:3+1234567890123:14+3210987654321:14+200315:1030+ICR1'UNH+M1+ORDERS:D:96A:UN'BGM+220+PO-12345+9'DTM+137:20200315:102'NAD+BY+1234567890123::9'NAD+SU+3210987654321::9'CUX+2:EUR:9'LIN+1++4000862141404:EN'IMD+F++:::BLUE WIDGET ?+ PLUS'QTY+21:48:PCE'PRI+AAA:12.50'UNS+S'CNT+2:1'UNT+99+M2'UNZ+5+ICR1'" "{\"strict\": false}"
mentdb
{"separators": {"component": ":", "element": "+", "decimal": ".", "release": "?", "repetition": "", "segment": "'", "una": false}, "interchange": {"syntax": "UNOC", "syntax_version": "3", "sender": "1234567890123", "sender_qualifier": "14", "receiver": "3210987654321", "receiver_qualifier": "14", "date": "200315", "time": "1030", "control_ref": "ICR1", "unb": [["UNOC", "3"], ["1234567890123", "14"], ["3210987654321", "14"], ["200315", "1030"], ["ICR1"]]}, "messages": [{"type": "ORDERS", "version": "D", "release": "96A", "agency": "UN", "ref": "M1", "unh": [["M1"], ["ORDERS", "D", "96A", "UN"]], "segments": [{"tag": "BGM", "elements": [["220"], ["PO-12345"], ["9"]]}, {"tag": "DTM", "elements": [["137", "20200315", "102"]]}, {"tag": "NAD", "elements": [["BY"], ["1234567890123", "", "9"]]}, {"tag": "NAD", "elements": [["SU"], ["3210987654321", "", "9"]]}, {"tag": "CUX", "elements": [["2", "EUR", "9"]]}, {"tag": "LIN", "elements": [["1"], [""], ["4000862141404", "EN"]]}, {"tag": "IMD", "elements": [["F"], [""], ["", "", "", "BLUE WIDGET + PLUS"]]}, {"tag": "QTY", "elements": [["21", "48", "PCE"]]}, {"tag": "PRI", "elements": [["AAA", "12.50"]]}, {"tag": "UNS", "elements": [["S"]]}, {"tag": "CNT", "elements": [["2", "1"]]}]}], "warnings": [{"segment": 14, "line": 1, "message": "UNT announces 99 segments but the message M1 has 13"}, {"segment": 14, "line": 1, "message": "the UNT reference 'M2' differs from the UNH reference 'M1'"}, {"segment": 15, "line": 1, "message": "UNZ announces 5 messages but the interchange has 1"}]}
Messages without an interchange
admin
edifact parse "UNH+1+T:D:96A:UN'AAA+1'UNT+3+1'" "{\"strict\": false}"
mentdb
{"separators": {"component": ":", "element": "+", "decimal": ".", "release": "?", "repetition": "", "segment": "'", "una": false}, "interchange": null, "messages": [{"type": "T", "version": "D", "release": "96A", "agency": "UN", "ref": "1", "unh": [["1"], ["T", "D", "96A", "UN"]], "segments": [{"tag": "AAA", "elements": [["1"]]}]}], "warnings": [{"segment": 1, "line": 1, "message": "UNB is missing before UNH (strict false accepts it)"}, {"segment": 1, "line": 1, "message": "UNB is missing: messages alone are not an interchange (strict false accepts them)"}]}

edifact check <path_or_text>


Description

    Check an interchange without stopping at the first problem: {valid, errors: [{segment, line, message}], error_count, warnings, messages, segments}. Checked: UNT segment count and reference, UNE, UNZ count (groups when there are groups) and reference, mandatory parts of UNB and UNH, tags, the characters allowed by the syntax level (UNOA: capitals, digits and the level A marks; UNOB: printable ASCII; UNOC to UNOL: no control character). A file that cannot be read is an error of the function; garbage gives valid false. Not checked: the directory, see the description of the page

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
admin
edifact check "UNB+UNOC:3+1234567890123:14+3210987654321:14+200315:1030+ICR1'UNH+M1+ORDERS:D:96A:UN'BGM+220+PO-12345+9'DTM+137:20200315:102'NAD+BY+1234567890123::9'NAD+SU+3210987654321::9'CUX+2:EUR:9'LIN+1++4000862141404:EN'IMD+F++:::BLUE WIDGET ?+ PLUS'QTY+21:48:PCE'PRI+AAA:12.50'UNS+S'CNT+2:1'UNT+13+M1'UNZ+1+ICR1'"
mentdb
{"valid": true, "errors": [], "error_count": 0, "warnings": [], "messages": 1, "segments": 15}
Wrong counts and references
admin
edifact check "UNB+UNOC:3+1234567890123:14+3210987654321:14+200315:1030+ICR1'UNH+M1+ORDERS:D:96A:UN'BGM+220+PO-12345+9'DTM+137:20200315:102'NAD+BY+1234567890123::9'NAD+SU+3210987654321::9'CUX+2:EUR:9'LIN+1++4000862141404:EN'IMD+F++:::BLUE WIDGET ?+ PLUS'QTY+21:48:PCE'PRI+AAA:12.50'UNS+S'CNT+2:1'UNT+99+M2'UNZ+5+ICR1'"
mentdb
{"valid": false, "errors": [{"segment": 14, "line": 1, "message": "UNT announces 99 segments but the message M1 has 13"}, {"segment": 14, "line": 1, "message": "the UNT reference 'M2' differs from the UNH reference 'M1'"}, {"segment": 15, "line": 1, "message": "UNZ announces 5 messages but the interchange has 1"}], "error_count": 3, "warnings": [], "messages": 1, "segments": 15}

edifact check <path_or_text> <json_params>


Description

    Check with parameters: encoding, input

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
    json_params:   The parameters - String - required
admin
edifact check "UNB+UNOA:3+1234567890123:14+3210987654321:14+200315:1030+ICR1'UNH+M1+ORDERS:D:96A:UN'BGM+220+PO-12345+9'DTM+137:20200315:102'NAD+BY+1234567890123::9'NAD+SU+3210987654321::9'CUX+2:EUR:9'LIN+1++4000862141404:EN'IMD+F++:::Blue WIDGET ?+ PLUS'QTY+21:48:PCE'PRI+AAA:12.50'UNS+S'CNT+2:1'UNT+13+M1'UNZ+1+ICR1'" "{\"input\": \"text\"}"
mentdb
{"valid": false, "errors": [{"segment": 9, "line": 1, "message": "the character 'l' is not allowed by the syntax level UNOA"}, {"segment": 9, "line": 1, "message": "the character 'u' is not allowed by the syntax level UNOA"}, {"segment": 9, "line": 1, "message": "the character 'e' is not allowed by the syntax level UNOA"}], "error_count": 3, "warnings": [], "messages": 1, "segments": 15}
Used in use cases (1 recipe)

    Integrator & ETL developer › Import an EDIFACT purchase order and answer with an acknowledgement
Often used with

    edifact contrl  ·  edifact to_rows  ·  string substr

edifact write <json> <out_path>


Description

    Write an interchange from its JSON. A value containing a separator is released, the UNT, UNE and UNZ counts and references are computed. Without separators, the defaults are used. An element is a string or an array of components, a whole number is accepted, a decimal number must be a string. Required: interchange sender, receiver, date, control_ref; message ref, type, version, release; segments without UNH, UNT, UNB, UNZ, UNG, UNE. UNA is written when separators.una is true or when the separators are not the defaults. A separator cannot be a space (in UNA, a space means that the release or repetition character is not used); an empty release or repetition means none. Parse then write gives back the same bytes, apart from line breaks. Returns the text, or {file, bytes, encoding, segments, messages}

Parameters

    json:   The interchange as JSON (the form returned by the parse function of the same standard) - String - required
    out_path:   The file to write (atomically, the permissions of a replaced file are kept), or an empty string to get the text as the result - String - required
admin
edifact write "{\"interchange\": {\"sender\": \"S+1\", \"receiver\": \"R\", \"date\": \"200401\", \"time\": \"0900\", \"control_ref\": \"7\"}, \"messages\": [{\"type\": \"ORDERS\", \"version\": \"D\", \"release\": \"96A\", \"ref\": \"1\", \"segments\": [{\"tag\": \"BGM\", \"elements\": [\"220\", \"A'B?C\", \"9\"]}, {\"tag\": \"QTY\", \"elements\": [[\"21\", \"12.50\", \"PCE\"]]}]}]}" ""
mentdb
UNB+UNOC:3+S?+1+R+200401:0900+7'UNH+1+ORDERS:D:96A:UN'BGM+220+A?'B??C+9'QTY+21:12.50:PCE'UNT+4+1'UNZ+1+7'

edifact write <json> <out_path> <json_params>


Description

    Write with parameters: una (true or false), line_breaks (false: a new line after each segment), strict (true: refuses a character outside the syntax level or a line break in a value), encoding (the charset of the file)

Parameters

    json:   The interchange as JSON (the form returned by the parse function of the same standard) - String - required
    out_path:   The file to write (atomically, the permissions of a replaced file are kept), or an empty string to get the text as the result - String - required
    json_params:   The parameters - String - required
admin
edifact write "{\"interchange\": {\"sender\": \"S+1\", \"receiver\": \"R\", \"date\": \"200401\", \"time\": \"0900\", \"control_ref\": \"7\"}, \"messages\": [{\"type\": \"ORDERS\", \"version\": \"D\", \"release\": \"96A\", \"ref\": \"1\", \"segments\": [{\"tag\": \"BGM\", \"elements\": [\"220\", \"A'B?C\", \"9\"]}, {\"tag\": \"QTY\", \"elements\": [[\"21\", \"12.50\", \"PCE\"]]}]}]}" "" "{\"una\": true, \"line_breaks\": true}"
mentdb
UNA:+.? ' UNB+UNOC:3+S?+1+R+200401:0900+7' UNH+1+ORDERS:D:96A:UN' BGM+220+A?'B??C+9' QTY+21:12.50:PCE' UNT+4+1' UNZ+1+7'

edifact to_rows <path_or_text>


Description

    Common fields of ORDERS, DESADV and INVOIC: {interchange, decimal_mark, messages: [{header, lines, summary, packages (DESADV)}], warnings}. Header: BGM (document_code, document_number, function), dates (DTM by qualifier), parties (NAD by qualifier, with its RFF, CTA, COM), references (RFF), currency (CUX), payment (PAI), allowances (ALC with its PCD, MOA, RTE, TAX). Lines: line_no and item_id (LIN), additional_ids (PIA), descriptions (IMD), quantities (QTY), prices (PRI), amounts (MOA), taxes (TAX with its MOA), allowances (ALC), and the package (CPS) in a DESADV. Summary: after UNS+S or CNT. Another message type gives generic true with its segments. The segment groups of a partner guide may differ: see the description of the page

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
admin
edifact to_rows "UNB+UNOC:3+1234567890123:14+3210987654321:14+200315:1030+ICR1'UNH+M1+ORDERS:D:96A:UN'BGM+220+PO-12345+9'DTM+137:20200315:102'NAD+BY+1234567890123::9'NAD+SU+3210987654321::9'CUX+2:EUR:9'LIN+1++4000862141404:EN'IMD+F++:::BLUE WIDGET ?+ PLUS'QTY+21:48:PCE'PRI+AAA:12.50'UNS+S'CNT+2:1'UNT+13+M1'UNZ+1+ICR1'"
mentdb
{"interchange": {"syntax": "UNOC", "syntax_version": "3", "sender": "1234567890123", "sender_qualifier": "14", "receiver": "3210987654321", "receiver_qualifier": "14", "date": "200315", "time": "1030", "control_ref": "ICR1"}, "decimal_mark": ".", "messages": [{"type": "ORDERS", "version": "D", "release": "96A", "agency": "UN", "ref": "M1", "header": {"document_code": "220", "document_number": "PO-12345", "function": "9", "dates": {"137": {"value": "20200315", "format": "102", "iso": "2020-03-15"}}, "parties": {"BY": {"qualifier": "BY", "id": "1234567890123", "id_agency": "9"}, "SU": {"qualifier": "SU", "id": "3210987654321", "id_agency": "9"}}, "currencies": [{"role": "2", "currency": "EUR", "type": "9"}], "currency": "EUR"}, "lines": [{"line_no": "1", "item_id": "4000862141404", "item_type": "EN", "descriptions": [{"format": "F", "text": "BLUE WIDGET + PLUS"}], "quantities": {"21": {"value": "48", "unit": "PCE"}}, "prices": {"AAA": {"value": "12.50"}}}], "summary": {"control_totals": {"2": "1"}}}], "warnings": []}
An INVOIC with a comma as decimal mark
admin
edifact to_rows "UNA:+,? 'UNB+UNOC:3+SELLER+BUYER+200401:0900+7'UNH+1+INVOIC:D:01B:UN'BGM+380+INV-99+9'DTM+137:202004010830:203'NAD+SE+S1::91++Seller Ltd'CUX+2:EUR:4'PAI+::42'LIN+1++ITEM1:SRV'QTY+47:1,500:PCE'MOA+203:100,10'PRI+AAA:66,7333'TAX+7+VAT+++:::20+S'MOA+124:20,02'UNS+S'MOA+86:120,12'UNT+15+1'UNZ+1+7'"
mentdb
{"interchange": {"syntax": "UNOC", "syntax_version": "3", "sender": "SELLER", "sender_qualifier": "", "receiver": "BUYER", "receiver_qualifier": "", "date": "200401", "time": "0900", "control_ref": "7"}, "decimal_mark": ",", "messages": [{"type": "INVOIC", "version": "D", "release": "01B", "agency": "UN", "ref": "1", "header": {"document_code": "380", "document_number": "INV-99", "function": "9", "dates": {"137": {"value": "202004010830", "format": "203", "iso": "2020-04-01T08:30"}}, "parties": {"SE": {"qualifier": "SE", "id": "S1", "id_agency": "91", "name": "Seller Ltd"}}, "currencies": [{"role": "2", "currency": "EUR", "type": "4"}], "currency": "EUR", "payment": [{"means": "42"}]}, "lines": [{"line_no": "1", "item_id": "ITEM1", "item_type": "SRV", "quantities": {"47": {"value": "1.500", "unit": "PCE"}}, "amounts": {"203": {"value": "100.10"}}, "prices": {"AAA": {"value": "66.7333"}}, "taxes": [{"function": "7", "type": "VAT", "rate": "20", "category": "S", "amounts": {"124": {"value": "20.02"}}}]}], "summary": {"amounts": {"86": {"value": "120.12"}}}}], "warnings": []}
A DESADV with packages
admin
edifact to_rows "UNB+UNOC:3+A+B+200401:0900+9'UNH+1+DESADV:D:96A:UN'BGM+351+DN1+9'DTM+137:20200401:102'CPS+1'PAC+2++CT'GIN+BJ+354123450000000014'LIN+1++111:EN'QTY+12:5:PCE'UNT+9+1'UNZ+1+9'"
mentdb
{"interchange": {"syntax": "UNOC", "syntax_version": "3", "sender": "A", "sender_qualifier": "", "receiver": "B", "receiver_qualifier": "", "date": "200401", "time": "0900", "control_ref": "9"}, "decimal_mark": ".", "messages": [{"type": "DESADV", "version": "D", "release": "96A", "agency": "UN", "ref": "1", "header": {"document_code": "351", "document_number": "DN1", "function": "9", "dates": {"137": {"value": "20200401", "format": "102", "iso": "2020-04-01"}}}, "packages": [{"id": "1", "pac": [{"count": "2", "type": "CT"}], "identifiers": [{"qualifier": "BJ", "id": "354123450000000014"}]}], "lines": [{"line_no": "1", "item_id": "111", "item_type": "EN", "package": "1", "quantities": {"12": {"value": "5", "unit": "PCE"}}}], "summary": {}}], "warnings": []}

edifact to_rows <path_or_text> <json_params>


Description

    Business fields with parameters: strict (true), encoding, input, keep_line_breaks

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
    json_params:   The parameters - String - required
admin
edifact to_rows "UNB+UNOC:3+A+B+200401:0900+9'UNG+PRICAT+S+R+200401:0900+G1+UN+D:96A'UNH+1+PRICAT:D:96A:UN'BGM+220+P1+9'UNT+3+1'UNE+1+G1'UNZ+1+9'" "{\"strict\": true}"
mentdb
{"interchange": {"syntax": "UNOC", "syntax_version": "3", "sender": "A", "sender_qualifier": "", "receiver": "B", "receiver_qualifier": "", "date": "200401", "time": "0900", "control_ref": "9"}, "decimal_mark": ".", "messages": [{"type": "PRICAT", "version": "D", "release": "96A", "agency": "UN", "ref": "1", "group_ref": "G1", "generic": true, "segments": [{"tag": "BGM", "elements": [["220"], ["P1"], ["9"]]}]}], "warnings": []}
Used in use cases (1 recipe)

    Integrator & ETL developer › Import an EDIFACT purchase order and answer with an acknowledgement
Often used with

    edifact check  ·  edifact contrl  ·  string substr

edifact contrl <path_or_text>


Description

    A functional acknowledgement CONTRL for a received interchange, as text: sender and receiver swapped, UCI for the interchange, UCF for each group, UCM for each message; action 7 (acknowledged) or 4 (rejected) with the syntax error code 29 (wrong count), 28 (wrong reference), 13 (missing) or 18 (other). It reports the syntax only, not the business content. The date and the time default to now: give them for a repeatable result

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
admin
edifact contrl "UNB+UNOC:3+1234567890123:14+3210987654321:14+200315:1030+ICR1'UNH+M1+ORDERS:D:96A:UN'BGM+220+PO-12345+9'DTM+137:20200315:102'NAD+BY+1234567890123::9'NAD+SU+3210987654321::9'CUX+2:EUR:9'LIN+1++4000862141404:EN'IMD+F++:::BLUE WIDGET ?+ PLUS'QTY+21:48:PCE'PRI+AAA:12.50'UNS+S'CNT+2:1'UNT+13+M1'UNZ+1+ICR1'"
mentdb
UNB+UNOC:3+3210987654321:14+1234567890123:14+261104:1002+1'UNH+1+CONTRL:D:3:UN'UCI+ICR1+1234567890123:14+3210987654321:14+7'UCM+M1+ORDERS:D:96A:UN+7'UNT+4+1'UNZ+1+1'

edifact contrl <path_or_text> <json_params>


Description

    CONTRL with parameters: date, time, control_ref ("1"), message_ref ("1"), message_version ("D:3:UN", the version of CONTRL your partner expects, such as 4:1:UN in syntax 4), line_breaks, encoding, input

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
    json_params:   The parameters - String - required
admin
edifact contrl "UNB+UNOC:3+1234567890123:14+3210987654321:14+200315:1030+ICR1'UNH+M1+ORDERS:D:96A:UN'BGM+220+PO-12345+9'DTM+137:20200315:102'NAD+BY+1234567890123::9'NAD+SU+3210987654321::9'CUX+2:EUR:9'LIN+1++4000862141404:EN'IMD+F++:::BLUE WIDGET ?+ PLUS'QTY+21:48:PCE'PRI+AAA:12.50'UNS+S'CNT+2:1'UNT+14+M1'UNZ+1+ICR1'" "{\"date\": \"200316\", \"time\": \"0800\", \"control_ref\": \"C1\", \"message_ref\": \"R1\"}"
mentdb
UNB+UNOC:3+3210987654321:14+1234567890123:14+200316:0800+C1'UNH+R1+CONTRL:D:3:UN'UCI+ICR1+1234567890123:14+3210987654321:14+7'UCM+M1+ORDERS:D:96A:UN+4+29'UNT+4+R1'UNZ+1+C1'
A group
admin
edifact contrl "UNB+UNOC:3+A+B+200401:0900+9'UNG+ORDERS+S+R+200401:0900+G1+UN+D:96A'UNH+1+ORDERS:D:96A:UN'BGM+220+P1+9'UNT+3+1'UNE+1+G1'UNZ+1+9'" "{\"date\": \"200316\", \"time\": \"0800\"}"
mentdb
UNB+UNOC:3+B+A+200316:0800+1'UNH+1+CONTRL:D:3:UN'UCI+9+A+B+7'UCF+G1+S+R+7'UCM+1+ORDERS:D:96A:UN+7'UNT+5+1'UNZ+1+1'
Used in use cases (1 recipe)

    Integrator & ETL developer › Import an EDIFACT purchase order and answer with an acknowledgement
Often used with

    edifact check  ·  edifact to_rows  ·  string substr

x12 parse <path_or_text>


Description

    Read an X12 interchange. The separators are read at the fixed positions of ISA; newlines after the terminator are ignored. {separators, interchange: {auth_qualifier, auth, security_qualifier, security, sender_qualifier, sender, receiver_qualifier, receiver, date, time, standards_id, version, control_number, ack_requested, usage}, groups: [{functional_id, sender, receiver, date, time, control_number, agency, version, transactions: [{type, control_number, implementation, segments: [{tag, elements: [[components]], repetitions}]}]}], warnings}. ISA, IEA, GS, GE, ST and SE are not in segments

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
admin
x12 parse "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*12*0001~GE*1*1~IEA*1*000000905~"
mentdb
{"separators": {"element": "*", "repetition": "", "component": ">", "segment": "~"}, "interchange": {"auth_qualifier": "00", "auth": "", "security_qualifier": "00", "security": "", "sender_qualifier": "ZZ", "sender": "SENDERID", "receiver_qualifier": "ZZ", "receiver": "RECEIVERID", "date": "200315", "time": "1030", "standards_id": "U", "version": "00401", "control_number": "000000905", "ack_requested": "0", "usage": "T"}, "groups": [{"functional_id": "PO", "sender": "SENDERID", "receiver": "RECEIVERID", "date": "20200315", "time": "1030", "control_number": "1", "agency": "X", "version": "004010", "transactions": [{"type": "850", "control_number": "0001", "segments": [{"tag": "BEG", "elements": [["00"], ["SA"], ["PO-1"], [""], ["20200315"]]}, {"tag": "REF", "elements": [["DP"], ["038"]]}, {"tag": "N1", "elements": [["BY"], ["ACME"], ["92"], ["1234"]]}, {"tag": "N3", "elements": [["1 MAIN ST"]]}, {"tag": "N4", "elements": [["CITY"], ["CA"], ["90210"], ["US"]]}, {"tag": "PO1", "elements": [["1"], ["48"], ["EA"], ["12.50"], ["PE"], ["UP"], ["012345678905"]]}, {"tag": "PID", "elements": [["F"], [""], [""], [""], ["BLUE WIDGET"]]}, {"tag": "CTP", "elements": [[""], ["RES"], ["19.99"]]}, {"tag": "SAC", "elements": [["A"], ["C310"], [""], [""], ["2500"]]}, {"tag": "CTT", "elements": [["1"], ["48"]]}]}]}], "warnings": []}
Version 00501: ^ separates repetitions
admin
x12 parse "ISA*00* *00* *ZZ*A *ZZ*B *200315*1030*^*00501*000000001*0*P*:~GS*PO*A*B*20200315*1030*1*X*005010~ST*850*0001~REF*ZZ*a^b:c~SE*3*0001~GE*1*1~IEA*1*000000001~"
mentdb
{"separators": {"element": "*", "repetition": "^", "component": ":", "segment": "~"}, "interchange": {"auth_qualifier": "00", "auth": "", "security_qualifier": "00", "security": "", "sender_qualifier": "ZZ", "sender": "A", "receiver_qualifier": "ZZ", "receiver": "B", "date": "200315", "time": "1030", "version": "00501", "control_number": "000000001", "ack_requested": "0", "usage": "P"}, "groups": [{"functional_id": "PO", "sender": "A", "receiver": "B", "date": "20200315", "time": "1030", "control_number": "1", "agency": "X", "version": "005010", "transactions": [{"type": "850", "control_number": "0001", "segments": [{"tag": "REF", "elements": [["ZZ"], ["a"]], "repetitions": {"1": [["b", "c"]]}}]}]}], "warnings": []}

x12 parse <path_or_text> <json_params>


Description

    Read with parameters: strict (true; false also accepts an ISA that is not the fixed record, by its 16 elements), encoding (by default UTF-8 when the file is valid UTF-8, else ISO-8859-1), input

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
    json_params:   The parameters - String - required
admin
x12 parse "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*13*0002~GE*2*1~IEA*1*000000905~" "{\"strict\": false}"
mentdb
{"separators": {"element": "*", "repetition": "", "component": ">", "segment": "~"}, "interchange": {"auth_qualifier": "00", "auth": "", "security_qualifier": "00", "security": "", "sender_qualifier": "ZZ", "sender": "SENDERID", "receiver_qualifier": "ZZ", "receiver": "RECEIVERID", "date": "200315", "time": "1030", "standards_id": "U", "version": "00401", "control_number": "000000905", "ack_requested": "0", "usage": "T"}, "groups": [{"functional_id": "PO", "sender": "SENDERID", "receiver": "RECEIVERID", "date": "20200315", "time": "1030", "control_number": "1", "agency": "X", "version": "004010", "transactions": [{"type": "850", "control_number": "0001", "segments": [{"tag": "BEG", "elements": [["00"], ["SA"], ["PO-1"], [""], ["20200315"]]}, {"tag": "REF", "elements": [["DP"], ["038"]]}, {"tag": "N1", "elements": [["BY"], ["ACME"], ["92"], ["1234"]]}, {"tag": "N3", "elements": [["1 MAIN ST"]]}, {"tag": "N4", "elements": [["CITY"], ["CA"], ["90210"], ["US"]]}, {"tag": "PO1", "elements": [["1"], ["48"], ["EA"], ["12.50"], ["PE"], ["UP"], ["012345678905"]]}, {"tag": "PID", "elements": [["F"], [""], [""], [""], ["BLUE WIDGET"]]}, {"tag": "CTP", "elements": [[""], ["RES"], ["19.99"]]}, {"tag": "SAC", "elements": [["A"], ["C310"], [""], [""], ["2500"]]}, {"tag": "CTT", "elements": [["1"], ["48"]]}]}]}], "warnings": [{"segment": 14, "line": 1, "message": "SE01 announces 13 segments but the transaction 0001 has 12"}, {"segment": 14, "line": 1, "message": "SE02 '0002' differs from ST02 '0001'"}, {"segment": 15, "line": 1, "message": "GE01 announces 2 transactions but the group has 1"}]}

x12 check <path_or_text>


Description

    Check an interchange: {valid, errors: [{segment, line, message}], error_count, warnings, groups, transactions, segments}. Checked: ISA exactly 106 characters with the separators in place, ISA13 of 9 digits, SE01 and SE02, GE01 and GE02, IEA01 and IEA02, tags, control characters. Not checked: the standards tables, see the description of the page

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
admin
x12 check "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*12*0001~GE*1*1~IEA*1*000000905~"
mentdb
{"valid": true, "errors": [], "error_count": 0, "warnings": [], "groups": 1, "transactions": 1, "segments": 16}
Wrong counts and control numbers
admin
x12 check "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*13*0002~GE*2*1~IEA*1*000000905~"
mentdb
{"valid": false, "errors": [{"segment": 14, "line": 1, "message": "SE01 announces 13 segments but the transaction 0001 has 12"}, {"segment": 14, "line": 1, "message": "SE02 '0002' differs from ST02 '0001'"}, {"segment": 15, "line": 1, "message": "GE01 announces 2 transactions but the group has 1"}], "error_count": 3, "warnings": [], "groups": 1, "transactions": 1, "segments": 16}

x12 check <path_or_text> <json_params>


Description

    Check with parameters: encoding, input

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
    json_params:   The parameters - String - required
admin
x12 check "ISA*00* *00* *ZZ*SENDERID*ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*12*0001~GE*1*1~IEA*1*000000905~" "{\"input\": \"text\"}"
mentdb
{"valid": false, "errors": [{"segment": 1, "line": 1, "message": "ISA is not the fixed record of 106 characters (the element separator must be at the positions 3, 6, 17, 20, 31, 34, 50, 53, 69, 72, 76, 81, 83, 89, 99, 101, 103)"}], "error_count": 1, "warnings": [], "groups": 1, "transactions": 1, "segments": 16}

x12 write <json> <out_path>


Description

    Write an interchange from its JSON: ISA padded to its fixed widths, SE, GE and IEA computed. X12 has no release character: a value containing a separator is an error, choose other separators (a space cannot be a separator). Defaults: separators * : ~ (and ^ from version 00402), version 00401, qualifiers ZZ, usage P. Required: interchange sender, receiver, date YYMMDD, time HHMM, control_number; groups with functional_id, sender, receiver, date, time, control_number, version; transactions with type, control_number, segments without ISA, IEA, GS, GE, ST, SE. Parse then write gives back the same bytes, apart from line breaks. Returns the text, or {file, bytes, encoding, segments, messages}

Parameters

    json:   The interchange as JSON (the form returned by the parse function of the same standard) - String - required
    out_path:   The file to write (atomically, the permissions of a replaced file are kept), or an empty string to get the text as the result - String - required
admin
x12 write "{\"interchange\": {\"sender\": \"S\", \"receiver\": \"R\", \"date\": \"200315\", \"time\": \"1030\", \"control_number\": \"7\"}, \"groups\": [{\"functional_id\": \"PO\", \"sender\": \"S\", \"receiver\": \"R\", \"date\": \"20200315\", \"time\": \"1030\", \"control_number\": \"9\", \"version\": \"004010\", \"transactions\": [{\"type\": \"850\", \"control_number\": \"0001\", \"segments\": [{\"tag\": \"BEG\", \"elements\": [\"00\", \"SA\", \"P1\", \"\", \"20200315\"]}]}]}]}" ""
mentdb
ISA*00* *00* *ZZ*S *ZZ*R *200315*1030*U*00401*000000007*0*P*:~GS*PO*S*R*20200315*1030*9*X*004010~ST*850*0001~BEG*00*SA*P1**20200315~SE*3*0001~GE*1*9~IEA*1*000000007~

x12 write <json> <out_path> <json_params>


Description

    Write with parameters: line_breaks (false), encoding (UTF-8)

Parameters

    json:   The interchange as JSON (the form returned by the parse function of the same standard) - String - required
    out_path:   The file to write (atomically, the permissions of a replaced file are kept), or an empty string to get the text as the result - String - required
    json_params:   The parameters - String - required
admin
x12 write "{\"interchange\": {\"sender\": \"S\", \"receiver\": \"R\", \"date\": \"200315\", \"time\": \"1030\", \"control_number\": \"7\"}, \"groups\": [{\"functional_id\": \"PO\", \"sender\": \"S\", \"receiver\": \"R\", \"date\": \"20200315\", \"time\": \"1030\", \"control_number\": \"9\", \"version\": \"004010\", \"transactions\": [{\"type\": \"850\", \"control_number\": \"0001\", \"segments\": [{\"tag\": \"BEG\", \"elements\": [\"00\", \"SA\", \"P1\", \"\", \"20200315\"]}]}]}]}" "" "{\"line_breaks\": true}"
mentdb
ISA*00* *00* *ZZ*S *ZZ*R *200315*1030*U*00401*000000007*0*P*:~ GS*PO*S*R*20200315*1030*9*X*004010~ ST*850*0001~ BEG*00*SA*P1**20200315~ SE*3*0001~ GE*1*9~ IEA*1*000000007~

x12 to_rows <path_or_text>


Description

    Common fields of 850, 856 and 810: {interchange, transactions: [{type, control_number, header, lines, summary, hierarchy (856)}], warnings}. 850: BEG, REF, DTM, CUR, N1 loops (N1, N2, N3, N4, PER by entity code), PO1 with its PID, CTP, SAC, REF, CTT. 810: BIG, IT1, TDS, TXI, SAC, CTT. 856: BSN and the flat list of the HL levels (id, parent, level, level_name, children), each with its LIN, SN1, PRF, MAN, N1, REF; lines are the item levels with the po_number and the mark inherited from their parents. Another type gives generic true with its segments

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
admin
x12 to_rows "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*12*0001~GE*1*1~IEA*1*000000905~"
mentdb
{"interchange": {"auth_qualifier": "00", "auth": "", "security_qualifier": "00", "security": "", "sender_qualifier": "ZZ", "sender": "SENDERID", "receiver_qualifier": "ZZ", "receiver": "RECEIVERID", "date": "200315", "time": "1030", "standards_id": "U", "version": "00401", "control_number": "000000905", "ack_requested": "0", "usage": "T"}, "transactions": [{"type": "850", "control_number": "0001", "header": {"purpose": "00", "order_type": "SA", "po_number": "PO-1", "date": "20200315", "date_iso": "2020-03-15", "references": [{"qualifier": "DP", "value": "038"}], "parties": {"BY": {"entity": "BY", "name": "ACME", "id_qualifier": "92", "id": "1234", "address": ["1 MAIN ST"], "city": "CITY", "state": "CA", "postal_code": "90210", "country": "US"}}}, "lines": [{"line": "1", "quantity": "48", "unit": "EA", "unit_price": "12.50", "price_basis": "PE", "ids": [{"qualifier": "UP", "value": "012345678905"}], "descriptions": [{"type": "F", "text": "BLUE WIDGET"}], "prices": [{"code": "RES", "price": "19.99"}], "allowances": [{"indicator": "A", "kind": "allowance", "code": "C310", "amount_raw": "2500", "amount": "25.00"}]}], "summary": {"line_count": "1", "hash_total": "48"}, "group_control_number": "1", "functional_id": "PO"}], "warnings": []}
An invoice
admin
x12 to_rows "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*IN*S*R*20200315*1030*2*X*004010~ST*810*0002~BIG*20200315*INV-1*20200301*PO-1~N1*BT*BUYER~IT1*1*10*EA*2.5**UP*012345678905~TDS*2500~SAC*C*D240***1000~CTT*1~SE*8*0002~GE*1*2~IEA*1*000000905~"
mentdb
{"interchange": {"auth_qualifier": "00", "auth": "", "security_qualifier": "00", "security": "", "sender_qualifier": "ZZ", "sender": "SENDERID", "receiver_qualifier": "ZZ", "receiver": "RECEIVERID", "date": "200315", "time": "1030", "standards_id": "U", "version": "00401", "control_number": "000000905", "ack_requested": "0", "usage": "T"}, "transactions": [{"type": "810", "control_number": "0002", "header": {"date": "20200315", "date_iso": "2020-03-15", "invoice_number": "INV-1", "po_date": "20200301", "po_date_iso": "2020-03-01", "po_number": "PO-1", "parties": {"BT": {"entity": "BT", "name": "BUYER"}}}, "lines": [{"line": "1", "quantity": "10", "unit": "EA", "unit_price": "2.5", "ids": [{"qualifier": "UP", "value": "012345678905"}]}], "summary": {"total_raw": "2500", "total": "25.00", "allowances": [{"indicator": "C", "kind": "charge", "code": "D240", "amount_raw": "1000", "amount": "10.00"}], "line_count": "1"}, "group_control_number": "2", "functional_id": "IN"}], "warnings": []}
A ship notice
admin
x12 to_rows "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*SH*S*R*20200315*1030*3*X*004010~ST*856*0003~BSN*00*SHIP1*20200315*1030*0001~HL*1**S~N1*ST*STORE~HL*2*1*O~PRF*PO-1~HL*3*2*P~MAN*GM*00354123450000000014~HL*4*3*I~LIN**UP*012345678905~SN1**5*EA~CTT*4~SE*13*0003~GE*1*3~IEA*1*000000905~"
mentdb
{"interchange": {"auth_qualifier": "00", "auth": "", "security_qualifier": "00", "security": "", "sender_qualifier": "ZZ", "sender": "SENDERID", "receiver_qualifier": "ZZ", "receiver": "RECEIVERID", "date": "200315", "time": "1030", "standards_id": "U", "version": "00401", "control_number": "000000905", "ack_requested": "0", "usage": "T"}, "transactions": [{"type": "856", "control_number": "0003", "header": {"purpose": "00", "shipment_id": "SHIP1", "date": "20200315", "date_iso": "2020-03-15", "time": "1030", "hierarchy_code": "0001"}, "hierarchy": [{"id": "1", "parent": "", "level": "S", "level_name": "shipment", "parties": {"ST": {"entity": "ST", "name": "STORE"}}, "children": ["2"]}, {"id": "2", "parent": "1", "level": "O", "level_name": "order", "po_number": "PO-1", "children": ["3"]}, {"id": "3", "parent": "2", "level": "P", "level_name": "pack", "marks": [{"qualifier": "GM", "value": "00354123450000000014"}], "children": ["4"]}, {"id": "4", "parent": "3", "level": "I", "level_name": "item", "assigned": "", "ids": [{"qualifier": "UP", "value": "012345678905"}], "quantity": "5", "unit": "EA"}], "lines": [{"hl": "4", "po_number": "PO-1", "mark": "00354123450000000014", "assigned": "", "ids": [{"qualifier": "UP", "value": "012345678905"}], "quantity": "5", "unit": "EA"}], "summary": {"line_count": "4"}, "group_control_number": "3", "functional_id": "SH"}], "warnings": []}

x12 to_rows <path_or_text> <json_params>


Description

    Business fields with parameters: strict (true), encoding, input

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
    json_params:   The parameters - String - required
admin
x12 to_rows "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*13*0002~GE*2*1~IEA*1*000000905~" "{\"strict\": false}"
mentdb
{"interchange": {"auth_qualifier": "00", "auth": "", "security_qualifier": "00", "security": "", "sender_qualifier": "ZZ", "sender": "SENDERID", "receiver_qualifier": "ZZ", "receiver": "RECEIVERID", "date": "200315", "time": "1030", "standards_id": "U", "version": "00401", "control_number": "000000905", "ack_requested": "0", "usage": "T"}, "transactions": [{"type": "850", "control_number": "0001", "header": {"purpose": "00", "order_type": "SA", "po_number": "PO-1", "date": "20200315", "date_iso": "2020-03-15", "references": [{"qualifier": "DP", "value": "038"}], "parties": {"BY": {"entity": "BY", "name": "ACME", "id_qualifier": "92", "id": "1234", "address": ["1 MAIN ST"], "city": "CITY", "state": "CA", "postal_code": "90210", "country": "US"}}}, "lines": [{"line": "1", "quantity": "48", "unit": "EA", "unit_price": "12.50", "price_basis": "PE", "ids": [{"qualifier": "UP", "value": "012345678905"}], "descriptions": [{"type": "F", "text": "BLUE WIDGET"}], "prices": [{"code": "RES", "price": "19.99"}], "allowances": [{"indicator": "A", "kind": "allowance", "code": "C310", "amount_raw": "2500", "amount": "25.00"}]}], "summary": {"line_count": "1", "hash_total": "48"}, "group_control_number": "1", "functional_id": "PO"}], "warnings": [{"segment": 14, "line": 1, "message": "SE01 announces 13 segments but the transaction 0001 has 12"}, {"segment": 14, "line": 1, "message": "SE02 '0002' differs from ST02 '0001'"}, {"segment": 15, "line": 1, "message": "GE01 announces 2 transactions but the group has 1"}]}

x12 ack_997 <path_or_text>


Description

    A functional acknowledgement 997 as text: sender and receiver swapped, one FA group for each received group, AK1, then AK2 and AK5 for each transaction, then AK9. AK5 is A, or R with the code 2 (missing SE), 3 (control number) or 4 (segment count); AK9 is A, P or R with the code 3 (missing GE), 4 (control number) or 5 (transaction count). AK5 R with code 5 marks any other error inside a transaction (invalid tag, control character); an error between SE and GE, or outside the groups (a wrong IEA, for example), makes AK9 R. An interchange without a functional group is an error. It reports the envelope only, there is no AK3 or AK4 about the content. The date and the time default to now: give them for a repeatable result

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
admin
x12 ack_997 "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*12*0001~GE*1*1~IEA*1*000000905~"
mentdb
ISA*00* *00* *ZZ*RECEIVERID *ZZ*SENDERID *261104*1002*U*00401*000000001*0*T*>~GS*FA*RECEIVERID*SENDERID*20261104*1002*1*X*004010~ST*997*0001~AK1*PO*1~AK2*850*0001~AK5*A~AK9*A*1*1*1~SE*6*0001~GE*1*1~IEA*1*000000001~

x12 ack_997 <path_or_text> <json_params>


Description

    The 997 with parameters: date (CCYYMMDD), time (HHMM), control_number (1), version (GS08, by default the 6 first characters of the received one), usage (as received), line_breaks, encoding, input

Parameters

    path_or_text:   A file path (read with the same rights as file load), or the message itself: a text beginning with UNA, UNB+ or UNH+ (ISA and a separator for X12), or holding a line break, or longer than 4096 characters - String - required
    json_params:   The parameters - String - required
admin
x12 ack_997 "ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *200315*1030*U*00401*000000905*0*T*>~GS*PO*SENDERID*RECEIVERID*20200315*1030*1*X*004010~ST*850*0001~BEG*00*SA*PO-1**20200315~REF*DP*038~N1*BY*ACME*92*1234~N3*1 MAIN ST~N4*CITY*CA*90210*US~PO1*1*48*EA*12.50*PE*UP*012345678905~PID*F****BLUE WIDGET~CTP**RES*19.99~SAC*A*C310***2500~CTT*1*48~SE*13*0001~GE*1*1~IEA*1*000000905~" "{\"date\": \"20200316\", \"time\": \"0800\", \"control_number\": \"5\"}"
mentdb
ISA*00* *00* *ZZ*RECEIVERID *ZZ*SENDERID *200316*0800*U*00401*000000005*0*T*>~GS*FA*RECEIVERID*SENDERID*20200316*0800*5*X*004010~ST*997*0001~AK1*PO*1~AK2*850*0001~AK5*R*4~AK9*R*1*1*0~SE*6*0001~GE*1*5~IEA*1*000000005~