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



Charles

You are quite right, there was no need for me to change the JNI_GetCreatedJavaVMs() parms ...you guessed it, lazy thinking on my part ... so I have changed the program back to use /Copy qsysinc/qrpglesrc,jni

I have also changed the return parameters of JDBC_getCol() and r() to 16000000 from 32767 as suggested and I am now getting 123832 bytes of well formed xml data.

I suspect my thinking about the MS SQL JDBCR4 driver being incompatible with the JNI PR definitions was also incorrect.


Thanks again for your help.
Andy


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: 09 April 2013 18:30
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: 32767 limit

I don't see any reason for changing the JNI_GetCreatedJavaVMs() parms...

*JNI_GetCreatedJavaVMs*

Returns information about all Java virtual machines that were created. Even though this API is designed to return information for multiple Java virtual machines (JVMs), only one JVM can exist for a process. Therefore, this API will return a maximum of one JVM.

Signature:

jint JNI_GetCreatedJavaVMs(JavaVM **vmBuf,
jsize bufLen,
jsize *nVMs);

vmBuf is an output area whose size is determined by bufLen, which is the number of pointers. Each Java virtual machine has an associated JavaVM structure that is defined in java.h. This API stores a pointer to the JavaVM structure that is associated with each created Java virtual machine into vmBuf, unless vmBuf is 0. Pointers to JavaVM structures are stored in the order of the corresponding Java virtual machines that are created. nVMs returns the number of virtual machines that are currently created. Your server supports the creation of more than one Java virtual machine, so you may expect a value higher than one. This information, along with the size of the vmBuf, determines whether pointers to JavaVM structures for each created Java virtual machine are returned.


This has nothing to with what size parms are returned by the getColString()


Did you just see the 32767 "magic number" and decide to up it?


Besides changing the size of the results variable, you'll need a new r() PR that handles a larger string

D r pr 32767A varying

D extproc(*JAVA:

D 'java.lang.String':

D 'getBytes')

HTH,
Charles





On Tue, Apr 9, 2013 at 12:29 PM, Andy Thompson <Andy.Thompson@xxxxxxxxxxxxxx
wrote:

I've managed to pass 1Mb of XML into RPG but not 16Mb.


I have taken a copy of QSYSINC/QRPGLESRC(JNI) and changed it slightly ...
D JNI_GetCreatedJavaVMs...
D PR LIKE(jint)
D EXTPROC(*CWIDEN:
D
'JNI_GetCreatedJavaVMs')
D*********** javaVM * DIM(32767)
OPTIONS(*VARSIZE)
D javaVM * DIM(1000000)
OPTIONS(*VARSIZE)
D arraySize VALUE LIKE(jsize)
D numVms LIKE(jsize)

If I make the DIM bigger than 1000000 (say 16000000 )I get a compile
error ...
*RNF0376 30 Total length 256000000 of data item exceeds 16,773,104
Presumably this is the upper limit for the sum of the parameters passed ?

Thanks for your help everyone .... what a great forum !

-----Original Message-----
From: Andy Thompson
Sent: 09 April 2013 15:33
To: 'RPG programming on the IBM i (AS/400 and iSeries)'
Subject: RE: 32767 limit

Charles

I've just tried changing the return value from JDBC_GetCol() to
16Mb (my IDE was telling me that 65535 was the limit .. shows how old
it is) but it saved and compiled ok. However it still only returns
32767 bytes of XML in the 16Mb field, which suggests that's all JDBC is returning.
(statement result = r(str); in the JDBC_getCol() procedure
listed below).
I downloaded the Microsoft JDBC Driver 4.0 for SQL Server last month,
so maybe it's a bit behind the iSeries JRE 1.6.0 I'm not sure where to
go from here ... but probably not a suitable post for an RPG forum ...
unless anybody knows ?

Andy



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Charles Wilt
Sent: 09 April 2013 14:58
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: 32767 limit

While wrappers are nice as the make things simpler; the price you pay
for simplicity is less flexibility and accepting new limits.

You're going to need to write your own JDBC_GetCol() using Scott's as
a guide that handles results bigger than 32K.

RPGLE at 6.1+ allows for ~16MB. You could basically copy the existing
proc change the size of the return value and result variable and call
it
JDBC_GetCol16MB()
or something. Be sure to pass your changes back to scott and he can
possibly incorporate them into the distribution. To make it easier,
you should probably wrap your new proc and prototype in an /IF DEFINED(*V6R1M0).

