View previous topic :: View next topic |
Author |
Message |
user5 Beginner
Joined: 29 Dec 2006 Posts: 9 Topics: 4
|
Posted: Sat Jan 20, 2007 7:25 am Post subject: Is there any LIMIT to the # of bytes we STRING |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Sat Jan 20, 2007 11:54 am Post subject: |
|
|
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
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 |
|
 |
user5 Beginner
Joined: 29 Dec 2006 Posts: 9 Topics: 4
|
Posted: Mon Jan 22, 2007 4:47 am Post subject: |
|
|
Thanks you very much Kolusu.
It worked   |
|
Back to top |
|
 |
|
|