Flat File created with one long string(No line Feed0

kumar1975

Active Member
Thanks in advance im on JDE 8.11 on AS400 box.
I am trying to create flat file on IFS using Business Function "Write on e line to Flat File"
it working fine on D drive but when I run on server and put on IFS its giving one long string without next line going to other row. any help?
 
Kumar,

Which "Write One Line To Flat File" are you using?
- B44H9908
- B34A1010

Confirm - you are on Unicode?

The issue might be similar to an outstanding issue with B0400520:
Please note - the "\r" resolves the similar issue in B0400520

Commented out line is SAR 8293354 (and breaks the Line Break on iSeries)
/* lWrittenByte = jdeFprintfConvert(lpBhvrCom, fOutFile, _J("%ls\n"), szWorkString);*/
lWrittenByte = jdeFprintfConvert(lpBhvrCom, fOutFile, _J("%ls\r\n"), szWorkString);

Base JDE Code in 9.0 for B44H9908 uses the 'updated' formatting:

/* Begin SAR : 8937708 - Used jdeFprintfConvert insted of jdeFprintf */
/* jdeFprintf(fpOutFile, _J("%ls\n"), lpDS->szRecord); */
jdeFprintfConvert(lpBhvrCom,fpOutFile, _J("%ls\n"), lpDS->szRecord);


If using the HomeBuilder function - you might want to replace the line to look like:

jdeFprintfConvert(lpBhvrCom,fpOutFile, _J("%ls\r\n"), lpDS->szRecord);

(note the "\r")

One of the C Experts can always chime in and explain the issue in detail. I just know to make the change as I've come across the same issue at four-plus iSeries Clients in the last two years.

(db)
 
Daniel probably has it right. Iseries likes the 'carriage Return, Line Feed', while Win is fine with just 'Line feed.' It's not a 'c' issue, it's an IBM issue.
 
Since my iSeries clients don't "usually" run their Flat-File reports on each:
- iSeries/IFS
- iSeries/QNTC(Windows Share)
- Developer Client/(local, IFS or Windows Share)

is there impact for other systems to have the \r in the mix?

I ask - only because I haven't run into an issue, yet....

I would guess that a CR and a Line-Feed might run the mix for a blank line between text on some systems?

(db)
 
As Darren has pointed out, Daniel is probably right. If his suggestion doesn't work for you... I have seen a weird issue with the newline character on an iSeries not translating correctly. In other words, the '\n' character was not translating to the proper ASCII hex value (0x0A).

I had to use something similar to:

#ifdef JDENV_AS400
jdeFprintfConvert(lpBhvrCom, fOutFile, _J("%ls<font color="red">%c</font>"), szWorkString, <font color="red">0x25</font>);
#else
...perform default logic
#endif

I never was able to determine the reason why using '\n' in the sprintf string didn't work. This was quite a long time ago...back on Xe I believe.
 
Depends in what format the output should be but have you tried P93081?
 
You should use compiler directives if your code stands a chance of running on different OS' simultaneously:

<font class="small">Code:</font><hr /><pre>
#if defined (WIN32)

----WINDOWS CODE----

#else
#ifdef JDENV_AS400

----AS400 CODE----

#endif
#endif
</pre><hr />
 
Thanks for all your advices. I really appreciate. I will try to implement them and get abck to you.
 
Back
Top