First, I'm not sure why you have chosen PLT as your lock word. It's very 
important the lock word resolve to the same REAL address no matter where the 
PLO executes. Since you are talking about multiple operations against the same 
chain, unless all the processes exist in the same shared program you can't be 
sure the same lock word is always used. The lock word contents are not altered 
just used to create a lock value(PLT) for serialization. From your code, I 
would chose CSAMSEGF.

 Second, you can't mix the CDS with PLO and expect consistent results. It would 
be very easy to convert the CDS to a PLO Compare Double and Swap (compare each 
full word and swap). Just be sure to use the same lock word which I still 
suggest as CSAMSEGF.

Third, you're going to have to use a count. And since you are acquiring and 
releasing this storage, you REALLY have to use a counter. Just add a full word 
counter in CSA. In this case, I would choose the counter as the lock word. As 
long as you have a full word counter and recovery to treat a 0c4 as a re-drive 
(see my prior comments), this should work. I don't know if you can, but the 
choice of another methodology where storage is not acquired for each add and 
released for each delete would be recommended. However, you can make this work 
but not without a counter. 

Last, Peter's comment is very valid. Read the notes in CDS in the POM. I don't 
know why PLO doesn't reference them since they are just as applicable to PLO.

 I have not closely examined your logic so I don't know what the logic problem 
is in the code. I'm just commenting on the methodology.

Kenneth

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Donald Likens
Sent: Friday, November 08, 2013 10:22 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Serialization without Enque

Thank You for your help (all of you) but Peter's statement below does not make 
sense to me (maybe because I don't understand something).

The reason that the free queue protocol needs a sequence number is because even 
if the header "matches", the values that you need to put into your new element 
for the "next" and/or "previous" may no longer be correct due to a set of 
additional asynchronous operations.

I use PLO to add an element to a chain. The chain only has forward pointers. I 
always add to the end of the chain. I use storage (not CPOOL) to get the 
element. It turns out that I haven't gotten the PLO instruction to work 
properly yet but in theory in my scenario it seem to me that if the pointer to 
the last element is pointing to a element (Not 0) I should be able to store the 
next pointer and the last pointer in one PLO CSDST. Here is the actual (not 
working code... It is not updating the chain properly):

CSAMSEGL <== Last element on the chain
CSAMSEGF <== First element on the chain
R8 Address of element to add.
MSEGNEXT <== Pointer to next element in last control block MSEGCB <== element 
name

DOX078   DS    0H                                                     
*C     IF CSAMSEGL EQ 0 THEN    (no elements on the chain)                      
                
         XR    R4,R4                                                  
         XR    R5,R5                                                  
         LR    R2,R8    (R8: ADDRESS OF MSEGCB)                       
         LR    R3,R8                                                  
*C       SET CSAMSEGL = CSAMSEGF = MSEGCB JUST BUILT                  
         CDS   R4,R2,CSAMSEGF IF CSAMSEGF & CSAMSEGL = 0, STM 2,3,CSAMSEGF  
         BC    4,ELIFX076                                             
*C     ELSE                                                           
         B     EIFX076                                                
ELIFX076 DS    0H                                                     
*C IF CSAMSEGL = CSAMSEGL (R2)                         
*C   SET CSAMSEGL = POINTER_TO_NEW_MSEG (R8)           
*C   SET MSEGNEXT = POINTER_TO_NEW_MSEG (R8)           
CSDST    EQU   16                                      
         L      R2,CSAMSEGL  
         LA    R0,CSDST                                 
         LA    R1,PLT                                                           
 
         LR    R3,R8                                   
         LA    R4,CSAMSEGL   CSAMSEGL IS IN CSA        
         ST    R4,OPERAND6                             
         LA    R4,MSEGNEXT   MSEGNEXT IS IN CSA        
         ST    R4,OPERAND4                             
         ST    R8,OPERAND3                             
         ST    R8,OPERAND5                             
         PLO   R2,CSAMSEGL,0,PL                        
*  THE FIRST-OPERAND COMPARISON VALUE AND THE SECOND OPERAND ARE        
*  COMPARED.  IF THEY ARE EQUAL, THE FIRST-OPERAND REPLACEMENT VALUE    
*  IS STORED AT THE SECOND-OPERAND LOCATION, AND THE THIRD OPERAND IS   
*  STORED AT THE FOURTHOPERAND LOCATION. THEN, THE FIFTH OPERAND IS     
*  STORED AT THE SIXTH-OPERAND LOCATION.                                
         BNZ   DOX078   
EIFX076  DS    0H
  
PLT      DS    D        PLO LOCK TOKEN         
PL       DS    0F       PARAMETER LIST         
         ORG   PL+60                           
OPERAND3 DS    A        NEW MSEG ADDRESS       
         ORG   PL+76                           
OPERAND4 DS    A        ADDRESS OF CSAMSEGL    
         ORG   PL+92                           
OPERAND5 DS    A        NEW MSEG ADDRESS       
         ORG   PL+108                          
OPERAND6 DS    A        ADDRESS OF MSEGNEXT                                     
                                        

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to