Hmmm....  Have you (or anyone) actually verified that this works?  I just wrote 
the following programs:

 identification division.                              
 program-id.  callopt.                                 
 data division.                                        
 working-storage section.                              
 77  one                         pic x(4) value z'one'.
     call 'callee' using one
     goback.                
 end program callopt.       

 id division.                                     
 program-id. 'callee'.                            
 data division.                                   
 local-storage section.                           
 77  addr                        pointer.         
 77  addr-val redefines addr     pic s9(9) comp-5.
                                                 
 linkage section.                                 
 01  string-1                    pic x(101).      
 01  string-2                    pic x(101).      

 01  result                      pic s9(8) comp-5.  


 procedure division using string-1 string-2
                          returning result.         
      call 'print-string' using string-1      
      set addr to address of string-1         
      if  addr-val not less than zero         
          call 'print-string' using string-2. 
      move zero to result                     
      goback.                                 

When I run it, according to COBOL ADDR is set to x0F0960B8.  I am guessing that 
the high-order bit is in fact set, but that COBOL does not reveal that 
implementation detail to the COBOL application.

Either that or I am doing something wrong.

Frank



----- Original Message -----
> From: Victor Gil <[email protected]>
> To: [email protected]
> Cc: 
> Sent: Wednesday, April 11, 2012 9:36 AM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> LINKAGE SECTION.
> 
> 01 A-POINTER USAGE POINTER.
> 01 BIN-WORD REDEFINES A-POINTER COMP S9(8).
> 
> ...
> CALL 'THEFUNCTION' USING MAGIC, INPUT-BUFFER, INPUT-LENGTH, OMITTED, 
> OMITTED RETURNING RC.
> 
> SET A-POINTER TO ADDRESS OF INPUT-LENGTH
> IF BIN-WORD < 0 THEN <the high-bit is ON>
> 
> ================================================================================================
> Funny thing with Enterprise COBOL...  It "properly" sets the 
> high-order bit on the last parm, but supplies no way to interrogate it!  So 
> if 
> "THEFUNCTION" was written in COBOL then you have to invoke it thusly:
> 
> CALL 'THEFUNCTION' USING MAGIC, INPUT-BUFFER, INPUT-LENGTH, OMITTED, 
> OMITTED
> RETURNING RC.
> 
> (The OMITTED keyword simply passes an address of NULL.)
> 
> Oy!
> 
> Frank
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
> 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to