EDI 864 : How to identify parent file type? (810, 856 or any other) - edi

I am implementing EDI (*.X12) in my application.
864 file is the file type for message exchange.
It can be used in response to any file sent from my application to my client's application.
For example:
I am sending 810 file to my client. If file has any issue with file, client will send me back 864 file with error message.
Same can be possible for 856 or any other file from my application to my client's application.
So How can I identify the original file type (810, 856 or any other) from received 864?
Like : In case of received 997 we get original file type under AK2.
Thanks In Advance.

Other than the 997 FA, there are no references to other EDI document types or control numbers.
The ASN will relate to the PO number in the PRF segment. The invoice will also reference the PO number. The 864 will have a reference to the business document that failed or needs action on.

Related

CAPL: Why am I not receiving the data bytes of a CAN message in CAPL?

I have an ECU sending a CAN message with 2 bytes of data. I want to take those 2 data bytes in CAPL and put them into 2 environment variables. I am developing a canoe simulation and I want to use those 2 environment variables to display their value in a panel.
I am seeing the CAN message with the data bytes on trace being received correctly, but when I try using those data bytes in CAPL, they are 0.
I have the following code:
message CAN1.SWversion SWversion;
on message SWversion
{
putValue(ev_MainSW, SWversion.MainSW);
putValue(ev_SecSW, SWversion.SecSW);
}
SWversion.MainSW is byte(0), SWversion.SecSW is byte(1). I see their values on trace, but in CAPL they are 0.
Any hints as to why?
Here's my trace window with the data bytes
Here's my message & signals definition in the database
Here's one of my variable definitions
In your event handler it seems that you should access the received message, not a global (obviously uninitialized) variable:
on message CAN1.SWversion
{
putValue(ev_MainSW, this.MainSW);
putValue(ev_SecSW, this.SecSW);
}
I figured it out:
message CAN1.SWversion SWversion;
on message SWversion
{
putValue(ev_MainSW, SWversion.MainSW);
putValue(ev_SecSW, SWversion.SecSW);
}
needed to be changed to
message CAN1.SWversion SWversion;
on message SWversion
{
putValue(ev_MainSW, this.byte(0));
putValue(ev_SecSW, this.byte(1);
}
Apparently, you cannot use predefined signals to access the data in a CAN message in CAPL.

How to modify message data in CAPL if message is generated by Interactive generator block?

I am using CANalyzer.
I am transmitting CAN message using Interactive Generator block. I use IG to modify signals in transmitted message by hand.
I need to automaticaly calculate checksum (the last byte in the message) every time the message is sent. Checksum is calculated from all previous data bytes in the message (message is always 8 bytes long). There is no option in IG to do that.
I need:
Set signals by hand using IG.
Automatically calculate value of the last data byte according to values of preceding data bytes.
I tried to write simple code in CAPL but without success.
I put CAPL Program node after the IG node in the Configuration window and wrote on message event in CAPL script:
on message FooMsg
{
message FooMsg msg1; // FooMsg is name of message in database
msg1 = this; // copy message from IG to temporary variable
// this.byte(7) = 0x11; // not posibble, compiler warning
msg1.byte(7) = 0x11; // constant value just for test
output(msg1); // send message
}
The message is transmitting but the Tx period set in IG is not respected (message is transmitted as fast as possible).
I thought I catch the message generated from IG, modify it and send to CAN bus.
Finally, I redesigned the whole stuff as VioletVynil recommended.
I created panels, add system variables and hooked them to controls on panels, wrote some code in CAPL for calculating checksum and periodic transmit of the message and it runs! Without any problems! And yes additional CRC on the payload is used for additional safety (railway application). I didn't designed communication protocol, I just got it.

Why do calls to IdUDPClient.SendBuffer not always return?

I need to repetitively send 4 bytes, 00 00 00 F6, every two seconds.
BUT, IdUDPClient.SendBuffer does not return after transmission.
I try sending a few more bytes, and it returns every time.
This works:
UDP.SendBuffer(RawToBytes(#0 + #0 + #0 + #1 + #127 + #128 + #246, 7));
This does not work:
UDP.SendBuffer(RawToBytes(#0 + #0 + #0 + #246, 4));
I have unsuccessfully tried many of the suggestions I have found in various related StackExchange questions.
I have seen at least three scenarios:
Hanging, Wireshark sees 1 transmission.
Working repetitive transmissions, but NOT with 4 bytes of data.
Sometimes bytes > 7F are sent as 3F.
Can someone point out what I am doing wrong?
Edit: The above happens in a thread. If the TIdUDPClient is put as a visible component on a form, then it works fine.
Could this be a threading/reentrancy issue???
It would definitely help to see more of your code, have you made sure that your thread is actually running (calling Execute) otherwise your code won´t run, obviously :)
The difference when using the TIdUDPClient component on a visible form is that it is autocreated (The constructor is run automatically by the delphi designer)
TIdUDPClient.Create(AOwner: **)
by doing so the component will be operating on the main thread ("GUI thread" if you like)
A few things I´d suggest you do in order to hunt this down is:
First Make sure that the thread is actually executing
The problem could also be that the TIdUDPClient does not have an owner if instantiated with TIdUDPClient.Create(nil) inside the thread, try to instantiate int with and owner either the TThread or the Application
TIdUDPClient.Create(Self)
or
TIdUDPClient.Create(Application)
Hope this helps, but as I said posting more of your code would definitely make it possible for me to help you!

iOS: convert stacktrace entry to method name with line number

In a production app with the debug information stripped out, how do you convert the output of:
NSLog(#"Stack Trace: %#", [exception callStackSymbols]);
To an legible class and method name? A line number would be a blessing.
Here's the output I'm getting:
0 CoreFoundation 0x23d82f23 <redacted> + 154
1 libobjc.A.dylib 0x23519ce7 objc_exception_throw + 38
2 CoreFoundation 0x23cb92f1 <redacted> + 176
3 MyApp 0x23234815 MyApp + 440341
The final line is the bread and butter line, but when I use dwarf to find the address, nothing exists.
dwarfdump --arch armv7 MyApp.dSYM --lookup 0x00234815 | grep 'Line table'
I've read here that you need to convert the stack address to something else for dwarf or atos:
https://stackoverflow.com/a/12464678/2317728
How would I find the load address or slide address to perform the calculation? Is there not a way to calculate all this prior to sending the stacktrace to the log from within the app? If not, how would I determine and calculate these values after receiving the stack trace? Better yet, is there an easier solution I'm missing?
Note I cannot just wait for crash reports since the app is small and they will never come. I'm planning on sending the stack traces to our server to be fixed as soon as they appear.
EDITORIAL
The crash reporting tools in iOS are very rough, particularly when compared to Android. In android, the buggy lines are sent to Google analytics, you use the map to debug the line--simple (comparatively). For iOS, you are confronted with: a) waiting on user bug reports (not reasonable for a small app), b) sending stack traces to a server where there are scant tools or information on how to symbolicate the stack traces, c) relying on large quasi-commercial 3rd party libraries. This definitely makes it harder to build and scale up--hoping Apple will eventually take notice. Even more hopeful someone has spotted an easier solution I might have missed ;)
Thanks for your help!
A suggestion, you can easily get the method name, exception reason and line number using:
NSLog(#"%# Exception in %s on %d due to %#",[exception name],__PRETTY_FUNCTION__,__LINE__,[exception reason]);

Limitation of IP_ADD_SOURCE_MEMBERSHIP on a Windows 2008 Server

I want to build an application which wants to recive data from several multicast groups (up to 1.000!) Is this possible with the setsockopt function (IP_ADD_SOURCE_MEMBERSHIP)? Or is there a system limit?
Is there another way to do it? Or do I have to use more than one socket?
Thanks!
I've found something on this Microsoft site: INFO: Header and Library Requirement When Set/Get Socket Options at the IPPROTO_IP Level
There exists a define
#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */
The mbuf struct has a maximum size of 108 bytes.
TCP/IP Illustrated: Vol. 2: The Implementation

Resources