4GL calling c function-memory fault
You may use this advice to work around this problem:
Actually this problem is occurring for lying in the popvchar function call. The 4GL function calls the “C” function as well as “len” as arguments. The “C” function calls “popchar(str,len)”; it will be utilized to extract the “str” string of “len” length from the stack.
But here the “len” is variable not passed appropriately as an argument to the “popvchar” function.
More details check Help – IBM.
Both “popquote( )” and “popvchar( )” copy accurately “len” bytes into the string buffer *qv. Here “popquote( )” pads with spaces as needed, but “popvchar( )” doesn’t pad to the full length. The finishing byte copied to the buffer is a null byte to terminate the string, so the maximum string data length is “len-1”. If the loaded argument is longer than “len-1”, its trailing bytes are lost as well it will not save the argument from the stack & memory fault occurs.
So you need to call the “popvchar()” by “popvchar(str,len-1)”.
Hope this will help to fix your issue.