Code: Select all
data-into putapiwms_err
%DATA(%TRIM(IFSFILE)
:'DOC=FILE case=convert allowmissing=yes +
allowextra=yes trim=none countprefix=num_')
%PARSER('YAJLINTO');
If the open API is returning -1, it means that something is wrong. You can retrieve the error number to determine what the error is...
Code: Select all
dcl-s ptr_unix_error pointer;
dcl-s unix_error int(10) based(ptr_unix_error);
dcl-pr get_unix_error extproc('__errno') pointer;
end-pr;
.
.
FD = OPEN( %TRIM(IFSFILE)
: O_RDONLY + O_TEXTDATA + O_CCSID: 0: 1208);
If (Fd < 0);
p_errno = get_unix_error();
wwErrorMsg = 'Open failed with CPE' + %char(unix_error);
// TODO: send error message somewhere...
FClose(Fd);
Else;
Assuming you want it to translate whatever the IFS file happens to be to UTF-8 (1208), the flags I'm giving above should be correct.
If you don't want it to perform any translation at all (which would make sense since both your program and file are listed as 1208 in the example where you were creating the file) then you only need this:
Code: Select all
FD = OPEN( %TRIM(IFSFILE): O_RDONLY);