Below is an excerpt from old BBS. Please read if interested.
04565/04565 AAA00000 uzaemon Re: Problem on V5R4 TIFF2PDF
( 1) 07/04/17 22:18 Comment on 04494
> Dear Uzaemon, recently i passed my Iseries on V5R4 release and from that moment your utility don't run correctly. The PDF files generated results damaged.
> I read the post 1658 and seems to be the same problem but i don't understand the solution.
IBM has changed the default behavior of C runtime functions. For detail, see "Memo to users" (
http://publib.boulder.ibm.com/infocente ... /rzaq9.pdf), Page 12, "QLOCALE system value set to default locale during installation" and page 534 of "WebSphere Development Studio: ILE C/C++ Programmer's Guide" (
http://publib.boulder.ibm.com/infocente ... 092712.pdf). As a result, period is translated to comma in some circumstances as follows :
(*LIBL/QCSRC.LOCALE)
Code:
#include <stdio.h>
char buffer[10];
int main(void)
{
sprintf(buffer, "%f\n", 123.45678);
printf("value = %s\n", buffer);
}
> CRTBNDC PGM(LOCALE)
> CHGUSRPRF USRPRF(A) LOCALE('/qsys.lib/fr_fr.locale')
Open another 5250 session and sign-on as user A.
> call locale
value = 123,456780
----------
Having that said, there are several ways to fix this problem.
1) Compile the C modules specifying LOCALETYPE(*CLD).
2) Specify other locale for USRPRF, e.g., exec CHGUSRPRF USRPRF(A) LOCALE(*C). Other locales such as POSIX, EN_US, *NONE may also work.
3) Set locale explicitly in C program.
Add a few lines to main().
(*LIBL/QCSRC.LOCALE2)
Code:
#include <locale.h> //// Add
#include <stdio.h>
char buffer[10];
int main(void)
{
setlocale(LC_ALL, "C"); //// Add
sprintf(buffer, "%f\n", 123.45678);
printf("value = %s\n", buffer);
}
> CRTBNDC PGM(LOCALE2)
For more information of the setlocale(), check out page 322 of "ILE C/C++ Run-Time Library Functions" (
http://publib.boulder.ibm.com/infocente ... 415607.pdf).
There are other ways :
- Change system value QLOCALE
- Control the locale using environment variables
- Compile TIFF2PDF on V4R5 and earlier
Try whichever you like and let me know the result.
Waiting for your feedback.