I 'm working on iSeries V7R3M0
I'm trying to use SQL REPLACE to remove unwanted characters from IFS file.
I used the code found in this forum (https://www.code400.com/forum/forum/iseries-programming-languages/rpg-rpgle/149402-replace-character-in-a-ifs-file)
FromIFSFile exists and has codepage=1208
Program still can not do conversion because of sqlCod = -332 which means (msg) : "Character conversion between CCSID 1208 and CCSID 65535 not valid"
Next, I created empty reslut file with CCSID 1252 before. It does not help. Result the same.
I tried also
DCL-S ToIFSFile SQLTYPE(CLOB_file) CCSID(1250);
result the same.
Does anyone know how to solve this problem ?
I'm trying to use SQL REPLACE to remove unwanted characters from IFS file.
I used the code found in this forum (https://www.code400.com/forum/forum/iseries-programming-languages/rpg-rpgle/149402-replace-character-in-a-ifs-file)
Code:
[FONT=Calibri][SIZE=10px]h Debug(*YES) [/SIZE][/FONT] [FONT=Calibri][SIZE=10px]h DatFmt(*ISO) [/SIZE][/FONT] [FONT=Calibri][SIZE=10px]h DecEdit('.') [/SIZE][/FONT] [FONT=Calibri][SIZE=10px]h Option(*SRCSTMT:*NODEBUGIO) [/SIZE][/FONT] [FONT=Calibri][SIZE=10px]h DftActGrp(*NO) ActGrp(*NEW) [/SIZE][/FONT] [FONT=Calibri][SIZE=10px]h CCSID(*CHAR :*JOBRUN) [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] DCL-S FromIFSFile SQLTYPE(CLOB_file); [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] DCL-S ToIFSFile SQLTYPE(CLOB_file) ; // CCSID(1250); [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] DCL-S msg char(512) ; [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] FromIFSFile_NAME = '/home/source.txt'; [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] FromIFSFile_NL = %len(%trim(FromIFSFile_NAME)); [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] FromIFSFile_FO = SQFRD; [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] ToIFSFile_NAME = '/home/result_tmp.txt'; [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] ToIFSFile_NL = %len(%trim(ToIFSFile_NAME)); [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] ToIFSFile_FO = SQFOVR; [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] Exec Sql Set :ToIFSFile = Replace(:FromIFSFIle, [/SIZE][/FONT][FONT=Calibri][SIZE=10px]ABCDE', ' '); [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] if ( sqlCod <> 0 ) ; [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] Exec Sql get Diagnostics condition 1 :msg = MESSAGE_TEXT; [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] endif; [/SIZE][/FONT] [FONT=Calibri][SIZE=10px] *inlr = *on ; [/SIZE][/FONT]
Program still can not do conversion because of sqlCod = -332 which means (msg) : "Character conversion between CCSID 1208 and CCSID 65535 not valid"
Next, I created empty reslut file with CCSID 1252 before. It does not help. Result the same.
I tried also
DCL-S ToIFSFile SQLTYPE(CLOB_file) CCSID(1250);
result the same.
Does anyone know how to solve this problem ?
Comment