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 

tsq maximum number of items
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware
View previous topic :: View next topic  
Author Message
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Sun Mar 08, 2009 8:39 am    Post subject: tsq maximum number of items Reply with quote

Hello,

I need to write a TSQ with 30000 items.

I
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Mar 08, 2009 12:44 pm    Post subject: Reply with quote

jctgf,

Please search before posting. Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=5104&highlight=trunc

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Sun Mar 08, 2009 1:47 pm    Post subject: Reply with quote

yes, i did. i searched a lot but it's not any easy finding anything in the forum.
Back to top
View user's profile Send private message Send e-mail
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Sun Mar 08, 2009 2:25 pm    Post subject: Reply with quote

I have a question, please.
It seems that the TRUNC option has some implications on the program performance.
It seems I can use COMP-5 for a specific data-item instead.
Is COMP-5 a standard COBOL II command, please?
Thanks.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Mar 08, 2009 3:11 pm    Post subject: Reply with quote

jctgf wrote:
It seems I can use COMP-5 for a specific data-item instead.
Is COMP-5 a standard COBOL II command, please?
Thanks.


VS COBOL II has been out of service for a long time. And Comp-5 is NOT supported by VS COBOL II

Look at the first line in your compile SYSPRINT listing. It will tell you the version of cobol you are using.

Just for the record The TRUNC(BIN) compiler option causes all binary data items (USAGE BINARY, COMP, COMP-4) to be handled as if they were declared with USAGE COMP-5.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Sun Mar 08, 2009 6:45 pm    Post subject: Reply with quote

thanks a lot!
Back to top
View user's profile Send private message Send e-mail
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Tue Mar 10, 2009 5:56 pm    Post subject: Reply with quote

hi kolusu,

i tried to use the comp-5 data-item but it didn't work. it seems that comp-5 is a 10 digit binary and it causes an error in the readq command.

then i did the following:

Code:


01 w-binary      pic s9(09) comp.
01 filler redefines w-binary.
     03  filler   pic xx.
     03  w-item-number   pic s9(04) comp.

move 32700 to w-binary
exec cics
        readq name(mytsq) item(w-item-number)
end-exec

and it worked!!

thanks.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Mar 10, 2009 6:25 pm    Post subject: Reply with quote

jctgf wrote:
and it worked!!thanks.


I would be shocked if that worked. Without Trun(BIN) compiler option no matter how you move/redefine your max value for w-item-number would only be 9999. Any number greater than would have the leftmost digit truncated. In the above case your w-item-number would contain 2700 instead of 32700.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Tue Mar 10, 2009 7:11 pm    Post subject: Reply with quote

hi!
i'm going to check my code again to see if i forgot the CBL TRUNC(BIN) parameter in it.
thanks!!
Back to top
View user's profile Send private message Send e-mail
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Wed Mar 11, 2009 6:09 pm    Post subject: Reply with quote

Hi there Kolusu,

I double checked my program and it really works.

I think that READQ/WRITEQ expects to receive a two-byte binary variable and, as long as this condition is satisfied, things will work OK.

Cobol COMP data-items, for some reason that I would like to know why, are limited to 4 digits but it doesn't change the actual size of the variable. It's still a two-byte binary field and is able to contain values from
-32768 to 32768.

If I do what I did, I kind of fool Cobol and force a value into the variable that is compatible, despite not being compatible with its Cobol picture.

When READQWRITEQ Cics command receives the variable, it contains a valid value and therefore it is processed correctly. Despite the PIC the variable has, it seems to be what matters to the Cics API.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Mar 11, 2009 6:27 pm    Post subject: Reply with quote

jctgf wrote:
Hi there Kolusu,

I double checked my program and it really works.

I think that READQ/WRITEQ expects to receive a two-byte binary variable and, as long as this condition is satisfied, things will work OK.


jctgf,

I am really shocked that it worked for you. When you say it works were you able to read/write an TSQ item > 9999 ? or did you read the truncated value item. Lets say you want to read item # 27998 , without TRUNC(BIN) or COMP-5 option you will be reading the item # 7998. The RESP code after the READ Q will be 00(Successful read) but you are actually reading a wrong item #.

Just for my sanity I wrote this simple piece of code to test my understanding and the displays DID prove that the left most digit getting truncated

Code:

IDENTIFICATION DIVISION.                             
PROGRAM-ID. MYTEST                                   
ENVIRONMENT DIVISION.                                 
DATA DIVISION.                                       
WORKING-STORAGE SECTION.                             
                                                     
01 W-BINARY              PIC S9(09) COMP.             
01 FILLER REDEFINES W-BINARY.                         
     03  FILLER          PIC XX.                     
     03  W-ITEM-NUMBER   PIC S9(04) COMP.             
PROCEDURE DIVISION.                                   
                                                     
     PERFORM VARYING W-BINARY FROM 1 BY 1             
       UNTIL W-BINARY > 32765                         
             DISPLAY 'W-ITEM-NUMBER : ' W-ITEM-NUMBER
     END-PERFORM                                     
                                                     
     GOBACK.                                         


