Birgitta,
Somehow I knew it would be you to respond! And I appreciate the response!
CLOB_2M is used to define something to use in the LIKE() in the prototype. It isn't actually used for anything else in the program. The definition of the CLOB in the prototype using the LIKE(CLOB_2M) does not have that breakdown into the DS...which I found odd.
More testing showed that the CLOB value has data when calling the program directly, but when the SQL Stored Proc is used to call the program, the CLOB loses its data. I've tried casting the XML string as CLOB(2m) in the call with no luck.
Today, further investigation regarding CCSID.
Steve Needles
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Birgitta Hauser
Sent: Friday, June 09, 2017 12:07 AM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxx>
Subject: RE: testing CLOBs via iNav
Did you try to access the CLOB variable, i.e. CLOB2M directly in your RPG Program, or the CLOB2M_DATA subfield?
The SQL Precompiler converts the CLOB variables into a data structure consting of 2 Subfields (in your case CLOB2M_LEN Uns(10) and CLOB2M_DATA Char(YourClobLen)).
Try to use the CLOB2M_DATA subfield in your XML-Statement (RNX0351 is an RPG Error).
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: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Steve Needles
Sent: Donnerstag, 8. Juni 2017 20:06
To: midrange-l@xxxxxxxxxxxx
Subject: testing CLOBs via iNav
I am testing an SQL SP that will pass a CLOB CCSID 37 to an RPGLE program.
No matter what I try in formatting the SQL call within iNav, the CLOB variable has no data (as shown by iNav's debugger). The CLOB contains XML, so the parser throws an error (351, reason 302) that indicates that the needed '<' is missing. And the LEN portion of the variable is updated to the correct length of the XML.
I've tried both of these variations of the call with no luck:
call sjneedl.sngetquote('1234567','', 'OR','', '1000000000', '<itemlist> <item><itemid>1111111</itemid><quantity>1</quantity><altitem>0</altitem><car
rierservicelevel></carrierservicelevel></item>
<item><itemid>2222222</itemid><quantity>1</quantity><altitem>0</altitem><car
rierservicelevel></carrierservicelevel></item>
</itemlist>');
And
call sjneedl.sngetquote('1234567','', 'OR','', '1000000000', cast('<itemlist> <item><itemid>1111111</itemid><quantity>1</quantity><altitem>0</altitem><car
rierservicelevel></carrierservicelevel></item>
<item><itemid>2222222</itemid><quantity>1</quantity><altitem>0</altitem><car
rierservicelevel></carrierservicelevel></item>
</itemlist>' as clob(2m)));
This is the message I see:
Message ID . . . . . . : RNX0351 Severity . . . . . . . : 50
Message type . . . . . : Escape
Date sent . . . . . . : 06/08/17 Time sent . . . . . . : 11:58:11
Message . . . . : The XML parser detected error code 302.
Cause . . . . . : While parsing an XML document for an RPG procedure, the
parser detected an error at offset 0 with reason code 302. The actual
document is *N; *N indicates that the XML document was not an external file.
Recovery . . . : Contact the person responsible for program maintenance
to
determine the cause of the problem.
changing from a CLOB to a VARCHAR(30000) gets some of the data into the program, but I need all of the CLOB, not just the first 30,000 bytes.
CREATE or replace PROCEDURE SJNEEDL.SNGETQUOTE (
IN PARM1 CHAR(12) ,
IN PARM2 CHAR(6) ,
IN PARM4 CHAR(2) ,
IN PARM4 CHAR(3) ,
IN PARM5 CHAR(10) ,
IN PARMCLOB
--CLOB(2097152) or
varchar(30000)
ccsid 37 )
.
.
.
IF SUBSTR ( PARM5 , 1 , 1 ) = '1' THEN CALL SJNEEDL . SN641R ( PARM1 , PARM2 , PARM4 , PARM4 , PARM5 , PARM6, PARMCLOB ) ; END IF ; .
.
.
RPG defns
D sn641R pr ExtPgm( 'SN641R' )
D #PARM1_...
D Like( #PARM1 )
D #PARM2_...
D Like( #PARM2 )
D #PARM3_...
D Like( #PARM3 )
D #PARM4_...
D Like( #PARM4 )
D #PARM5_...
D Like( #PARM5 )
D #PARM6_...
D Like( #PARM6 )
d #PARMCLOB_ like( CLOB_2M )
D SN641R pi
D #PARM1...
D 12a
D #PARM2...
D 6a
D #PARM3...
D 2a
D #PARM4...
D 3a
D #PARM5...
D 10a
D #PARM6...
D 1a
d #PARMCLOB like( CLOB_2M )
.
.
.
d CLOB_2M s SQLtype(CLOB:2097152)
Steve Needles
CONFIDENTIAL: The information contained in this email communication is confidential information intended only for the use of the addressee.
Unauthorized use, disclosure or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by return email and destroy all copies of this communication, including all attachments.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-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 Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-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
CONFIDENTIAL: The information contained in this email communication is confidential information intended only for the use of the addressee. Unauthorized use, disclosure or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by return email and destroy all copies of this communication, including all attachments.
As an Amazon Associate we earn from qualifying purchases.