<div dir="ltr">Maybe ?<br><br>Msg1 = erl8583_message:new(),<br>Msg2 = erl8583_message:set(0, "0200", Msg1),<br>Msg3 = erl8583_message:set(2, "5234567890123456", Msg2), %% Here is Msg2, not Msg1<br>AsciiMessage =erl8583_marshaller_ascii:mars<wbr>hal(Msg3),<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-23 21:29 GMT-03:00 Nuku Ameyibor <span dir="ltr"><<a href="mailto:nayibor@gmail.com" target="_blank">nayibor@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><div>Dear List ,<br><br></div>I am writing a program where i need to pack/unpack iso messages .<br></div><div>i am using the <a href="https://github.com/mgwidmann/erl8583" target="_blank">erl8583</a> application but i am getting some errors using the packing and unpacking functions of the library .<br></div><div>
i run the <a href="https://github.com/mgwidmann/erl8583/blob/master/test/test_all.erl" target="_blank">test_all.erl</a> test script which runs the eunit scripts but got some errors .<br>
i scaled it down and run the test_asci_marshaller.erl eunit test .<br></div><div>below is part of the output below <br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><pre><code>eunit:test(test_ascii_marshall<wbr>er).
test_ascii_marshaller: pan_test...*failed*
in function erl8583_marshaller_ascii:marsh<wbr>al_data_element/2 (src/erl8583_marshaller_ascii.<wbr>erl, line 168)
called as marshal_data_element({n,fixed,<wbr>4},<<"0200">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:pan_test<wbr>/0 (test/<a href="http://test_ascii_marshaller.er">test_ascii_marshaller.er</a><wbr>l, line 43)
**error:function_clause
output:<<"">>
test_ascii_marshaller: proc_code_test...*failed*
in function erl8583_marshaller_ascii:marsh<wbr>al_data_element/2 (src/erl8583_marshaller_ascii.<wbr>erl, line 168)
called as marshal_data_element({n,fixed,<wbr>4},<<"0100">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:proc_cod<wbr>e_test/0 (test/<a href="http://test_ascii_marshaller.er">test_ascii_marshaller.er</a><wbr>l, line 49)
**error:function_clause
output:<<"">>
test_ascii_marshaller: amount_tran_test...*failed*
in function erl8583_marshaller_ascii:marsh<wbr>al_data_element/2 (src/erl8583_marshaller_ascii.<wbr>erl, line 168)
called as marshal_data_element({n,fixed,<wbr>4},<<"0200">>)
in call from erl8583_marshaller:marshal/2 (src/erl8583_marshaller.erl, line 108)
in call from test_ascii_marshaller:amount_t<wbr>ran_test/0 (test/<a href="http://test_ascii_marshaller.er">test_ascii_marshaller.er</a><wbr>l, line 55)
**error:function_clause
output:<<"">></code></pre></blockquote><br><p>i traced it down to this line in this line in erl8583_marshaller_ascii.erl</p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><pre><code>marshal_data_element({n, fixed, Length}, FieldValue) when length(FieldValue) =< Length ->
IntValue = list_to_integer(FieldValue),
erl8583_convert:integer_to_str<wbr>ing(IntValue, Length);</code></pre></blockquote><div><br>i may be wrong but seems the length(FieldValue) is being passed a binary string instead of as string ??<br></div><div>running some of the functions in the application eg . below<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Msg1 = erl8583_message:new(),<br> Msg2 = erl8583_message:set(0, "0200", Msg1),<br> Msg3 = erl8583_message:set(2, "5234567890123456", Msg1),<br> AsciiMessage =erl8583_marshaller_ascii:mars<wbr>hal(Msg3),<br></blockquote><br></div><div>gives the below error <br></div><div> a similar example is included in the test cases and i am assuming its supposed to work .<br></div><div><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">terminate reason: {undef,<br> [{undefined,get_encoding,[2],[<wbr>]},<br> {erl8583_marshaller_ascii,mars<wbr>hal_field,3,<br> [{file,"src/erl8583_marshaller<wbr>_ascii.erl"},<br> {line,109}]},<br> {erl8583_marshaller,encode,6,<br> [{file,"src/erl8583_marshaller<wbr>.erl"},{line,238}]},<br> {erl8583_marshaller,marshal,2,<br> [{file,"src/erl8583_marshaller<wbr>.erl"},{line,112}]},<br></blockquote><br></div><div><br></div><div><br></div><div><br></div><div>Anyone have any experience with using this library and can help point out what i may be doing wrong .<br></div><div>Also are there any other libraries out there for packing and unpacking iso 8583 messages in erlang .<br></div><div>searched on github but dont seem to find anything except erl8583 and some forks of it .<br></div><div>Are there other alternative approaches for this like the use of ports to help with the packing/unpacking ?<br></div><p><br></p><br><br></div><div><br><br></div></div>
</div><br></div>
<br>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>