If that's not enough, you'd probably need to look at taking advantage
of teraspace.

Charles


On Tue, Apr 9, 2013 at 7:55 AM, Andy Thompson
<Andy.Thompson@xxxxxxxxxxxxxx>wrote:

I want to receive the contents of an XML variable whose content
exceeds
32767 bytes into an RPGLE program parse it and do some updates. The
XML could potentially be 500k to 2GB. This is stored as an XML
type field on an MSSQL table.

So .. I tried using JDBC in and RPGLE program using JNI. My
attempt
as shown below.
The program works fine when the content is less than 32767 but fails
on the XML-INTO when its bigger (RNX0353 reason 5)

Can anyone point me in the right direction ?

I should add we are running V7R1.

regards
Andy Thompson


D idata s sqltype(XML_DBCLOB:65535)

RS = JDBC_ExecPrepQry(PrepStm) ;
DoW (JDBC_NextRow(RS)) ;
iData = jdbc_getCol(RS : 1) ;
.
options = 'doc=string path=BOM/BO/OPOR/row ' +
'allowmissing=yes allowextra=yes case=any ns=remove';
xml-into rowOPOR %XML(%trim(iData) : options);
*** it Fails here because it truncates the XML at 32767 bytes ***
.

* Copyright (c) 2006-2008 Scott C. Klement
* All rights reserved.
P JDBC_GetCol B export
D JDBC_GetCol PI 32767A varying
D rs like(ResultSet)
D col 10I 0 value
D nullInd 1N options(*nopass:*omit)
D result s 32767A varying
D str s like(jstring)
D null s 1N inz(*OFF)
/free
jdbc_begin_object_group(5);
monitor;
str = getColString(rs: col);
if (str = *NULL);
result = '';
null = *ON;
else;
result = r(str);
endif;
on-error;
null = *ON;
result = '';
endmon;
jdbc_end_object_group();
if (%parms >= 3 and %addr(nullInd)<>*NULL);
nullInd = Null;
endif;
return result;
/end-free
P E



CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from
disclosure under law. If you are not the intended recipient(s)
please note that any form of distribution, copying or use of this
communication or the information in it is strictly prohibited and
may be unlawful. If you received this in error, please contact the
sender
and delete the material from any computer.

We have taken precautions to minimise the risk of transmitting
software viruses, however, you need to carry out your own virus
checks on any attachments as we can take no responsibility for any
computer virus transferred by way of this email.

All views or opinions expressed will be those of the author and not
necessarily those of Harry Yearsley Ltd.

Harry Yearsley Ltd, Registered 556895, Registered Office : Yearsley
Group, Hareshill Road, Heywood, Lancs., OL10 2TP

Business is conducted as under our Terms and Conditions available on
request
--
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: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at http://archive.midrange.com/rpg400-l.


--
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: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from
disclosure under law. If you are not the intended recipient(s) please
note that any form of distribution, copying or use of this
communication or the information in it is strictly prohibited and may
be unlawful. If you received this in error, please contact the sender and delete the material from any computer.

We have taken precautions to minimise the risk of transmitting
software viruses, however, you need to carry out your own virus checks
on any attachments as we can take no responsibility for any computer
virus transferred by way of this email.

All views or opinions expressed will be those of the author and not
necessarily those of Harry Yearsley Ltd.

Harry Yearsley Ltd, Registered 556895, Registered Office : Yearsley
Group, Hareshill Road, Heywood, Lancs., OL10 2TP

Business is conducted as under our Terms and Conditions available on
request
--
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: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.


--
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: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.

CONFIDENTIALITY NOTICE: This message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under law. If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you received this in error, please contact the sender and delete the material from any computer.

We have taken precautions to minimise the risk of transmitting software viruses, however, you need to carry out your own virus checks on any attachments as we can take no responsibility for any computer virus transferred by way of this email.

All views or opinions expressed will be those of the author and not necessarily those of Harry Yearsley Ltd.

Harry Yearsley Ltd, Registered 556895, Registered Office : Yearsley Group, Hareshill Road, Heywood, Lancs., OL10 2TP

Business is conducted as under our Terms and Conditions available on request

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.