MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing CLOB from Cobol to Native SP

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
ed.sam13
Beginner


Joined: 09 Aug 2010
Posts: 31
Topics: 11

PostPosted: Fri Oct 16, 2015 5:36 pm    Post subject: Passing CLOB from Cobol to Native SP Reply with quote

I am passing a CLOB from a Cobol program to a native Stored Procedure.

This is my SP input variable declarationion.
Code:
01  SP-IN-BATCH        USAGE IS SQL TYPE IS CLOB(3000000).


I accumulate values into the following array and then move this value to the CLOB. The number of values to accumulate is determined by a variable WS-LIMIT which I am getting from Linkage section.
Code:
       01  WS-IN-BATCH-DTLS.
           10 WS-IN-BATCH                  OCCURS 500 TIMES.
              20 WS-IN-RECORD              PIC X(3000)     VALUE SPACES.
          
           MOVE WS-IN-BATCH-DTLS          TO SP-IN-BATCH-DATA
           COMPUTE SP-IN-BATCH-LENGTH = 3000 * WS-LIMIT

           EXEC SQL
                CALL SP_NAME      (:SP-IN-BATCH

When WS-LIMIT is 349, everything is good. But when I change it to 350 it gives me SQLCODE -433.
Can someone help?
Back to top
View user's profile Send private message
ed.sam13
Beginner


Joined: 09 Aug 2010
Posts: 31
Topics: 11

PostPosted: Fri Oct 16, 2015 5:41 pm    Post subject: Reply with quote

Actually it is good only until occurrence 348. When I populate 349th occurrence, the full CLOB is not getting to the SP. Its getting truncated.
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Sat Oct 17, 2015 3:44 am    Post subject: Reply with quote

And the definition of WS-LIMIT is?

Interesting that it is in the LINKAGE SECTION, from the prefix, but that's not part of the problem.
Back to top
View user's profile Send private message
ed.sam13
Beginner


Joined: 09 Aug 2010
Posts: 31
Topics: 11

PostPosted: Sun Oct 18, 2015 8:55 pm    Post subject: Reply with quote

The definition of WS-LIMIT is 9(04). I suspect that there is a 1MB limit set somewhere which is causing this issue. When it is 3000*349 it crosses the 1MB limit. I tried increasing the REGION parameter but of no help.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Sun Oct 18, 2015 9:39 pm    Post subject: Reply with quote

ed.sam13 wrote:
The definition of WS-LIMIT is 9(04). I suspect that there is a 1MB limit set somewhere which is causing this issue. When it is 3000*349 it crosses the 1MB limit. I tried increasing the REGION parameter but of no help.


9(04) is zoned decimal and the maximum value it can hold is 9999. How do you plan to store 300*349 which 104700 into it? Unless you have defined the value as comp and depending on the compiler option you may still not be able to load that value.

If you have defined the value as COMP, then you need to know the compiler option TRUNC

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg50/2.4.56?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ed.sam13
Beginner


Joined: 09 Aug 2010
Posts: 31
Topics: 11

PostPosted: Sun Oct 18, 2015 9:48 pm    Post subject: Reply with quote

hi Kolusu, nope. WS-LIMIT just tells me how many occurrences of the array should be filled before calling the SP. The max value for WS-LIMIT could only be 500.

Ok so the logic in the program is as follows.
1) The size of each occurence of the array is 3000 bytes.
2) I get the value of WS-LIMIT from JCL and validate that the value is within 500. For example lets say I pass a value 400
3) So the program understands that 400 occurrences of the array should be passed to the SP.
4) So it populates 400 occurrences of WS-IN-BATCH in the code above.
5) Before calling the SP I move these 400 occurrences as a CLOB to the SP. To set the length of the CLOB I multiply 3000 * WS-LIMIT which in this case is 3000*400 = 1,200,0000 which is within the limits of a CLOB.

But the issue is when I pass WS-LIMIT as 400 I get SQLCODE -433. The call to the SP and the subsequent processing is good for WS-LIMIT until 348. For any value above 348 I am getting SQLCODE -433 while calling the SP.

I hope I explained it pretty well.
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Mon Oct 19, 2015 8:29 am    Post subject: Reply with quote

It may be within the limits of a CLOB, but is it within the limit of your CLOB. The default size if not specified is one megabyte. Too much of a coincidence. You need to specify your maximum length on the definition. CLOB max is 2GB, so you should be OK.
Back to top
View user's profile Send private message
ed.sam13
Beginner


Joined: 09 Aug 2010
Posts: 31
Topics: 11

PostPosted: Mon Oct 19, 2015 11:56 pm    Post subject: Reply with quote

Thanks. When I changed the definition of the field from CLOB to CLOB(3M) it worked
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group