YAJL_SAVEBUF Question

Discussions relating to the ScottKlement.com port of the open source YAJL JSON Reader/Generator. This includes the YAJL tool as well as the YAJLR4, YAJLGEN, YAJLINTO and YAJLDTAGEN add-ons from ScottKlement.com. http://www.scottklement.com/yajl/
Post Reply
jlrengel
Posts: 3
Joined: Tue Jun 28, 2022 6:20 pm

YAJL_SAVEBUF Question

Post 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
Scott Klement
Site Admin
Posts: 872
Joined: Sun Jul 04, 2021 5:12 am

Re: YAJL_SAVEBUF Question

Post 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?
jlrengel
Posts: 3
Joined: Tue Jun 28, 2022 6:20 pm

Re: YAJL_SAVEBUF Question

Post 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
thomprl
Posts: 6
Joined: Tue Oct 01, 2024 5:29 pm

Re: YAJL_SAVEBUF Question

Post 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.
Scott Klement
Site Admin
Posts: 872
Joined: Sun Jul 04, 2021 5:12 am

Re: YAJL_SAVEBUF Question

Post by Scott Klement »

Code: Select all

YAJL_SAVEBUF(%TRIM(S_DEST) : S_ERRMSG); 
jlrengel
Posts: 3
Joined: Tue Jun 28, 2022 6:20 pm

Re: YAJL_SAVEBUF Question

Post 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
Post Reply