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



Jon,

SQL is at least "as easy" as RPG. Using RPG or SQL, in both cases you need
to translate the hierarchical form into a relational form (which is the
hardest part!).
IMHO it is even more complex to replicate the XML document with multiple
nested data structures at least if you define them with LIKEDS.
In SQL you only need to decide on which level you'll start and then how to
move up and down (with the XPATH notation) to get the information you want.
Contrary to RPG you can exactly filter what you need.

I use both methods, but I prefer the SQL version.
And according to my experiences within my classes where I teach both
methods, most of my attendees prefer the SQL version, too.

... but I do not want to start a discussion about consuming XML with RPG #
SQL-.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
?Train people well enough so they can leave, treat them well enough so they
don't want to.? (Richard Branson)


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Dienstag, 5. Dezember 2017 01:43
To: Rpg400 Rpg400-L <rpg400-l@xxxxxxxxxxxx>
Subject: Re: weather and xml

Now code an example that shows the SQL processing for the OP's XML - the SQL
is OK for simple(fish) stuff but I found it becomes a nightmare very
quickly.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Dec 4, 2017, at 3:56 PM, Bryan Dietz <bdietz400@xxxxxxxxx> wrote:

Not to dissuade you from using RPG to decompose XML, why not just use SQL.

I use this example:

SELECT *
FROM Xmltable('$result/rss/channel/item' Passing XMLPARSE(Document
Systools.Httpgetblob('http://www.redbooks.ibm.com/rss/power.xml',''))
AS "result"
Columns
Title VARCHAR(128) PATH 'title'
,Description VARCHAR(1024) PATH 'description'
,LINK VARCHAR(255) PATH 'link'
,Pubdate VARCHAR(20) PATH 'substring(pubDate, 1, 16)')
AS RESULT ;


Bryan




Smith, Mike wrote on 12/4/2017 3:06 PM:
I'm working on a program that retrieve weather 'FORECAST' from
WUNDERGROUND.COM I think I have finally worked out the layout of the
datastructures, but now I'm getting
RNF0376
Total length 46856810 of data item SFORECA... exceeds
16,773,104 bytes.
The XML file is really not all that big. I have a significally larger
XML that I am using for another process with no issue. My weather xml file
is 10343 bytes my other xml file is 10210510 bytes
I'm not really sure how to go about resolving this issue.
Below is the declarations.
dcl-ds response Qualified;
version char(5);
termsofservice char(55);
features LikeDS(features_T);
forecast LikeDS(forecast_T);
end-ds response ;
dcl-ds features_T Template Qualified;
feature char(50);
end-ds;
dcl-ds forecast_T Template Qualified ;
txt_forecast LikeDS(txt_forecast_T);
simpleforecast LikeDS(simpleforecast_T);
end-ds;
dcl-ds txt_forecast_T Template Qualified;
date char(50);
forecastdays LikeDS(forecastdays_T);
end-ds;
dcl-ds forecastdays_T Template Qualified;
countforecast int(10);
forecastday Dim(32767) LikeDS(forecastday_T);
end-ds ;
dcl-ds forecastday_T Template Qualified;
period char(5);
icon char(5);
icon_url char(50);
title char(50);
fcttext char(50);
fcttext_metric LikeDS(fcttext_metric_T);
pop char(5);
end-ds ;
dcl-ds fcttext_metric_T Template Qualified;
#cdata_section char(50);
end-ds ;
dcl-ds simpleforecast_T Template Qualified;
forecastdays LikeDS(Sforecastdays_T);
end-ds;
dcl-ds Sforecastdays_T Template Qualified;
countSforecast int(10);
Sforecastday Dim(32767) LikeDS(Sforecastday_T);
end-ds ;
dcl-ds Sforecastday_T Template Qualified;
date char(50);
period char(5);
shigh LikeDS(high_T) ;
slow LikeDS(low_T) ;
conditions char(50);
icon char(5);
icon_url char(50);
skyicon char(50);
pop char(5);
gpf_allday LikeDS(gpf_allday_T);
gpf_day LikeDS(gpf_day_T) ;
gpf_night LikeDS(gpf_night_T) ;
snow_allday LikeDS(snow_allday_T) ;
snow_day LikeDS(snow_day_T) ;
snow_night LikeDS(snow_night_T) ;
maxwind LikeDS(maxwind_T) ;
avewind LikeDS(avewind_T) ;
avehumidity char(5);
maxhumidity char(5);
minhumidity char(5);
end-ds ;
dcl-ds high_T Template Qualified;
fahrenheit char(50);
celsius char(50);
end-ds ;
dcl-ds low_T Template Qualified;
fahrenheit char(50);
celsius char(50);
end-ds ;
dcl-ds gpf_allday_T Template Qualified;
ins char(50);
outs char(50);
end-ds ;
dcl-ds gpf_day_T Template Qualified;
ins char(50);
outs char(50);
end-ds ;
dcl-ds gpf_night_T Template Qualified;
ins char(50);
outs char(50);
end-ds ;
dcl-ds snow_allday_T Template Qualified;
ins char(50);
outs char(50);
end-ds ;
dcl-ds snow_day_T Template Qualified;
ins char(50);
outs char(50);
end-ds ;
dcl-ds snow_night_T Template Qualified;
ins char(50);
outs char(50);
end-ds ;
dcl-ds maxwind_T Template Qualified;
mph char(50);
kph char(50);
dir char(50);
degrees char(50);
end-ds ;
dcl-ds avewind_T Template Qualified;
mph char(50);
kph char(50);
dir char(50);
degrees char(50);
end-ds ;
NOTICE: This message, including any attachment, is intended as a
confidential and privileged communication. If you have received this message
in error, or are not the named recipient(s), please immediately notify the
sender and delete this message.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx 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: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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:
http://amzn.to/2dEadiD


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.