NAME
camt - translate CAMT files from/to other formats
SYNOPSIS
camt $input_filename $output_filename
# to JSON and dd
camt camt-053.001.02-message.xml message.json
camt camt-message.xml same.dd # perl data-dumper
camt --to dd camt-message.xml - >same.dd
camt - same.dd <camt-message.xml
cat camt-message.xml | camt --to dd >same.dd
# from JSON to XML
camt --type 053.001.02 same.json message.xml
DESCRIPTION
This script helps you to access the data from CAMT (Cash Management) messages, standardized by SWIFT and used by banks and other financial services. The messages are standardized within ISO20022, see their website at https://www.iso20022.org.
Which conversion is requested is detected from the file-name extensions, where .xml
means CAMT message in xml format
.
At the moment, only JSON and Perl's Data::Dumper serializers are implemented. A useful CSV and MT940 are planned. (Please support me to implement them)
Quality
You may attempt to parse the XML of CAMT files with regular expressions, you may use xpath expresions to extract the data, but both are going around the formal message specification. This script reaches much higher quality, by strict validation and predictable data-structures.
Examples of the JSON output (and input) can be found on the examples/
directory of this module on Github: https://github.com/markov2/perl5-Business-CAMT/
Files
Either the input file or the output file must be in CAMT format. When both are in CAMT format, then the output will be a cleaned-up version (comments stripped, beautified, validated, etc).
You may use a dash (-
) as filename, to indicate stdin respectively stdout. In this case, the default type expected is .xml
(CAMT), which can be overruled with --from
and --to
.
Options
- -f --from format
-
Explicitly state the input format to be expected. This overrules the detected type based on the filename extension. This setting is especially useful when the input is received from STDIN, which defaults to xml (
CAMT
). - -t --to format
-
Explicitly state the requested output format. This overrules the detected type based on the filename extension. This setting is especially useful when the output is directed to STDOUT, which defaults to xml (
CAMT
). - --type msgtype
-
When the input is not xml (not a
CAMT
file), then you need to specify which CAMT message this is. Examples are--type camt.053.001.02 --type 053.001.02
- -b --big-numbers --no-big-numbers (default false)
-
The CAMT uses huge values as maximum. This can be handled for some output, but not for (for instance) JSON. Such values are also usually not needed, so the default is not to expect them.
- -l --log-tagnames --no-long-tagnames (default false)
-
The CAMT specification contains clear names for the data fields, but decided to trim characters from XML fields. This is really silly and needless. When you want to understand the message content without documentation, use this setting. Works for both reading as writing CAMT files.
- -s --match-scheme EXACT|NEWER|NEWEST|ANY
-
Each CAMT message comes in many versions. It has not yet been possible to include the most useful once in this distribution (please contribute), so you may want to read and write versions which are not contained. For write, this is not flexible.
For reading, a bit more flexibility is implemented. When there is an
EXACT
match, that is used. WithNEWER
(default), an attempt is made with the smallest version higher than exact version. Hopefully, your message is compatible enough. TheNEWEST
takes the latest version released as standard, but never an older version. FinallyANY
is the newest, even when it is older.
SEE ALSO
This module is part of Business-CAMT distribution for Perl. Website: http://perl.overmeer.net/CPAN/, Github: https://github.com/markov2/perl5-Business-CAMT/
LICENSE
Copyrights 2024 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/