× 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.


  • Subject: Re: DATA-INTO error using YAJLINTO
  • From: mlazarus <mlazarus@xxxxxxxxxxxx>
  • Date: Thu, 31 Jan 2019 19:21:50 -0500
  • Arc-authentication-results: i=1; mx.google.com; spf=pass (google.com: domain of mlazarus@xxxxxxxxxxxx designates 216.222.148.102 as permitted sender) smtp.mailfrom=mlazarus@xxxxxxxxxxxx
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:subject:to :mime-version:user-agent:from:date:message-id; bh=IhanDN+N4IjWyfTm3n0DUfR5xFWeSTNFiGEHAb3+9kw=; b=KmwwHllUM73MQMLVQY2uQb1ZjSDjfD6UoSyuWLcNCcjp6nZDw74W5o/j2K79m6X0I7 Wn5vdjLJ6g3XB/2IkMZQfe7nprya1FieiPx5yy+R6P7iRbJ+RQTxA9c0Tcbb/kTTeplf piqv9jpDI8K3xs74C6ojwpiq3idG4FGqInNS0CSYRrya8+JY1x7cbdhGbc1eD20tcRqM 9F7Dt2AtCxBb0H5Xbek6ERlC6ms3syforMuVoR63Cg+4lH2BgkMBBVcpIwtBd+DZOGzE +rlRjxqLQSkTtf/gZxFKIy41JEs1zPgtepEZ7CRA3A8wqJkgJO++Mi9czN+UtEPIGaRG ZDMQ==
  • Arc-seal: i=1; a=rsa-sha256; t=1548980509; cv=none; d=google.com; s=arc-20160816; b=ejo59LT0Dqmm+gEt+5eIAX/XQY0kLgBFg+JKbGdW1F36eNulKtheawTTgjdKoURIYK Gcr0mhTPYvG+8raTtaECI/VxkWRAgBTVN2JgiESUsis0DykYQbk8f0XVodGGofB7RozC py6t1FPrItuutTflYKqgST7YJTPVZbWbHWUGoHzAbEeNcPpeobSIkDlh7n5hOzdlSiKz Rgnpf2+raGHZdUAyiVyCmI2qhd1yRdb23VU8wnPhjbwZZQSOsMR/tjy1UJWHFrB4YOT5 vZbax7Xr9902vvNr3+SS44zreRBBFgk5yWQq8GlO0ZtABSX2pFGEEX1FdtyDxCY8Ju8P TjTw==
  • List-archive: <https://archive.midrange.com/rpg400-l/>
  • List-help: <mailto:rpg400-l-request@lists.midrange.com?subject=help>
  • List-id: "RPG programming on the IBM i \(AS/400 and iSeries\)" <rpg400-l.lists.midrange.com>
  • List-post: <mailto:rpg400-l@lists.midrange.com>
  • List-subscribe: <https://lists.midrange.com/mailman/listinfo/rpg400-l>, <mailto:rpg400-l-request@lists.midrange.com?subject=subscribe>
  • List-unsubscribe: <https://lists.midrange.com/mailman/options/rpg400-l>, <mailto:rpg400-l-request@lists.midrange.com?subject=unsubscribe>

Hi Don,

My string was missing the closing curly brace, which was why it didn't pass the lint filter. Data is an array.

-mark

On 1/31/2019 5:01 PM, Don Brown wrote:
Your json string is not valid.

Find a json validator and check your string. (Notepad++ has a plugin,
SoapUI or try this link https://jsonlint.com/

I changed you json to the following and then it validated but I am not
sure if you wanted an array for data ?

{
"Code": 400,
"Message": "Error",
"Data": "ConsigneeAddress.Zip Validation failed for property. "
}

Don Brown


"RPG400-L"<rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 01/02/2019
07:31:26 AM:

From: "mlazarus"<mlazarus@xxxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"<rpg400-
l@xxxxxxxxxxxx>
Date: 01/02/2019 07:32 AM
Subject: DATA-INTO error using YAJLINTO
Sent by: "RPG400-L"<rpg400-l-bounces@xxxxxxxxxxxxxxxxxx>

I'm trying to use DATA-INTO using YAJLINTO. It's based on one of
Scott's examples.
(https://www.common.org/scotts-iland-blog/parsing-json-data-into/).

This is the test code:

dcl-s json varchar(5000) Inz(
'{"Code":400,"Message":"Error","Data":["ConsigneeAddress.Zip -+
Validation failed for property."]' ) ;

dcl-s Msg varchar( 47 ) ;
dcl-s x int( 10 );

dcl-ds MyData qualified;
Code varchar( 5 ) ;
Message varchar( 50 ) ;
num_Data int( 10 ) ;

dcl-ds Data dim( 50 ) ;
*N char( 50 ) ;
end-ds;
end-ds;

data-into MyData %DATA( json: 'case=any countprefix=num_ +
allowextra=yes' )
%PARSER( 'YAJLINTO' );

Msg = MyData.Message ;
dsply ( 'Code: ' + MyData.Code ) ;
dsply ( 'Msg: ' + Msg ) ;
dsply ( 'Num: ' + %EditC( MyData.num_Data:'1' ) ) ;
for x = 1 to MyData.num_Data ;
dsply MyData.Data( x ) ;
endfor;

*INLR = *On ;
___________

If I have allowextra=yes I receive RNX0356 The document for the
DATA-INTO operation does not match the RPG variable; reason code 15.

Cause . . . . . : While parsing a document for the DATA-INTO
operation, the
parser found that the document does not correspond to RPG variable
"mydata"
and the options do not allow for this. The reason code is 15. The
exact
subfield for which the error was detected is "mydata". The options
are
"case=any countprefix=num_ allowextra=yes". The document name is *N;
*N
indicates that the document is not an external file. The parser is
'YAJLINTO'. *N indicates that the parser is a procedure pointer.

Reason code 15: A call to QrnDiStartArray was made, but the matching RPG
variable or
subfield is not an array.

___________

Without allowextra=yes it points to reason code 5, which is:
The document contains extra names that do not match subfields.
___________

Is this because the Data array is not named? If yes, is there a way
around this?

-mark
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://amazon.midrange.com

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud
service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

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.