Page 1 of 1

YAJL_SAVEBUF Question

Posted: Wed Nov 13, 2024 10:43 pm
by jlrengel
Hello Scott,

I am copying two JSONs to the IFS as follows:

S_Dest = '/HOME/SAPINT/' + PMINTT + '_' + %TRIM(PMEVNT) + '_' + PMVIN
+ '.json';
1) YAJL_SAVEBUF('/TMP/SVSSAPINT.JSON':S_ERRMSG);
2) YAJL_SAVEBUF(S_DEST : S_ERRMSG);
In the 2) I am concatenating the name of the json to save in a different location /home/sapint/

The first one I can open in Filezilla, but the second one I can't, getting the following error:

Response: 550 Unable to find file /home/SAPINT/RTR_DEALER_DLR_JTDBCMFE0R3039774.json
Error: Critical file transfer error
I have edited the authorization without success.

How I can access?
If I go to WRKLNK and rename the file changing the name even though the same, it woks, I can open in Filezilla.

What makes different to the first one?
Coded character set ID is 1208 for both file.

Any help is appreciated.

Thank you,

Jorge Rengel

Re: YAJL_SAVEBUF Question

Posted: Wed Nov 13, 2024 10:57 pm
by Scott Klement
How is S_Dest defined?

If S_Dest is a fixed-length character variable, you'll need to add %TRIM() to the call to YAJL_SAVEBUF. (However, I never recommend using fixed-length character variables for IFS pathnames.)

If you look in the IFS, does the /home/SAPINT/RTR_DEALER_DLR_JTDBCMFE0R3039774.json file exist? Are there any extra blanks in the filename, or other unexpected characters?

Re: YAJL_SAVEBUF Question

Posted: Thu Nov 14, 2024 12:01 am
by jlrengel
Hi Scott,

S_Dest is defined as you can see below
Dcl-S S_Dest Char(70) Inz;

RTR_DEALER_DLR_JTDBCMFE0R3039774.json exists in /home/SAPINT. No extra blanks in the filename and no other unexpected character.

Thanks,

Jorge Rengel

Re: YAJL_SAVEBUF Question

Posted: Thu Nov 14, 2024 12:52 am
by thomprl
Like Scott said you will probably need to trim the string or change it to VARYING. If it's CHAR(70) and only 10 character in the path name it will think it's 60 blank spaces at the end.

Re: YAJL_SAVEBUF Question

Posted: Thu Nov 14, 2024 1:12 am
by Scott Klement

Code: Select all

YAJL_SAVEBUF(%TRIM(S_DEST) : S_ERRMSG); 

Re: YAJL_SAVEBUF Question

Posted: Fri Dec 13, 2024 8:48 pm
by jlrengel
Hi Scott, thomprl

Thanks for your answers. Sorry for the delay to update you guys.

I did on the same day (Nov/13) the changes as you can see below and everything worked well. We are able to open the JSON files in the IFS location.

Dcl-S S_Dest VarChar(70) Inz;
YAJL_SAVEBUF(%TRIM(S_DEST) : S_ERRMSG);

Regards,

Jorge Rengel