× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,

The characters at the beginning of the data are your headers. For some reason you are asking YAJL for the JSON data in UTF-8, but you are passing the headers as EBCDIC.  If you view the data as EBCDIC, the headers would be readable and the JSON would not. But, since you are viewing it in UTF-8, the JSON is readable and the headers are not.  Depending on your Apache setup this might not be a problem.

The extra characters at the end of your code is a different matter, however.

The prototype for JSON01R doesn't match the PI in the calling program.  The prototype in the calling program uses a VARCHAR parameter, but JSON01R is defined with a fixed-length 1000A parameter.

Also, you're using OPTIONS(*VARSIZE), but you are not doing so safely.  Your code is attempting to use the entire string rather than just the part that is passed.   When you do options(*Varsize) the caller does not have to pass the entire string -- but the %LEN() BIF doesn't know that, and so when you do %LEN() it's giving you 1000, since the parameter is 1000A, which is always 1000 chars long.  So you will get whatever happens to be in memory after the headers and/or JSON document since you are not handling this correctly.

I don't understand why JSON01R is split into a separate program. This seems to simply make things more complicated and confusing, and does not offer any sort of value that I can see vs. simply calling QtmhWrStout directly.

As you and Brad already noted, you can use yajl_writeStdout() that is meant to be simpler than coding it yourself. But coding it yourself would also work fine if you wanted to do it that way. The only reason it is not is because you have these bugs in your code.


On 8/27/2019 5:02 AM, Cabero wrote:
Hello.

I would appreciate input as I can't get rid of the first two lines and
the third has the { right at the end. Here is the code -
https://ibmrestapis.blogspot.com/p/blog-page_26.html

Ã-*£…*£`£¨--…z@----"‰ƒ£‰-*a'¢-*^@ƒˆ(tm)¢…£~¤£†`ø
%
% {
"success": true,
"errmsg": "",
"count": 2,
"item": [
{
"CompanyCode": 200,
"BranchCode": 222,
"SLATime": 22,
"SLAPrewarnTime": 33,
"SendEmail": "N",
"SendSMS": "N",
"RecordStatus": "D"
},
{
"CompanyCode": 300,
"BranchCode": 20,
"SLATime": 2,
"SLAPrewarnTime": 3,
"SendEmail": "Y",
"SendSMS": "Y",
"RecordStatus": ""
}
]
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Yours sincerely.
Esteban Cabero
www.linkedin.com/in/cabero

Cell: +27(0)843963122

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.