Hi all,
I have daily generated Swift MT103 and MT202 messages in text files with the following format:
file 00590031.txt
{1:X12XXXXXXXXXXXX1234567890}{4:{177:1234567890}{451:0}{108:12345678910112XX}}{1:X12XXXXXXXXXXXX1234567891}{2:X1234XXXXXXXXXXXX}{3:{108:12345678902033XX}}{4:
:20:12345678910111X
:32A:151102USD220000,
:53B:/12334
:57A:XXXXXX12XXX
:72:/XXX/XXX. XXXXXX X/X 12345678
-}{5:{MAC:00000000}{CHK:123456XXX1X2}}
file 00590032.txt
{1:X12XXXXXXXXXXXX1234567890}{4:{177:1234567890}{451:0}{108:12345678910112XX}}{1:X12XXXXXXXXXXXX1234567890}{2:X123XXXXXX12XXXXX}{3:{108:12567891011121XX}}{4:
:20:12345678910111X
:21:XXXXXX1234XXXX1X
:32A:131122USD10000000,
:53B:12345678
:57A:XXXXXX12XXX
:58A:XXXXXX13XXX
XX1234XXX
-}{5:{MAC:00000000}{CHK:12X1X123XX12}}
file 00590033.txt
{1:X12XXXXXXXXXXXX1234567890}{4:{177:1234567890}{123:0}}{1:X12XXXXXXXXXXXX1234567890}{2:X123XXXXXXXXXXXXX}{4:
:20:ABC/ACC/OPS 123
:23B:CRED
:32A:151207KWD100,000
:50A:ABCDEFGH
:53B:/1123456789
:57A:ABCDEFGH
:59:/XX12XXXX0000000000000000000000
XXXXXX XXXX XXXXXX XX-XXXXXXXX
XXXX X/X
:70:XXXX XXX : 123456
XXXXXXX X/X XXXX XXXXXXXXXX
XXXXXXXXXXX, XXXXXX.
:71A:OUR
-}{5:{MAC:00000000}{CHK:1X12X12X1234}}
Using SSIS, how can I loop through each file and import only the selected contents from the files?
For example file 00590032.txt I need:
"12345678910111X" from key reference 20 to be inserted into column name "Transaction Reference Number" in the database table.
"131122USD10000000," from key reference 32A to be inserted into the following columns:
"131122" --> "Value Date" (yyMMdd), "USD" --> "Currency", "10000000," --> "Interbank Settled Amount" (in the amount the comma is the decimal point followed by 00)
"XXXXXX12XXX" from key reference 57A to be inserted into column name "Account With Institution 1".
"XXXXXX13XXX" from key reference 58A to be inserted into column name "Beneficiary Institution 1"
"XX1234XXX" from the line after reference 58A to be inserted into column name "Beneficiary Customer 1"
----
For the other text files, I will need to map the key references:
21 --> "Related Reference"
23B --> "Bank Operation Code"
53B --> "Sender's Correspondent"
57D --> "Account With Institution 1"
58D --> "Beneficiary Institution 2"
58D --> "Beneficiary Customer 2" on the second line
59 --> "Beneficiary Customer"
70 --> "Remittance Information"
71A --> "Details of Charges"
72 --> "Sender to Receiver Information"
I tried inserting the values from a single Swift text file but it fails when I switch to another swift text file with different key references.
How can I maintain the column mapping for all the text files with different key references.
I appreciate any help.
Thanks in advance.