Arlina
8th October 2019, 15:12
Hi All,

Let me explain the whole situation here.
We want to create a file with fixed-length file fields without any separator.
For example column parent= tccom010.pctf is of length 20. Even if it is blank it needs to occupy 20 blanks spaces in the file. We are presently using sprintf$("%*s",20,shiftl$(parent)) to achieve it. The length of each data line to put into the file is always 3140 characters in this case.
So the issue here is, the file is not getting transferred to the local machine even if it is getting created on the server. The connection is getting lost at any random point(at seq.puts or server2client or on clicking on some variable). The same script is working fine in another environment though!!!:confused:
If we use any separator than there is no fixed-length file field and data line length is significantly reduced and it's working perfectly fine.
Can anyone please help/guide me on this?
Any suggestion is highly appreciated.

Thanks & Regards,
Arlina

okneb1
9th October 2019, 10:17
How are you calling the function seq.puts?

Is it:

seq.puts (var1 & var2 & var 3 & var 4 &...., long fp)


or
var line fixed
line = var1 & var2 & var 3 & var 4
seq.puts (line, long fp)

Also, ask your admins to compare the kernel parameters between your env. and the one where the script is working.

andreas.toepper
9th October 2019, 15:54
I did have issues with multibyte stings when using fixed length and copying fixed length parts if the multibyte strings into non multibyte strings.

I’m guessing it is something like this (in my case): a mb string had been copied into a non mb string. The string contained special chars (like German umlaut). Those special chars are coded using 4 bytes. Now in the non mb string we’ve taken 20 chars out of the string. And it happened to cut off 1, 2 or 3 bytes (of the 4 bytes of the special char) at the end of the 20 chars string. It didn’t happen often, but when it occurred, LN did crash. It’s been something like this:

string new.s(200)
domain tcnama old.s
|new.s is filled with spaces prior to this statement
new.s(5;20) = old.s

I didn’t find out exactly when or why LN crashed later, but it did occur when the 4 bytes where “cut off” in the middle. I did reprogram the code to use mb strings only and changed the new.s(x;y)-stuff. The error did not occur anymore (fingers crossed).

NPRao
9th October 2019, 20:33
string new.s(200)
domain tcnama old.s
|new.s is filled with spaces prior to this statement
new.s(5;20) = old.s

Programmer's manual suggests to use the Standard Tools Functions and not direct assignments to avoid data loss and unexpected results -

string mb.cast$() ( string_expr )
string mb.cast.to.str$() ( string_expr )

andreas.toepper
10th October 2019, 13:46
Programmer's manual suggests to use the Standard Tools Functions and not direct assignments to avoid data loss and unexpected results -
That a very good hint. I've been maintaining old code (may have been migrated from BaanIV into LN some years ago). I usually avoid direct assignments when concatenating strings (it's just not my style of coding).

okneb1
15th October 2019, 12:20
Arlina, any update? Did you manage to solve this?

Arlina
16th October 2019, 06:57
Still no luck :(

Can it be because of ulimits on the server? As smaller size files are not giving any issue.