Run the above program and check the display values after 9999.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Wed Mar 11, 2009 7:38 pm    Post subject: Reply with quote

hi,

i filled ws-two-byte not moving the value directly to it. i moved the value to ws-integer. things will only work this way.

Code:

01 ws-integer pic s9(09) comp.
01 filler redefines ws-integer.
   03 filler           pic xx.
   03 ws-two-byte pic s9(04) comp.


the display won't really show the left most digit because of the ws-two-byte picture, but the left most digit is there, preserved, i think, in the two-byte piece of memory.

it's just being truncated by the cobol picture, but its binary content is x'1000000000000000' or hex'8000'.

you also cannot attribute a value bigger than 9999 to ws-two-byte because of its picture. but you can fool cobol by moving the value to ws-integer.

that's how i did my test:

i executed my writeq command 10,005 times.

then i checked the ts queue with the CEBR command and there were 10,005 items written in it.

then i issued a writeq command WITH the "rewrite" option for the item 9998.

i checked my ts queue on CEBR and the change i did was there. the item 9998 had been changed.

i did the same to item 10001, 10003 and 10005 and the same happened. i could see the rewrite made in the items on CEBR.

i'll make another test tomorrow. i'll write a ts queue with 32768 items, will read and rewrite some items and will let you know the result.

i wonder if you could answer me an old question I've been keeping in my mind, please. why COMP data-items have a picture of 9(04) instead of 9(05), if the maximum possible value (32768) for a two-byte binary field is a 5 digit one?

thanks.
Back to top
View user's profile Send private message Send e-mail
RonB
Beginner


Joined: 02 Dec 2002
Posts: 93
Topics: 0
Location: Orlando, FL

PostPosted: Thu Mar 12, 2009 9:21 am    Post subject: Reply with quote

The reason why the use of WS-INTEGER works is because it can actually populate
the lower two bytes with a binary value that is larger than 4 decimal digits. The PICTURE clause does not come in to play when the field is specified on the EXEC CICS command because at execution time only the ADDRESS of the item is passed to the CICS service routines - and the PICTURE does not have any bearing on that because CICS assumes that the named item is a 2-byte binary item that CAN contain a value of up to 32767.

The reason that PIC 9(05) COMP generates a 4-byte binary rather than a 2-byte binary is because a 5 digit number greater than 32767 cannot be stored in a 2-byte binary.

FYI, If you coded W-ITEM-NUMBER as PIC s9(4) COMP-5, you COULD move a 5-digit number to it, as long as the number was less than 32768. According to the COBOL Reference Manual:

COMPUTATIONAL-5 or COMP-5 (native binary) These data items are represented in storage as binary data. The data items can contain values up to the capacity of the native binary representation (2, 4 or 8 bytes), rather than being limited to the value implied by the number of nines in the picture for the item (as is the case for USAGE BINARY data). When numeric data is moved or stored into a COMP-5 item, truncation occurs at the binary field size rather than at the COBOL picture size limit. When a COMP-5 item is referenced, the full binary field size is used in the operation.
_________________
A computer once beat me at chess, but it was no match for me at kick boxing.
Back to top
View user's profile Send private message
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Thu Mar 12, 2009 6:44 pm    Post subject: Reply with quote

that's what the "redefines" solution is all about.

however, i think there must be a more elegant solution.

it's hard to understand how cics has a feature (populate up to 32k items in a tsq) and the only way to actually use it is thru such a programming trick.

if i had used a regular approach i'd only be able to handle 9999 items.

as to the tests, i did it all again and it really works wonderfully.

i still wonder why cobol doesn't allow to fill a 2-byte binary with a value bigger that 9999.

could it be to prevent and exception in case the programmer moves a value between 32787 and 99999 to it?
Back to top
View user's profile Send private message Send e-mail
RonB
Beginner


Joined: 02 Dec 2002
Posts: 93
Topics: 0
Location: Orlando, FL

PostPosted: Fri Mar 13, 2009 10:45 am    Post subject: Reply with quote

jctgf wrote:
i still wonder why cobol doesn't allow to fill a 2-byte binary with a value bigger that 9999.

It does. You can put a value up to 32767 in a COBOL 2-byte binary field, either by coding it as PIC S9(4) COMP-5, or by coding it as PIC S9(4) COMP ( or BINARY ) and setting the Compiler Option to TRUNC(BIN).

jctgf wrote:
could it be to prevent and exception in case the programmer moves a value between 32787 and 99999 to it?

No exception will occur if you move a value greater than 32767 to a COBOL 2-byte binary field. However, the value will be truncated to it's last 4-decimal-digits if the COBOL 2-byte binary field is not defined as COMP-5 and TRUNC(BIN) is not in effect.
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 -> CICS and Middleware All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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