× 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: DATA-INTO error using YAJLINTO
  • From: mlazarus <mlazarus@xxxxxxxxxxxx>
  • Date: Thu, 31 Jan 2019 16:31:26 -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:subject:to:mime-version:user-agent:from :date:message-id; bh=RG/PuR+l7mIuIXA/ExcIKmG3Qp0RURIC6JMPC4qdZFg=; b=g5u19gylvdGEI8c+h5bcDDHTG/jWg7MQ6Kifjkq8zsHNrHsM+2HyyH1MS8fipQTJ6J HU3qDzT+fxGeYo4PNaPErnEdiqDZyfTYXLPQFf57m3QxNyba0hH9ukhxXzKXtncPMwXv mS5byhL4NZT+jA8ObBzZ/pbZjvTCp37zo3ZVgDOyXKdSbNFf2up+hFO7gbjGuUmXrKjc 9mVq2rdMesopvlkDYFIJKyvnNmwfsghE6sUXzwrgAJG6fBsg7vgZKbNy4nBTA+tOYR33 +Y7UpbxM7ytp+9C+1QgMdO6S18C+zsyVgGtL10+/hQBmotgc4D4L3OOVQmOnUUitBfCa qCKQ==
  • Arc-seal: i=1; a=rsa-sha256; t=1548970285; cv=none; d=google.com; s=arc-20160816; b=alWWweYaJYcETxrtqKEINeHK1KjFrv2lPI+2QI8Lh8szdb9QShMhmObLZ5/KYZ78yy SanG01obtcQDFLoir0zpgYV8Yt6juQZYUqR9UY2AVQez2dEgBVw8MpZeBByY6Y9HkJhI 1L5nTRKAAY6sLkKk8nD6oGLfBlJUPit3uYMHgnxfMTyx+CJECcGvUFfBIJOYUb8KxEPg sSwFZf1vSmxb2ZNWTsCEh9xfWEQWcU1hPmOxMmZsvT9hD35wSV7v29RQ5ZPKtVJCY3b1 FDQ7lqUeRYWYaUZ5tbt5zR2DBLFrFPjLDe4oC7JKyxHF5p8rudvNp/91aa7OXOsZkIRU vw1g==
  • 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>

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

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.