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 

Is there any LIMIT to the # of bytes we STRING

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
user5
Beginner


Joined: 29 Dec 2006
Posts: 9
Topics: 4

PostPosted: Sat Jan 20, 2007 7:25 am    Post subject: Is there any LIMIT to the # of bytes we STRING Reply with quote

Hi All,

I am creating a Dynamic sequel in my SP
One of the paramaters that the front end passes to the SP is the User Id string.
The # of user ids can be as high as 2800.
So the front end is passing a string which contains the user ids in quotes and are comma separated. The user id is 8 bytes long.
We are using a VARCHAR field size 31000.(WS-USER-ID-STR)

I have created a dynamic sql in my SP
in another varchar field (WS-DY-SQL size 1000).
This field consists of the SQL until the :
"WHERE USER_ID IN ( "

Then I am trying to STRING the WS-DY-SQL and the WS-USER-ID-STR
and the ' ) ' literal.

The SQL that is created after the string is PREPARED.
I am outputting the DYNAMIC sequel that is created in the SP.

If I pass the max # of user ids as input:
I notice that only the first 1000 bytes of data from the WS-USER-ID-STR are stinged and the ' ) ' literal is also not stringed.

If I pass comma separated user ids that occupy less than 1000 bytes as input:
Then the SQL is properly created and PREPARED successfully.

I also tried to split USER ID STRING into smaller strings of 1000 bytes each. Assuming that I cannot string a field of more than 1000 bytes.
But in that case also, it strings correcty for the same # of user ids.

I ahve checked the length of the VARIABLE into which I string all the fields.



Thanks & Regards,
Meghna
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sat Jan 20, 2007 11:54 am    Post subject: Reply with quote

user5,

cobol defnition for a varchar item consists of 2 fields , 1 contains the length and other contains the actual field.
ex:
Code:

01 WS-VAR.                           
   05 WS-LENGTH     PIC S9(04) COMP.       
   05 WS-ACT-FIELD  PIC X(31000) VALUE SPACES.


The compiler option TRUNC(opt) truncates the length to just 4 bytes. So it only takes the 1000 truncating the 3 infront.

So add the following line as the first line in your SP and you should not have any problem

Code:

CBL TRUNC(BIN)


Check this link for a detailed explanation of the TRUNC compiler option.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/2.4.52?DT=20020923143836

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
user5
Beginner


Joined: 29 Dec 2006
Posts: 9
Topics: 4

PostPosted: Mon Jan 22, 2007 4:47 am    Post subject: Reply with quote

Thanks you very much Kolusu.
It worked SmileSmile
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 -> Application Programming 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