Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-19 Thread Shmuel Metz (Seymour J.)
In <4f8e7be4.5000...@t-online.de>, on 04/18/2012
   at 10:31 AM, Bernd Oppolzer  said:

>Why? I don't understand this comment, because JCL parm is always 
>only one parm;

The phrase "invoked from JCL: is not equivalent to "invoked
exclusively from JCL."

>I dont know if the system sets the high order bit of the address 
>of the JCL parm

Not only does it do so, but the standard utilities would fail if it
didn't.
 
-- 
 Shmuel (Seymour J.) Metz, SysProg and JOAT
 ISO position; see  
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-19 Thread Shmuel Metz (Seymour J.)
In ,
on 04/18/2012
   at 07:36 AM, "McKown, John"  said:

>What about the ASMA90 program?

That's why I wrote "intended to be invoked from JCL" rather than
"intended to be invoked exclusively from JCL." 
 
-- 
 Shmuel (Seymour J.) Metz, SysProg and JOAT
 ISO position; see  
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-18 Thread McKown, John
What about the ASMA90 program? It can be invoked via JCL and process the PARM=. 
But it can also be LINK'd to or ATTACH[X]'d. In this latter case, The parmlist 
passed in via GPR1 can have more than one entry. The others are for things like 
overriding DD names. Many of IBM's utilities (such as IDCAMS) use this 
facility. I have written a program which invokes IDCAMS and redirects the 
"SYSIN" and "SYSPRINT" DD statement to a subroutine in my code so that I could 
send a command to IDCAMS and then get the result back, in order to futher 
process it.

-- 
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * 
john.mck...@healthmarkets.com * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

 

> -Original Message-
> From: IBM Mainframe Discussion List 
> [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of Bernd Oppolzer
> Sent: Wednesday, April 18, 2012 3:32 AM
> To: IBM-MAIN@bama.ua.edu
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Why? I don't understand this comment, because JCL parm is always only 
> one parm;
> no variable length address list ... what do I get wrong? 
> Well, the JCL 
> parm itself has
> variable length, but the length of the address list is fixed, always 
> one. And: I dont know
> if the system sets the high order bit of the address of the 
> JCL parm - I 
> just don't care.
> 
> Kind regards
> 
> Bernd
> 
> 
> 
> Am 18.04.2012 01:06, schrieb Shmuel Metz (Seymour J.):
> > 
> In,
> > on 04/11/2012
> > at 12:32 PM, "McKown, 
> John"  said:
> >
> >> Given all the above facts, I wonder if it is time to abandon, in
> >> our own code, the practice of indicating end-of-list by setting
> >> the high order bit of the last parameter to '1'b.
> > Perhaps for new subroutines, but certainly not for anything intended
> > to be invoked from JCL.
> >
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-18 Thread Bernd Oppolzer
Why? I don't understand this comment, because JCL parm is always only 
one parm;
no variable length address list ... what do I get wrong? Well, the JCL 
parm itself has
variable length, but the length of the address list is fixed, always 
one. And: I dont know
if the system sets the high order bit of the address of the JCL parm - I 
just don't care.


Kind regards

Bernd



Am 18.04.2012 01:06, schrieb Shmuel Metz (Seymour J.):

In,
on 04/11/2012
at 12:32 PM, "McKown, John"  said:


Given all the above facts, I wonder if it is time to abandon, in
our own code, the practice of indicating end-of-list by setting
the high order bit of the last parameter to '1'b.

Perhaps for new subroutines, but certainly not for anything intended
to be invoked from JCL.



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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-17 Thread Shmuel Metz (Seymour J.)
In ,
on 04/11/2012
   at 12:32 PM, "McKown, John"  said:

>Given all the above facts, I wonder if it is time to abandon, in 
>our own code, the practice of indicating end-of-list by setting 
>the high order bit of the last parameter to '1'b.

Perhaps for new subroutines, but certainly not for anything intended
to be invoked from JCL.
 
-- 
 Shmuel (Seymour J.) Metz, SysProg and JOAT
 ISO position; see  
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-12 Thread Frank Swarbrick
Thanks.
Steve Comstock's method does work, in any case.
Frank



- Original Message -
> From: Victor Gil 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Thursday, April 12, 2012 1:59 PM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Frank,
> 
> I just re-tested my suggestion and you are right, it DOES NOT work [not to 
> mention the wrong location for A-POINTER, as it should be in WORKING-STORAGE 
> rather than in LINKAGE]. This made me curious as I vaguely remember dealing 
> with 
> a variable p-list in COBOL.  It turns out I was calling a simple Assembler 
> subroutine, below, to return back the registers.
> 
> Apologies for mis-information,
> -Victor- 
> 
>           YREGS                                                      
> COB#REGS  CSECT                                                      
> COB#REGS  AMODE ANY                                                  
> COB#REGS  RMODE ANY                                                  
> *
> * Sample invocation:                                                  
> *        CALL 'COB#REGS' USING R0-R15  (ARRAY OF 16 FULLWORDS)        
> *
>          ST    R15,12+4(,R13)                 - SAVE R15              
>          USING PARMS,R1                                              
>          L     R15,PARM_PTR                   - PARM POINTER          
>          USING PARM,R15                                              
>          STM   R0,R15,PARM                    - PASS REGS            
>          MVC   PARM+4*15(4),12+4(R13)         -  ... AND FIX R15      
> *                                                                    
>          SR    R15,R15                        - ALWAYS "OK"          
>          BR    R14                            - DONE                  
> *
> PARMS    DSECT                                                        
> PARM_PTR  DS A                                                        
> *                                                                    
> PARM_D   DSECT                                                        
> PARM      DS (16)A                                                    
> *                                                                    
>          END                                                          
> 
> 
> It was.  Program 'callee' in my example below.  (My example has three 
> programs; 'callopt' calls 'callee'.  'callee' should 
> call 'print-string' only for parms that were passed from program 
> 'callopt'.  I did not show the code for 'print-string', as it is 
> not being passed a variable number of parameters.
> 
> 
> Frank
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-12 Thread Victor Gil
Frank,

I just re-tested my suggestion and you are right, it DOES NOT work [not to 
mention the wrong location for A-POINTER, as it should be in WORKING-STORAGE 
rather than in LINKAGE]. This made me curious as I vaguely remember dealing 
with a variable p-list in COBOL.  It turns out I was calling a simple Assembler 
subroutine, below, to return back the registers.

Apologies for mis-information,
-Victor- 

  YREGS   
COB#REGS  CSECT   
COB#REGS  AMODE ANY   
COB#REGS  RMODE ANY   
*
* Sample invocation:  
*CALL 'COB#REGS' USING R0-R15  (ARRAY OF 16 FULLWORDS)
*
 STR15,12+4(,R13) - SAVE R15  
 USING PARMS,R1   
 L R15,PARM_PTR   - PARM POINTER  
 USING PARM,R15   
 STM   R0,R15,PARM- PASS REGS 
 MVC   PARM+4*15(4),12+4(R13) -  ... AND FIX R15  
* 
 SRR15,R15- ALWAYS "OK"   
 BRR14- DONE  
*
PARMSDSECT
PARM_PTR  DS A
* 
PARM_D   DSECT
PARM  DS (16)A
* 
 END  


It was.  Program 'callee' in my example below.  (My example has three programs; 
'callopt' calls 'callee'.  'callee' should call 'print-string' only for parms 
that were passed from program 'callopt'.  I did not show the code for 
'print-string', as it is not being passed a variable number of parameters.


Frank

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-12 Thread Frank Swarbrick
I wonder if this would work:


declare THEFUNCTION    entry     returns(fixed bin) options(nodescriptor, 
linkage(system), fetchable);


result = THEFUNCTION(magic, parm1, parm2);
result = THEFUNCTION(magic, parm1, parm2, parm3, parm4);

Frank


- Original Message -
> From: Phil Smith 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Tuesday, April 10, 2012 1:54 PM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Steve Comstock wrote:
>>  Yes. But that's Assembler. I thought the called routine
>> was C, and you were testing the parms passed in the C
>> routine. Is that not true? Are there more layers here?
> 
> Yes, there are lots of layers, it's a mixture of assembler and C, sorry. The 
> point is, we're confident that the description of the behavior we've 
> seen is as described (we have XDC, too, so can see some of it). it's very 
> strange-as if nobody at IBM ever really tried to use variable plists with 
> PL/I!
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-12 Thread Frank Swarbrick
It was.  Program 'callee' in my example below.  (My example has three programs; 
'callopt' calls 'callee'.  'callee' should call 'print-string' only for parms 
that were passed from program 'callopt'.  I did not show the code for 
'print-string', as it is not being passed a variable number of parameters.


Frank



- Original Message -
> From: Victor Gil 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Thursday, April 12, 2012 9:48 AM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Frank,
> 
> The LINKAGE SECTION items and the 2 statements
> 
>   SET A-POINTER TO ADDRESS OF INPUT-LENGTH
>   IF BIN-WORD < 0 THEN 
> 
> should be coded in the CALLED SUBROUTINE [in your case "print-string"] 
> to determine what was passed by the CALLER. 
> 
> Sorry, if this was not obvious from the first note.
> -Victor- 
> 
> 
> 
> Date:    Wed, 11 Apr 2012 10:38:26 -0700
> From:    Frank Swarbrick 
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> 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 
>>  To: IBM-MAIN@bama.ua.edu
>>  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 
>> 
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-12 Thread Victor Gil
Frank,

The LINKAGE SECTION items and the 2 statements

  SET A-POINTER TO ADDRESS OF INPUT-LENGTH
  IF BIN-WORD < 0 THEN 

should be coded in the CALLED SUBROUTINE [in your case "print-string"] to 
determine what was passed by the CALLER. 

Sorry, if this was not obvious from the first note.
-Victor- 



Date:Wed, 11 Apr 2012 10:38:26 -0700
From:Frank Swarbrick 
Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)

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  addrpointer. 
 77  addr-val redefines addr pic s9(9) comp-5.
 
 linkage section. 
 01  string-1pic x(101).  
 01  string-2pic 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 
> To: IBM-MAIN@bama.ua.edu
> 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 
>

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread Bernd Oppolzer

It's true: when passing 64 bit addresses, the VL bit mechanism will
not work any more, so maybe it has no future.

The C stdarg mechanism has its drawbacks, but it does not rely on
a specific platform or operating system, it is portable, and it works
with 64 bit environments, too. This is what I like about C - it is sometimes
a little bit strange, but the programs conforming to the ANSI standard
run on almost every platform and - if you do it right - need not be 
changed,

even when your platform changes, for example, from 32 to 64 bit.

Kind regards

Bernd



Am 11.04.2012 19:32, schrieb McKown, John:

I had never read that. And, guess what, whomever wrote the initiator code 
didn't either. Because it use ATTACH or maybe ATTACHX to run the program 
specified on the EXEC PGM=. And it is documented that the parameter list has 
the high bit set on in the last address. But it always and only passes one 
parameter to the program (the PARM= string). However, the program being 
executed may or may not accept a variable number of parms. IEFBR14 does not use 
any parms. IDCAMS accepts 0 or more parms. Most COBOL main routines only accept 
a single parameter. The initiator doesn't know how many parms may be accepted 
by the invoked program. So the comment on ATTACH/ATTACHX macros, which is also 
on LINK/LINKX macros, is ludicrous. Likely it should say something like:

You only need to specify VL=1 only if the called program can be passed a 
variable number of parameters. VL=1 causes the high-order bit of the last 
address parameter to be set to 1; the bit can be checked to find the end of the 
list.

But having the VL=1 does no harm. IMO, the comment in the manual omits the "You only need 
to" neede at the start of the first sentence. Maybe the editor needed to decrease the 
manual word count?

Other interesting things that I hadn't noted: neither ATTACH[X] or LINK[X] 
support above the bar PARMS; CALL doesn't have the note about VL only being for 
called programs which can be passed a variable number of parameters; CALL 
supports 64-bit addresses (either AMODE64 without PLIST4=YES, or not AMODE64 
and PLIST8=YES). But when it uses an 8-bytes-per-entry plist, you cannot 
specify VL. Which means that to pass a plist to a program which uses a variable 
number of list entries, using the 8-bytes-per-entry plist format, you must pass 
the number of parameters in the list to the called routine. I would think by 
making the first parameter a pointer (4 or 8 bytes as needed by the called 
routine) to a fullword containing the number of parameters in the list.

Given all the above facts, I wonder if it is time to abandon, in our own code, 
the practice of indicating end-of-list by setting the high order bit of the 
last parameter to '1'b. If, instead, we might want to pass the number of 
parameters in the list either: (1) by value (fullword or doubleword pointed to 
by GPR1 is the number of parameters in the rest of the list) or (2) by 
reference (fullword or doubleword pointed to by GPR1 points to a fullword which 
contains the number of parameters in the rest of the list). All the size of 
each list entry pointed to by GPR1 would be 4 (not AMODE64 and not PLIST8=YES) 
or 8 (AMODE64 and not PLIST4=YES, or PLIST8=YES regardless of AMODE). Of course 
the called routine must be written to accept either one of: (1) 4 
bytes-per-entry in the list, or (2) 8-bytes-per-entry in the list.



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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread Frank Swarbrick
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 
> To: IBM-MAIN@bama.ua.edu
> 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 
> 
> 
> 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 lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread McKown, John
I had never read that. And, guess what, whomever wrote the initiator code 
didn't either. Because it use ATTACH or maybe ATTACHX to run the program 
specified on the EXEC PGM=. And it is documented that the parameter list has 
the high bit set on in the last address. But it always and only passes one 
parameter to the program (the PARM= string). However, the program being 
executed may or may not accept a variable number of parms. IEFBR14 does not use 
any parms. IDCAMS accepts 0 or more parms. Most COBOL main routines only accept 
a single parameter. The initiator doesn't know how many parms may be accepted 
by the invoked program. So the comment on ATTACH/ATTACHX macros, which is also 
on LINK/LINKX macros, is ludicrous. Likely it should say something like:

You only need to specify VL=1 only if the called program can be passed a 
variable number of parameters. VL=1 causes the high-order bit of the last 
address parameter to be set to 1; the bit can be checked to find the end of the 
list. 

But having the VL=1 does no harm. IMO, the comment in the manual omits the "You 
only need to" neede at the start of the first sentence. Maybe the editor needed 
to decrease the manual word count? 

Other interesting things that I hadn't noted: neither ATTACH[X] or LINK[X] 
support above the bar PARMS; CALL doesn't have the note about VL only being for 
called programs which can be passed a variable number of parameters; CALL 
supports 64-bit addresses (either AMODE64 without PLIST4=YES, or not AMODE64 
and PLIST8=YES). But when it uses an 8-bytes-per-entry plist, you cannot 
specify VL. Which means that to pass a plist to a program which uses a variable 
number of list entries, using the 8-bytes-per-entry plist format, you must pass 
the number of parameters in the list to the called routine. I would think by 
making the first parameter a pointer (4 or 8 bytes as needed by the called 
routine) to a fullword containing the number of parameters in the list.

Given all the above facts, I wonder if it is time to abandon, in our own code, 
the practice of indicating end-of-list by setting the high order bit of the 
last parameter to '1'b. If, instead, we might want to pass the number of 
parameters in the list either: (1) by value (fullword or doubleword pointed to 
by GPR1 is the number of parameters in the rest of the list) or (2) by 
reference (fullword or doubleword pointed to by GPR1 points to a fullword which 
contains the number of parameters in the rest of the list). All the size of 
each list entry pointed to by GPR1 would be 4 (not AMODE64 and not PLIST8=YES) 
or 8 (AMODE64 and not PLIST4=YES, or PLIST8=YES regardless of AMODE). Of course 
the called routine must be written to accept either one of: (1) 4 
bytes-per-entry in the list, or (2) 8-bytes-per-entry in the list.

-- 
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * 
john.mck...@healthmarkets.com * www.HealthMarkets.com
 
Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

 

> -Original Message-
> From: IBM Mainframe Discussion List 
> [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of Bernd Oppolzer
> Sent: Wednesday, April 11, 2012 9:28 AM
> To: IBM-MAIN@bama.ua.edu
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> I understand your motivation to do this;
> our site specific CALL macro also sets the high order bit on every
> parameter address list (even fixed length), although nobody checks it;
> it's merely for dump reading purposes.
> 
> But: if you recall the posting of the ATTACH macro description,
> you are (and we are) in conflict with the recommendation of IBM,
> which says that the VL bit should only be set on variable length
> parameter lists. But even the IBM recommendations are not very
> consistent, as the other poster pointed out ...
> 
> Kind regards
> 
> Bernd
>

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread Frank Swarbrick
Cool trick!
Probably a bit(!) confusing to application developers who really don't 
understand how program linkage works, but definitely cool.



- Original Message -
> From: Steve Comstock 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Tuesday, April 10, 2012 8:15 PM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> On 4/10/2012 4:33 PM, Frank Swarbrick wrote:
>>  - Original Message -
>>>  From: Phil Smith
>>>  To: IBM-MAIN@bama.ua.edu
>>>  Cc:
>>>  Sent: Tuesday, April 10, 2012 3:31 PM
>>>  Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
>>> 
>>>  Bernd Oppolzer wrote:
>>>>  I don't know if it helps you, but using C I would code the two 
> calls
>>>  this way:
>>> 
>>>>  rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, 
> NULL);
>>> 
>>>  Exactly backwards-the idea here is to NOT be obscure, but to have a 
> nice,
>>>  flexible, intuitive API. Having to specify null parameters or to use a 
> macro for
>>>  things is what we *don't* want to do.
>> 
>>  Haha, I can agree with that!
>> 
>>  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!
> 
> Well, there is a little trick you use, involving defining the
> trailing parameters as pointers coming in by value, on the
> procedure division header name the pointers not the items,
> defining items you expect in linkage, redefining a binary
> item on top of the pointers, to access one of the data items
> use 'set addres of data_item to pointer', when you're done
> with an item check if the redefined (binary version) is
> negative - that indicates the end of list bit is on.
> 
> No problem.
> 
> :-)
> 
> 
>> 
>>  Frank
>> 
>>  --
>>  For IBM-MAIN subscribe / signoff / archive access instructions,
>>  send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
>> 
> 
> 
> -- 
> 
> Kind regards,
> 
> -Steve Comstock
> The Trainer's Friend, Inc.
> 
> 303-355-2752
> http://www.trainersfriend.com
> 
> * To get a good Return on your Investment, first make an investment!
>    + Training your people is an excellent investment
> 
> * Try our tool for calculating your Return On Investment
>      for training dollars at
>    http://www.trainersfriend.com/ROI/roi.html
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread Victor Gil
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 


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 lists...@bama.ua.edu with the message: INFO IBM-MAIN


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread Bernd Oppolzer

I understand your motivation to do this;
our site specific CALL macro also sets the high order bit on every
parameter address list (even fixed length), although nobody checks it;
it's merely for dump reading purposes.

But: if you recall the posting of the ATTACH macro description,
you are (and we are) in conflict with the recommendation of IBM,
which says that the VL bit should only be set on variable length
parameter lists. But even the IBM recommendations are not very
consistent, as the other poster pointed out ...

Kind regards

Bernd


Am 11.04.2012 16:07, schrieb McKown, John:

At present, all my HLASM code checks for the high order bit to be '1'b. Even 
for fixed length parameter lists. Why? Because I don't trust the programmers 
using my code to call it correctly. Therefore, I do as many validations as I 
can before performing any operations. I got into this habit due to a really 
messy HLASM subroutine that I had to rewrite. It had a tendency to not validate 
anything. And did some amazing memory overlays in CICS, some of which crashed 
CICS itself.

If a validation error occurs, I either return a return code which is architected as 
meaning "either the wrong number of parameters or an invalid parameter value has 
been detected.", or I force an ABEND. I only ABEND when I update an existing program 
which was not designed to return a return code, because I know the calling code will not 
check it. In the past, I caused an S0C3 via an EX of itself. I have changed this to an 
S0C1 by doing a BRC to *+2 (Jcond *+2) because I have changed my assembly technique to 
use relative addressing as well as being LE enabled (in most cases).

I actually prefer LE enabled assembler in most cases. Mainly because: (1) it 
interoperates better with HLLs like COBOL, PL/I, FORTRAN, and C/C++, both as 
caller and as callee; (2) I can use subroutines written in those languages 
easily; and (3) if I abend in my assembler code, I get a CEEDUMP. This latter 
is very nice when I am writing a UNIX shell command because it puts the CEEDUMP 
in a uniquely named file in the current directory. It's difficult to get a 
SYSUDUMP type abend dump from a UNIX shell command. And the CEEDUMP is usually 
sufficient for my debugging.



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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread McKown, John
At present, all my HLASM code checks for the high order bit to be '1'b. Even 
for fixed length parameter lists. Why? Because I don't trust the programmers 
using my code to call it correctly. Therefore, I do as many validations as I 
can before performing any operations. I got into this habit due to a really 
messy HLASM subroutine that I had to rewrite. It had a tendency to not validate 
anything. And did some amazing memory overlays in CICS, some of which crashed 
CICS itself. 

If a validation error occurs, I either return a return code which is 
architected as meaning "either the wrong number of parameters or an invalid 
parameter value has been detected.", or I force an ABEND. I only ABEND when I 
update an existing program which was not designed to return a return code, 
because I know the calling code will not check it. In the past, I caused an 
S0C3 via an EX of itself. I have changed this to an S0C1 by doing a BRC to *+2 
(Jcond *+2) because I have changed my assembly technique to use relative 
addressing as well as being LE enabled (in most cases). 

I actually prefer LE enabled assembler in most cases. Mainly because: (1) it 
interoperates better with HLLs like COBOL, PL/I, FORTRAN, and C/C++, both as 
caller and as callee; (2) I can use subroutines written in those languages 
easily; and (3) if I abend in my assembler code, I get a CEEDUMP. This latter 
is very nice when I am writing a UNIX shell command because it puts the CEEDUMP 
in a uniquely named file in the current directory. It's difficult to get a 
SYSUDUMP type abend dump from a UNIX shell command. And the CEEDUMP is usually 
sufficient for my debugging.

-- 
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * 
john.mck...@healthmarkets.com * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

> -Original Message-
> From: IBM Mainframe Discussion List 
> [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of Bernd Oppolzer
> Sent: Tuesday, April 10, 2012 5:49 PM
> To: IBM-MAIN@bama.ua.edu
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> I would not blame PL/1 for this.
> It is not OK IMHO to request the caller to set the
> high order bit on the last parameter, when the number of the 
> parameters 
> is fixed
> (see also my GDDM example on the other post). This is not required by 
> any OS convention,
> at least that's my understanding.
> 
> Kind regards
> 
> Bernd
> 
> 
> 
> Am 11.04.2012 00:19, schrieb Frank Swarbrick:
> > I don't know if this is relevant, but I was looking at the 
> PL/I DL/I (IMS) interface (PLITDLI) and noticed that they 
> actually have to pass, as the first parameter, a fullword 
> containing the remaining number of items!  Crazy!
> >
> > For example, in COBOL you say:
> >
> > call 'CBLTDLI' using ghnp, pcb-mask, i-o-area, ssa-1 ssa-2.
> >
> > In PL/I it looks like you'd do something like this:
> > call PLITDLI (five, ghnp, pcb-mask, i-o-area, ssa-1 ssa-2);
> >
> > See here for more details:
> > 
> http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.j
> sp?topic=%2Fcom.ibm.ims11.doc.apg%2Fims_imsdbpliapp.htm
> >
> > I was pretty happy about what I learned about PL/I until I 
> saw this.  Yuck!
> >
> > Frank
> >
> >
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread Steve Comstock

On 4/11/2012 6:38 AM, Phil Smith wrote:

Thanks for all the responses; off to hospital for spinal surgery, more anon.



Ouch! Best wishes.


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-11 Thread Phil Smith
Thanks for all the responses; off to hospital for spinal surgery, more anon.


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


Re: LE C calling HLASM

2012-04-11 Thread Elardus Engelbrecht
Shmuel Metz (Seymour J.) wrote:

>>http://publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.ikjb300%2Fpack.htm

>Yes. TSO/E also picked up up PCF.

Thanks, Shmuel, for your kind confirmation. Much appreciated.

Please keep up with your valuable educational posts. I learn something new from 
these posts.

Thanks again and keep safe! :-)

Groete / Greetings
Elardus Engelbrecht

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Steve Comstock

On 4/10/2012 3:11 PM, Phil Smith wrote:

Steve Comstock wrote:

Slipperier and slipperier. OK, let's try a different approach:



You tell me exactly what you want to see from the PL/I routine calling
your API and I'll see if I can cause PL/I to construct that.



In other words, your routine will see



(R1) ->  


rc = THEFUNCTION(magic,inputbuffer,inputlength)

(R1) ==>  A(magic),A(inputbuffer),A(inputlength)<== high bit set on the third 
fullword

OR (the fully specified case):

rc = THEFUNCTION(magic,inputbuffer,inputlength,outputbuffer,outputlength)

(R1) ==>  
A(magic),A(inputbuffer),A(inputlength),A(outputbuffer),A(outputlength)<== high bit 
set on the fifth fullword

Pretty standard, yes?



Yes. And here's some code:

 psubsrk: proc options(main);

 /*  declare invoked subroutines  */

   dcl thefunction entry external('CATCHER') options(asm retcode);
   dcl pliretv builtin;

 /*  declare data items   */

   dcl magic  fixed bin(31);
   dcl bufone char(1200);
   dcl lenone fixed bin(31) value (1200);
   dcl buftwo char(1600);
   dcl lentwo fixed bin(31) value (1600);

   dcl rslt fixed bin(31);
   dcl msg  char(16) value('Return value is ');

 /*  actual code begins here   */

  call thefunction(magic, bufone, lenone);
  call thefunction(magic, bufone, lenone, buftwo,lentwo);

  rslt = pliretv();
  put list (msg, rslt);

 end psubsrk;


_Notes_

1. CATCHER was an old routine I had around that does the following:
* display an entry message (..In CATCHER)
* display the first seven words pointed at by R1, in hex
* returns a value of '7' for its return code (hard coded)
* display an exit message (..Leaving CATCHER)

2. The output from the run is:

..In CATCHER
..c(R1) = 19C1A4D0
..Seven words at address pointed at by R1 =
: 19C1A500 19C1A504 99C1B074 000B 0001 00B0 
..Leaving CATCHER
..In CATCHER
..c(R1) = 19C1A4D0
..Seven words at address pointed at by R1 =
: 19C1A500 19C1A504 19C1B074 19C1A9B4 99C1B070 00B0 
..Leaving CATCHER
Return value is  7


3. Notice the first time in the third word is x'99C1B074' - the
   end of list bit is on

   the second call of thefunction the third word is x'1C1B074'
   - the end of list bit is not on there, but the fifth word
   is x'99C1B070' - the end of list bit is on

4. The strange values after the parm pointers
   (e.g.: 000B 0001 00B0  in the first call)
   are just random garbage; the compiler does not clear out
   the storage used for the parmlist: it just changes the words
   that actually have parameter entries

So, I think that's pretty straighforward; it's a CALL
instead of a function reference, but it will work. Now,
if you need a function reference I can look into it some
time.


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Steve Comstock

On 4/10/2012 4:33 PM, Frank Swarbrick wrote:

- Original Message -

From: Phil Smith
To: IBM-MAIN@bama.ua.edu
Cc:
Sent: Tuesday, April 10, 2012 3:31 PM
Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)

Bernd Oppolzer wrote:

I don't know if it helps you, but using C I would code the two calls

this way:


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, NULL);


Exactly backwards-the idea here is to NOT be obscure, but to have a nice,
flexible, intuitive API. Having to specify null parameters or to use a macro for
things is what we *don't* want to do.


Haha, I can agree with that!

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!


Well, there is a little trick you use, involving defining the
trailing parameters as pointers coming in by value, on the
procedure division header name the pointers not the items,
defining items you expect in linkage, redefining a binary
item on top of the pointers, to access one of the data items
use 'set addres of data_item to pointer', when you're done
with an item check if the redefined (binary version) is
negative - that indicates the end of list bit is on.

No problem.

:-)




Frank

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




--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Frank Swarbrick
We don't have PL/I in our shop (I downloaded an old "trial" version of 
VisualAge PL/I for Windows to play with at home), but it seems to me that one 
MIGHT be able to do the following for PL/I to call DL/I:

declare CEETDLI entry linkage(SYSTEM);
or perhaps
declare CEETDLI entry(char(4), *, *, *, *, *, *, *, *, *, *) linkage(SYSTEM);

Then call without passing the number of parms:

call CEETDLI(ghnp, pcb-mask, i-o-area, ssa-1 ssa-2);

I am assuming that LINKAGE(SYSTEM) does indeed set the high-order bit in the 
last parm.
I used CEETDLI rather than PLITDLI because I know it can be called from "any" 
language (COBOL, PL/I, Assembler, maybe C and Fortran), so it can obviously(!) 
handle the high-order bit indicator.


I would be vary curious to have someone with both PL/I and IMS test this out.

Frank



- Original Message -
> From: Bernd Oppolzer 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Tuesday, April 10, 2012 5:31 PM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Ok, this is one thing; needs probably some claryfying from IBM.
> 
> But, as Frank mentioned in the other post:
> 
> I think the high order bit is really needed in the PLITDLI case,
> because the number of parameters is not fixed and cannot be
> derived from the other parameters in every case (I guess, the number
> of SSAs is really variable on the GET request, and the high order bit on
> the last SSA marks the end of the list - only speculating; I know almost
> nothing about IMS).
> 
> So we here have a design where the API relies heavily on the OS/360
> high order bit mechanism. Languages that do not set the high order bit
> on the last parm address must prefix the address list with the parmcount,
> so that the DLI interface knows the number of the parameters.
> 
> My opinion is: there are languages that even don't support variable length
> parameter lists. But you always find a way to overcome this restriction;
> for example: you could pass an array of SSAs as a single parameter
> in the case of the IMS GET request (together with a number of entries).
> This is what I would normally do in C - starting address of the array and
> number of elements, two parameters. You don't really need variable
> length parameter lists - they are comfortable sometimes, like with
> printf etc, but you can live without them.
> 
> Kind regards
> 
> Bernd
> 
> 
> 
> Am 11.04.2012 01:07, schrieb Paul Gilmartin:
>>  On Wed, 11 Apr 2012 00:48:33 +0200, Bernd Oppolzer wrote:
>> 
>>>  I would not blame PL/1 for this.
>>>  It is not OK IMHO to request the caller to set the
>>>  high order bit on the last parameter, when the number of the parameters 
> is fixed
>>>  (see also my GDDM example on the other post). This is not required by
>>>  any OS convention,
>>>  at least that's my understanding.
>>> 
>>  It's inconsistently deprecated.  In:
>> 
>>       
> http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/iea2a7b0/5.1.8
>> 
>>       5.0 ATTACH and ATTACHX -- Create a new task
>>       Subtopics:
>>       * 5.1 Description
>> 
>>       Specify VL=1 only if the called program can be passed a variable 
> number
>>       of parameters. VL=1 causes the high-order bit of the last address to 
> be
>>       set to 1; the bit can be checked to find the end of the list.
>> 
>>  Note the word "only".  But this admonition appears for ATTACH, 
> but not
>>  for CALL.  Is there any rationale for this difference, or is an RCF in 
> order?
>>  (I haven't checked LINK nor XCTL; they're in a different volume.)
>> 
>>  -- gil
>> 
>>  --
>>  For IBM-MAIN subscribe / signoff / archive access instructions,
>>  send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
>> 
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Bernd Oppolzer

Ok, this is one thing; needs probably some claryfying from IBM.

But, as Frank mentioned in the other post:

I think the high order bit is really needed in the PLITDLI case,
because the number of parameters is not fixed and cannot be
derived from the other parameters in every case (I guess, the number
of SSAs is really variable on the GET request, and the high order bit on
the last SSA marks the end of the list - only speculating; I know almost
nothing about IMS).

So we here have a design where the API relies heavily on the OS/360
high order bit mechanism. Languages that do not set the high order bit
on the last parm address must prefix the address list with the parmcount,
so that the DLI interface knows the number of the parameters.

My opinion is: there are languages that even don't support variable length
parameter lists. But you always find a way to overcome this restriction;
for example: you could pass an array of SSAs as a single parameter
in the case of the IMS GET request (together with a number of entries).
This is what I would normally do in C - starting address of the array and
number of elements, two parameters. You don't really need variable
length parameter lists - they are comfortable sometimes, like with
printf etc, but you can live without them.

Kind regards

Bernd



Am 11.04.2012 01:07, schrieb Paul Gilmartin:

On Wed, 11 Apr 2012 00:48:33 +0200, Bernd Oppolzer wrote:


I would not blame PL/1 for this.
It is not OK IMHO to request the caller to set the
high order bit on the last parameter, when the number of the parameters is fixed
(see also my GDDM example on the other post). This is not required by
any OS convention,
at least that's my understanding.


It's inconsistently deprecated.  In:

 http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/iea2a7b0/5.1.8

 5.0 ATTACH and ATTACHX -- Create a new task
 Subtopics:
 * 5.1 Description

 Specify VL=1 only if the called program can be passed a variable number
 of parameters. VL=1 causes the high-order bit of the last address to be
 set to 1; the bit can be checked to find the end of the list.

Note the word "only".  But this admonition appears for ATTACH, but not
for CALL.  Is there any rationale for this difference, or is an RCF in order?
(I haven't checked LINK nor XCTL; they're in a different volume.)

-- gil

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



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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Paul Gilmartin
On Wed, 11 Apr 2012 00:48:33 +0200, Bernd Oppolzer wrote:

>I would not blame PL/1 for this.
>It is not OK IMHO to request the caller to set the
>high order bit on the last parameter, when the number of the parameters is 
>fixed
>(see also my GDDM example on the other post). This is not required by
>any OS convention,
>at least that's my understanding.
>
It's inconsistently deprecated.  In:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/iea2a7b0/5.1.8

5.0 ATTACH and ATTACHX -- Create a new task
Subtopics:
* 5.1 Description 

Specify VL=1 only if the called program can be passed a variable number
of parameters. VL=1 causes the high-order bit of the last address to be
set to 1; the bit can be checked to find the end of the list.

Note the word "only".  But this admonition appears for ATTACH, but not
for CALL.  Is there any rationale for this difference, or is an RCF in order?
(I haven't checked LINK nor XCTL; they're in a different volume.)

-- gil

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Frank Swarbrick
Well, in the DLI interfaces the number of items passed is NOT fixed.  You can 
pass one or more SSAs on a "get" call (and some others), and some calls do not 
require an SSA at all.  Some don't even require an I-O area.

Frank



- Original Message -
> From: Bernd Oppolzer 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Tuesday, April 10, 2012 4:48 PM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> I would not blame PL/1 for this.
> It is not OK IMHO to request the caller to set the
> high order bit on the last parameter, when the number of the parameters 
> is fixed
> (see also my GDDM example on the other post). This is not required by 
> any OS convention,
> at least that's my understanding.
> 
> Kind regards
> 
> Bernd
> 
> 
> 
> Am 11.04.2012 00:19, schrieb Frank Swarbrick:
>>  I don't know if this is relevant, but I was looking at the PL/I DL/I 
> (IMS) interface (PLITDLI) and noticed that they actually have to pass, as the 
> first parameter, a fullword containing the remaining number of items!  Crazy!
>> 
>>  For example, in COBOL you say:
>> 
>>  call 'CBLTDLI' using ghnp, pcb-mask, i-o-area, ssa-1 ssa-2.
>> 
>>  In PL/I it looks like you'd do something like this:
>>  call PLITDLI (five, ghnp, pcb-mask, i-o-area, ssa-1 ssa-2);
>> 
>>  See here for more details:
>> 
> http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.ims11.doc.apg%2Fims_imsdbpliapp.htm
>> 
>>  I was pretty happy about what I learned about PL/I until I saw this.  Yuck!
>> 
>>  Frank
>> 
>> 
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Bernd Oppolzer

I would not blame PL/1 for this.
It is not OK IMHO to request the caller to set the
high order bit on the last parameter, when the number of the parameters 
is fixed
(see also my GDDM example on the other post). This is not required by 
any OS convention,

at least that's my understanding.

Kind regards

Bernd



Am 11.04.2012 00:19, schrieb Frank Swarbrick:

I don't know if this is relevant, but I was looking at the PL/I DL/I (IMS) 
interface (PLITDLI) and noticed that they actually have to pass, as the first 
parameter, a fullword containing the remaining number of items!  Crazy!

For example, in COBOL you say:

call 'CBLTDLI' using ghnp, pcb-mask, i-o-area, ssa-1 ssa-2.

In PL/I it looks like you'd do something like this:
call PLITDLI (five, ghnp, pcb-mask, i-o-area, ssa-1 ssa-2);

See here for more details:
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.ims11.doc.apg%2Fims_imsdbpliapp.htm

I was pretty happy about what I learned about PL/I until I saw this.  Yuck!

Frank




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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Frank Swarbrick
- Original Message -
> From: Phil Smith 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Tuesday, April 10, 2012 3:31 PM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Bernd Oppolzer wrote:
>> I don't know if it helps you, but using C I would code the two calls 
> this way:
> 
>> rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, NULL);
> 
> Exactly backwards-the idea here is to NOT be obscure, but to have a nice, 
> flexible, intuitive API. Having to specify null parameters or to use a macro 
> for 
> things is what we *don't* want to do.

Haha, I can agree with that!

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 lists...@bama.ua.edu with the message: INFO IBM-MAIN


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Bernd Oppolzer

Pure speculation on my part:

There are some systems or software components that require that on all calls
(even when the number of parameters is fixed) the last parameter address has
the high order bit set. I recall GDDM, where this was the case.

When I wanted to call GDDM routines from PASCAL/VS (in the 80s), this 
was a nightmare.
The GDDM routines complained, because PASCAL/VS did not set the high 
order bit

on the last parameter address.

I had to generate ASSEMBLER interfaces in between to insert the high 
order bit
at the appropriate position - that is: for every GDDM call there had to 
be a short
ASSEMBLER stub that knew the number of parameters and inserted the high 
order

bit at the proper position.

Maybe the first word in PLITDLI has exactly the same purpose.

Kind regards

Bernd



Am 11.04.2012 00:19, schrieb Frank Swarbrick:

I don't know if this is relevant, but I was looking at the PL/I DL/I (IMS) 
interface (PLITDLI) and noticed that they actually have to pass, as the first 
parameter, a fullword containing the remaining number of items!  Crazy!

For example, in COBOL you say:

call 'CBLTDLI' using ghnp, pcb-mask, i-o-area, ssa-1 ssa-2.

In PL/I it looks like you'd do something like this:
call PLITDLI (five, ghnp, pcb-mask, i-o-area, ssa-1 ssa-2);

See here for more details:
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.ims11.doc.apg%2Fims_imsdbpliapp.htm

I was pretty happy about what I learned about PL/I until I saw this.  Yuck!

Frank




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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Frank Swarbrick
I don't know if this is relevant, but I was looking at the PL/I DL/I (IMS) 
interface (PLITDLI) and noticed that they actually have to pass, as the first 
parameter, a fullword containing the remaining number of items!  Crazy!

For example, in COBOL you say:

call 'CBLTDLI' using ghnp, pcb-mask, i-o-area, ssa-1 ssa-2.

In PL/I it looks like you'd do something like this:
call PLITDLI (five, ghnp, pcb-mask, i-o-area, ssa-1 ssa-2);

See here for more details:
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.ims11.doc.apg%2Fims_imsdbpliapp.htm

I was pretty happy about what I learned about PL/I until I saw this.  Yuck!

Frank
  


- Original Message -
> From: Phil Smith 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Tuesday, April 10, 2012 1:54 PM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Steve Comstock wrote:
>>  Yes. But that's Assembler. I thought the called routine
>> was C, and you were testing the parms passed in the C
>> routine. Is that not true? Are there more layers here?
> 
> Yes, there are lots of layers, it's a mixture of assembler and C, sorry. The 
> point is, we're confident that the description of the behavior we've 
> seen is as described (we have XDC, too, so can see some of it). it's very 
> strange-as if nobody at IBM ever really tried to use variable plists with 
> PL/I!
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Bernd Oppolzer

IMHO the problem is:

there are different solutions for variable length parameter lists that are
not compatible.

I don't know about the PL/1 solution. Maybe Steve Comstock can help
us with this.

There are two other solutions, but they don't fit well together:

- the OS/360 solution: the last parameter address has the first bit set.
Note that this solution works only with addresses, that is, call by 
reference,

and that it requires 31 bit addressing. Parameters passed by value have
a problem, because they can be negative integers, which seems like the
end of the parameter list

- the C solution with stdarg.h. This solution needs a leading fixed number
of arguments; from those fixed arguments, the total number and the types
of the following variable argument list has to be derived (like in 
printf etc.).

The called function cannot examine the parameter list and recognize
the end of the parameter list, as in the OS solution.

That's IMO the whole dilemma. I don't see any clever solution to this 
problem,

that is: there will be no solution that works perfectly for all languages.

There are more problems with parameter passing. If you are restricted to
parameter passing mechanisms that work in more than one language
(in our case for example: PL/1, ASSEMBLER, C), you have to be very
restrictive. In our case, for example, we found the following solutions:

- no PL/1 descriptors

- only pointers to structures

- only integer results (returncodes)

- structure definitions generated by central repository, so that there are
no different alignment considerations from the three languages (and all
structure components match)

Kind regards

Bernd



Am 10.04.2012 23:31, schrieb Phil Smith:

Bernd Oppolzer wrote:

I don't know if it helps you, but using C I would code the two calls this way:
rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, NULL);

Exactly backwards-the idea here is to NOT be obscure, but to have a nice, 
flexible, intuitive API. Having to specify null parameters or to use a macro 
for things is what we *don't* want to do.

Thanks though!

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



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


Fwd: Fwd: Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Bernd Oppolzer

It just came to my mind that you can do the same thing in PL/1,
if you pass Pointers BYVALUE and treat the pointers in the same way
as I did it in my C example.

I often did this (passing Pointers BYVALUE from PL/1 modules),
when there was the need to call C modules from PL/1 programs
and no other definition of the C ENTRY was appropriate.

for example:

DCL YCSPXML ENTRY (PTR BYVALUE,
   PTR BYVALUE,
   PTR BYVALUE,
   PTR BYVALUE,
   PTR BYVALUE,
   PTR BYVALUE)
OPTIONS (ASM RETCODE);

in fact, it is a C program, returning an int (the retcode).

Kind regards

Bernd




 Original-Nachricht 
Betreff:Fwd: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
Datum:  Tue, 10 Apr 2012 23:26:51 +0200
Von:Bernd Oppolzer 
Antwort an: IBM Mainframe Discussion List 
An: IBM-MAIN@bama.ua.edu
Newsgruppen:bit.listserv.ibm-main
Referenzen: <4f84a4db.8080...@t-online.de>



Sorry, the ! should be a |

bitwise or operator in C

I mixed up bitwise or in C with logical or in PL/1

Kind regards

Bernd




 Original-Nachricht 
Betreff:Re: PL/I with variable PLISTs (was: LE C calling HLASM)
Datum:  Tue, 10 Apr 2012 23:23:39 +0200
Von:Bernd Oppolzer
An: IBM Mainframe Discussion List



I don't know if it helps you, but using C I would code the two calls
this way:

rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, NULL);


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, outputbuffer,&outputlength);


Note that the parameters that are probably integers are prefixed with an
ampersand
to pass the addresses.

If it is needed that the 3rd and the 5th address has the high order bit
set,
you can to this in C, too. I would use a macro called HIGHBITON (x), for
example,
which is coded as follows:

#define HIGHBITON(x)  (void *)((unsigned int)(x) ! 0x8000)

So we have


rc = THEFUNCTION (&magic, inputbuffer, HIGHBITON(&inputlength), NULL, NULL);


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, outputbuffer, 
HIGHBITON(&outputlength));


The two additional NULL parameters after the 3rd address in the first
case do no harm.

Kind regards

Bernd



Am 10.04.2012 23:11, schrieb Phil Smith:

  Steve Comstock wrote:

  Slipperier and slipperier. OK, let's try a different approach:
  You tell me exactly what you want to see from the PL/I routine calling
  your API and I'll see if I can cause PL/I to construct that.
  In other words, your routine will see
  (R1) ->

  rc = THEFUNCTION(magic,inputbuffer,inputlength)

  (R1) ==>A(magic),A(inputbuffer),A(inputlength)<== high bit set on the 
third fullword

  OR (the fully specified case):

  rc = THEFUNCTION(magic,inputbuffer,inputlength,outputbuffer,outputlength)

  (R1) ==>
A(magic),A(inputbuffer),A(inputlength),A(outputbuffer),A(outputlength)<== high bit 
set on the fifth fullword

  Pretty standard, yes?

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




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



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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
Bernd Oppolzer wrote:
>I don't know if it helps you, but using C I would code the two calls this way:

>rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, NULL);

Exactly backwards-the idea here is to NOT be obscure, but to have a nice, 
flexible, intuitive API. Having to specify null parameters or to use a macro 
for things is what we *don't* want to do.

Thanks though!

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


Fwd: Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Bernd Oppolzer

Sorry, the ! should be a |

bitwise or operator in C

I mixed up bitwise or in C with logical or in PL/1

Kind regards

Bernd




 Original-Nachricht 
Betreff:Re: PL/I with variable PLISTs (was: LE C calling HLASM)
Datum:  Tue, 10 Apr 2012 23:23:39 +0200
Von:Bernd Oppolzer 
An: IBM Mainframe Discussion List 



I don't know if it helps you, but using C I would code the two calls
this way:

rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, NULL);


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, outputbuffer,&outputlength);


Note that the parameters that are probably integers are prefixed with an
ampersand
to pass the addresses.

If it is needed that the 3rd and the 5th address has the high order bit
set,
you can to this in C, too. I would use a macro called HIGHBITON (x), for
example,
which is coded as follows:

#define HIGHBITON(x)  (void *)((unsigned int)(x) ! 0x8000)

So we have


rc = THEFUNCTION (&magic, inputbuffer, HIGHBITON(&inputlength), NULL, NULL);


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, outputbuffer, 
HIGHBITON(&outputlength));


The two additional NULL parameters after the 3rd address in the first
case do no harm.

Kind regards

Bernd



Am 10.04.2012 23:11, schrieb Phil Smith:

 Steve Comstock wrote:

 Slipperier and slipperier. OK, let's try a different approach:
 You tell me exactly what you want to see from the PL/I routine calling
 your API and I'll see if I can cause PL/I to construct that.
 In other words, your routine will see
 (R1) ->   

 rc = THEFUNCTION(magic,inputbuffer,inputlength)

 (R1) ==>   A(magic),A(inputbuffer),A(inputlength)<== high bit set on the third 
fullword

 OR (the fully specified case):

 rc = THEFUNCTION(magic,inputbuffer,inputlength,outputbuffer,outputlength)

 (R1) ==>   
A(magic),A(inputbuffer),A(inputlength),A(outputbuffer),A(outputlength)<== high bit 
set on the fifth fullword

 Pretty standard, yes?

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




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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Bernd Oppolzer
I don't know if it helps you, but using C I would code the two calls 
this way:


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, NULL, NULL);


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, outputbuffer,&outputlength);


Note that the parameters that are probably integers are prefixed with an 
ampersand

to pass the addresses.

If it is needed that the 3rd and the 5th address has the high order bit 
set,
you can to this in C, too. I would use a macro called HIGHBITON (x), for 
example,

which is coded as follows:

#define HIGHBITON(x)  (void *)((unsigned int)(x) ! 0x8000)

So we have


rc = THEFUNCTION (&magic, inputbuffer, HIGHBITON(&inputlength), NULL, NULL);


rc = THEFUNCTION (&magic, inputbuffer,&inputlength, outputbuffer, 
HIGHBITON(&outputlength));


The two additional NULL parameters after the 3rd address in the first 
case do no harm.


Kind regards

Bernd



Am 10.04.2012 23:11, schrieb Phil Smith:

Steve Comstock wrote:

Slipperier and slipperier. OK, let's try a different approach:
You tell me exactly what you want to see from the PL/I routine calling
your API and I'll see if I can cause PL/I to construct that.
In other words, your routine will see
(R1) ->  

rc = THEFUNCTION(magic,inputbuffer,inputlength)

(R1) ==>  A(magic),A(inputbuffer),A(inputlength)<== high bit set on the third 
fullword

OR (the fully specified case):

rc = THEFUNCTION(magic,inputbuffer,inputlength,outputbuffer,outputlength)

(R1) ==>  
A(magic),A(inputbuffer),A(inputlength),A(outputbuffer),A(outputlength)<== high bit 
set on the fifth fullword

Pretty standard, yes?

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



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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
Steve Comstock wrote:
>Slipperier and slipperier. OK, let's try a different approach:

>You tell me exactly what you want to see from the PL/I routine calling
>your API and I'll see if I can cause PL/I to construct that.

>In other words, your routine will see

>(R1) -> 

rc = THEFUNCTION(magic,inputbuffer,inputlength)

(R1) ==> A(magic),A(inputbuffer),A(inputlength) <== high bit set on the third 
fullword

OR (the fully specified case):

rc = THEFUNCTION(magic,inputbuffer,inputlength,outputbuffer,outputlength)

(R1) ==> A(magic),A(inputbuffer),A(inputlength),A(outputbuffer),A(outputlength) 
<== high bit set on the fifth fullword

Pretty standard, yes?

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Steve Comstock

On 4/10/2012 1:54 PM, Phil Smith wrote:

Steve Comstock wrote:

Yes. But that's Assembler. I thought the called routine
was C, and you were testing the parms passed in the C
routine. Is that not true? Are there more layers here?


Yes, there are lots of layers, it's a mixture of assembler and C, sorry. The 
point is, we're confident that the description of the behavior we've seen is as 
described (we have XDC, too, so can see some of it). it's very strange-as if 
nobody at IBM ever really tried to use variable plists with PL/I!



Slipperier and slipperier. OK, let's try a different approach:

You tell me exactly what you want to see from the PL/I routine calling
your API and I'll see if I can cause PL/I to construct that.

In other words, your routine will see

(R1) -> 



--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
Steve Comstock wrote:
> Yes. But that's Assembler. I thought the called routine
>was C, and you were testing the parms passed in the C
>routine. Is that not true? Are there more layers here?

Yes, there are lots of layers, it's a mixture of assembler and C, sorry. The 
point is, we're confident that the description of the behavior we've seen is as 
described (we have XDC, too, so can see some of it). it's very strange-as if 
nobody at IBM ever really tried to use variable plists with PL/I!

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Steve Comstock

On 4/10/2012 1:27 PM, Phil Smith wrote:

Steve Comstock wrote:

But I would like to see the code you use to test the high bit, please.
Nothing proprietary, just informative


OK, something like this:
  L R2,0(,R8)
  TM0(R8),X'80'
  BOLASTPARM

? Pretty basic...



Yes. But that's Assembler. I thought the called routine
was C, and you were testing the parms passed in the C
routine. Is that not true? Are there more layers here?


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
Steve Comstock wrote:
>But I would like to see the code you use to test the high bit, please.
>Nothing proprietary, just informative

OK, something like this:
 L R2,0(,R8)
 TM0(R8),X'80'
 BOLASTPARM

? Pretty basic...

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Steve Comstock

On 4/10/2012 12:44 PM, Phil Smith wrote:

Steve Comstock wrote:

re whether we'll expect customers to be running Enterprise PL/I:
And the answer is?


Oops...meant to answer this. Um...I guess "whatever's current" was my
assumption. Are the older compilers supported?


Some are. But there are, apparently, many customers running with
unsupported compilers. Some of the posts here have been pretty
incredibly about how old the software is.

But, we'll assume current Enterprise PL/I, then. Thanks.




Re our C prototype:


Do you really have the ellipsis? If so, my reading
of the docs is that all arguments after int  *inputLength,
will have to be of that type (that is, all pointers to
integer values) and not pointer to char followed by pointer
to int; of course, you can play games. But I think that
would be a problem.



Generally, the above C function will expect, when it is
called, to have R1 set up this way:



(R1) ->  a(magic)
   a(inputBuffer)
   a(inputLength)
   a(outputBuffer)
   a(outputLength)


That isn't the behavior we've observed.


Ah, that's why I asked about any pragma's you may have
and what compiler options you are setting in C

Generally, what I've show is true; however, in some cases
the actual first element in the list is the address of
where the function value will be returned. The docs are
a little ambiguous, so I'm trying to nail down the details.





So how, in your C code, do you currently check how
many arguments have been received?



This won't be hard, really, :-) , but we need to pay
attention to detail.


High-bit.


But I would like to see the code you use to test the high bit, please.
Nothing proprietary, just informative




What's weird to me is that PL/I and C share parts of
the same compiler logic! Ah well.


Indeed.





--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
Steve Comstock wrote:
>Umm... that doesn't show the COBOL call, nor the Assembler call
>those are what I was wanting to see, to compare them to your
>PL/I invocations

? COBOL is basically the same, don't have assembler handy but that's even 
easier:

call THEFUNCTION using inbuffer inlength inbuffer inlength returning rc


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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
Steve Comstock wrote:
>re whether we'll expect customers to be running Enterprise PL/I:
>And the answer is?

Oops...meant to answer this. Um...I guess "whatever's current" was my 
assumption. Are the older compilers supported?

Re our C prototype:

>Do you really have the ellipsis? If so, my reading
>of the docs is that all arguments after int  *inputLength,
>will have to be of that type (that is, all pointers to
>integer values) and not pointer to char followed by pointer
>to int; of course, you can play games. But I think that
>would be a problem.

>Generally, the above C function will expect, when it is
>called, to have R1 set up this way:

>(R1) -> a(magic)
>   a(inputBuffer)
>   a(inputLength)
>   a(outputBuffer)
>   a(outputLength)

That isn't the behavior we've observed.

>So how, in your C code, do you currently check how
>many arguments have been received?

>This won't be hard, really, :-) , but we need to pay
>attention to detail.

High-bit.

>What's weird to me is that PL/I and C share parts of
>the same compiler logic! Ah well.

Indeed.

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Steve Comstock

On 4/10/2012 12:33 PM, Phil Smith wrote:

OK, Steve, here's the previous post...thanks again!


Umm... that doesn't show the COBOL call, nor the Assembler call
those are what I was wanting to see, to compare them to your
PL/I invocations



From: Phil Smith
Sent: Tuesday, April 10, 2012 9:00 AM
To: ibm-main@bama.ua.edu
Subject: RE: Re: LE C calling HLASM

Steve Comstock wrote:

Ah, so that's what you want it for. But if the output buffer
length is zero, doesn't that tell you to use the input buffer?



And if an argument is omitted, it will appear as zero, right?
I mean, why else would you pass a buffer length of zero?


Because users make mistakes? I mean, we could do that, but it doesn't really 
solve the problem. We don't want to force them to type OMITTED - at that point 
they might as well code:
rc = THEFUNCTION(inbuffer, inlength, inbuffer, inlength);

What we want is to allow both:
rc = THEFUNCTION(inbuffer, inlength, outbuffer, outlength);
and
rc = THEFUNCTION(inbuffer, inlength); /* Works same as if inbuffer/inlength 
specified again as 3rd&  4th parameters */

as we can in COBOL. Or even in C, for that matter. I still find it hard to 
believe that PL/I can't do this!

Remember that LIST seemed like the answer, except that the high bit never got 
set on the last parameter. And then LINKAGE(SYSTEM) seemed like the answer, 
except that you can't specify that on a function call.

...phsiii (will it go 'round in circles...?)

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




--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
OK, Steve, here's the previous post...thanks again!

From: Phil Smith
Sent: Tuesday, April 10, 2012 9:00 AM
To: ibm-main@bama.ua.edu
Subject: RE: Re: LE C calling HLASM

Steve Comstock wrote:
>Ah, so that's what you want it for. But if the output buffer
>length is zero, doesn't that tell you to use the input buffer?

>And if an argument is omitted, it will appear as zero, right?
>I mean, why else would you pass a buffer length of zero?

Because users make mistakes? I mean, we could do that, but it doesn't really 
solve the problem. We don't want to force them to type OMITTED - at that point 
they might as well code:
   rc = THEFUNCTION(inbuffer, inlength, inbuffer, inlength);

What we want is to allow both:
   rc = THEFUNCTION(inbuffer, inlength, outbuffer, outlength);
and
   rc = THEFUNCTION(inbuffer, inlength); /* Works same as if inbuffer/inlength 
specified again as 3rd & 4th parameters */

as we can in COBOL. Or even in C, for that matter. I still find it hard to 
believe that PL/I can't do this!

Remember that LIST seemed like the answer, except that the high bit never got 
set on the last parameter. And then LINKAGE(SYSTEM) seemed like the answer, 
except that you can't specify that on a function call.

...phsiii (will it go 'round in circles...?)

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Steve Comstock

On 4/10/2012 11:15 AM, Frank Swarbrick wrote:

I only happened to learn PL/I this weekend,


Well I'm impressed!


so take this with a grain of salt,

but can't you activate THEFUNCTION with a call rather than as a function in
order to be able to use LINKAGE(SYSTEM)? And then use PLIRETV() in order to get
the return code?

1. Yes you can, theoretically, set this up as a procedure

2. And, yes, the call to PLIRETV should work (although in
   the literature it says for this to work the called
   program should have made a call to PLIRETC, the effect
   from the C function will probably match that)

3. But the problem he is concerned with: how to pass
   three parameters or five parameters and have the
   C function know which have been passed

   If he is counting on the end-of-list flag, then
   the C function must have something like

 #pragma linkage(thefunction,OS)

   but it's not clear if that is the case here

   That's why I wanted to see how he checks for the
   number of parms in his C code.


Also, to turn on the end-of-list flag, the call from
the PL/I program will have to have options(asm), so:

  call thefunction(magic, inbuff, inbufflen, outbuff, outbufflen) options(asm);

or

  call thefunction(magic, inbuff, inbufflen) options(asm);


Also note that if the subroutine were declared as a function,
then options(asm) is not allowed.




declare THEFUNCTION entry options(ASM RETCODE LINKAGE(SYSTEM));
(I think LINKAGE(SYSTEM) is redundant here.)


call THEFUNCTION(one, two, three);
display(pliretv());
call THEFUNCTION(one, two, three, four, five);
display(pliretv());

(Not sure if the declare entry requires the parms to be declared.)


Maybe you can even wrap the above into a PL/I function so that your PL/I 
programs can invoke it as a function.

Just a WAG.  Good luck!

Frank



- Original Message -

From: Phil Smith
To: IBM-MAIN@bama.ua.edu
Cc:
Sent: Tuesday, April 10, 2012 9:57 AM
Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)

Steve Comstock wrote:

I'm confused here, because the title of the thread
is 'C calling HLASM' and here we are talking about
PL/I.


Yeah, true...topic drift. Renamed.


So what's really going on here that is the mystery?



My guess is: you have a C function that you want to
call from, in this instance, a PL/I program. Right?


Right.


Can you show us the definition of the C function
(not the body, just the definition of parameters
along with any pragma statements you might have,
and compiler options relevant to calls / function
references)?


See below.


Can you show us how you invoke the function from
C, COBOL, and Assembler? That is, some sample calls
or function references that work successfully, both
with two arguments and four arguments (BTW: do you
allow the output buffer to be specified without the
last length argument? How about no output buffer
but with a length? In other words, must the user
specify exactly two or exactly four arguments?)


The previous post had an example from COBOL; C is the same, only in C syntax.
Assembler too. We validate that we got three or five arguments (note there's
an initial, required argument).


Finally: there are some differences in the Enterprise
PL/I compiler regarding compile time options and
options available for declaring functions and
subroutines so I ask this: is your expectation that
your customers will be running the Enterprise PL/I
compiler or some earlier compiler?


Here's a C prototype, with the serial numbers filed off:

int THEFUNCTION( char *magic,
  char *inputBuffer,
  int  *inputLength,
  ...)





--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Steve Comstock

On 4/10/2012 9:57 AM, Phil Smith wrote:

Steve Comstock wrote:

I'm confused here, because the title of the thread
is 'C calling HLASM' and here we are talking about
PL/I.


Yeah, true...topic drift. Renamed.


So what's really going on here that is the mystery?



My guess is: you have a C function that you want to
call from, in this instance, a PL/I program. Right?


Right.


Can you show us the definition of the C function
(not the body, just the definition of parameters
along with any pragma statements you might have,
and compiler options relevant to calls / function
references)?


See below.


Can you show us how you invoke the function from
C, COBOL, and Assembler? That is, some sample calls
or function references that work successfully, both
with two arguments and four arguments (BTW: do you
allow the output buffer to be specified without the
last length argument? How about no output buffer
but with a length? In other words, must the user
specify exactly two or exactly four arguments?)


The previous post had an example from COBOL; C is the same, only in C
syntax.Assembler too. We validate that we got three or five arguments
(note there's an initial, required argument).



Yeah, but I don't have the previous post. I'm trying
to get better about cleaning out my inbasket, and
sometimes I get overzealous.




Finally: there are some differences in the Enterprise
PL/I compiler regarding compile time options and
options available for declaring functions and
subroutines so I ask this: is your expectation that
your customers will be running the Enterprise PL/I
compiler or some earlier compiler?


And the answer is?





Here's a C prototype, with the serial numbers filed off:

int THEFUNCTION( char *magic,
  char *inputBuffer,
  int  *inputLength,
  ...)


Do you really have the ellipsis? If so, my reading
of the docs is that all arguments after int  *inputLength,
will have to be of that type (that is, all pointers to
integer values) and not pointer to char followed by pointer
to int; of course, you can play games. But I think that
would be a problem.

Generally, the above C function will expect, when it is
called, to have R1 set up this way:

(R1) -> a(magic)
a(inputBuffer)
a(inputLength)
a(outputBuffer)
a(outputLength)


So how, in your C code, do you currently check how
many arguments have been received?

This won't be hard, really, :-) , but we need to pay
attention to detail.

What's weird to me is that PL/I and C share parts of
the same compiler logic! Ah well.


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
Frank Swarbrick suggested using a CALL instead of a function.

I'll try that; I'm not sure it's an acceptable change to the usage, but thanks.

I'm off after today for surgery for a herniated disc, so might be a while.

Still find it hard to believe that PL/I makes this so hard!

...phsiii

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Frank Swarbrick
I only happened to learn PL/I this weekend, so take this with a grain of salt, 
but can't you activate THEFUNCTION with a call rather than as a function in 
order to be able to use LINKAGE(SYSTEM)?  And then use PLIRETV() in order to 
get the return code?

declare THEFUNCTION entry options(ASM RETCODE LINKAGE(SYSTEM));
(I think LINKAGE(SYSTEM) is redundant here.)


call THEFUNCTION(one, two, three);
display(pliretv());
call THEFUNCTION(one, two, three, four, five);
display(pliretv());

(Not sure if the declare entry requires the parms to be declared.)


Maybe you can even wrap the above into a PL/I function so that your PL/I 
programs can invoke it as a function.

Just a WAG.  Good luck!

Frank



- Original Message -
> From: Phil Smith 
> To: IBM-MAIN@bama.ua.edu
> Cc: 
> Sent: Tuesday, April 10, 2012 9:57 AM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Steve Comstock wrote:
>> I'm confused here, because the title of the thread
>> is 'C calling HLASM' and here we are talking about
>> PL/I.
> 
> Yeah, true...topic drift. Renamed.
> 
>> So what's really going on here that is the mystery?
> 
>> My guess is: you have a C function that you want to
>> call from, in this instance, a PL/I program. Right?
> 
> Right.
> 
>> Can you show us the definition of the C function
>> (not the body, just the definition of parameters
>> along with any pragma statements you might have,
>> and compiler options relevant to calls / function
>> references)?
> 
> See below.
> 
>> Can you show us how you invoke the function from
>> C, COBOL, and Assembler? That is, some sample calls
>> or function references that work successfully, both
>> with two arguments and four arguments (BTW: do you
>> allow the output buffer to be specified without the
>> last length argument? How about no output buffer
>> but with a length? In other words, must the user
>> specify exactly two or exactly four arguments?)
> 
> The previous post had an example from COBOL; C is the same, only in C syntax. 
> Assembler too. We validate that we got three or five arguments (note there's 
> an initial, required argument).
> 
>> Finally: there are some differences in the Enterprise
>> PL/I compiler regarding compile time options and
>> options available for declaring functions and
>> subroutines so I ask this: is your expectation that
>> your customers will be running the Enterprise PL/I
>> compiler or some earlier compiler?
> 
> Here's a C prototype, with the serial numbers filed off:
> 
> int THEFUNCTION( char *magic,
>              char *inputBuffer,
>              int  *inputLength,
>              ...)
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 

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


Re: LE C calling HLASM

2012-04-10 Thread Shmuel Metz (Seymour J.)
In <0363431161795505.wa.elardus.engelbrechtsita.co...@bama.ua.edu>, on
04/10/2012
   at 05:39 AM, Elardus Engelbrecht 
said:

>http://publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.ikjb300%2Fpack.htm

Yes. TSO/E also picked up up PCF.
 
-- 
 Shmuel (Seymour J.) Metz, SysProg and JOAT
 ISO position; see  
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

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


Re: PL/I with variable PLISTs (was: LE C calling HLASM)

2012-04-10 Thread Phil Smith
Steve Comstock wrote:
>I'm confused here, because the title of the thread
>is 'C calling HLASM' and here we are talking about
>PL/I.

Yeah, true...topic drift. Renamed.

>So what's really going on here that is the mystery?

>My guess is: you have a C function that you want to
>call from, in this instance, a PL/I program. Right?

Right.

>Can you show us the definition of the C function
>(not the body, just the definition of parameters
>along with any pragma statements you might have,
>and compiler options relevant to calls / function
>references)?

See below.

>Can you show us how you invoke the function from
>C, COBOL, and Assembler? That is, some sample calls
>or function references that work successfully, both
>with two arguments and four arguments (BTW: do you
>allow the output buffer to be specified without the
>last length argument? How about no output buffer
>but with a length? In other words, must the user
>specify exactly two or exactly four arguments?)

The previous post had an example from COBOL; C is the same, only in C syntax. 
Assembler too. We validate that we got three or five arguments (note there's an 
initial, required argument).

>Finally: there are some differences in the Enterprise
>PL/I compiler regarding compile time options and
>options available for declaring functions and
>subroutines so I ask this: is your expectation that
>your customers will be running the Enterprise PL/I
>compiler or some earlier compiler?

Here's a C prototype, with the serial numbers filed off:

int THEFUNCTION( char *magic,
 char *inputBuffer,
 int  *inputLength,
 ...)

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


Re: LE C calling HLASM

2012-04-10 Thread Steve Comstock

On 4/10/2012 7:00 AM, Phil Smith wrote:

Steve Comstock wrote:

Ah, so that's what you want it for. But if the output buffer
length is zero, doesn't that tell you to use the input buffer?



And if an argument is omitted, it will appear as zero, right?
I mean, why else would you pass a buffer length of zero?


Because users make mistakes? I mean, we could do that, but it doesn't really

solve the problem. We don't want to force them to type OMITTED - at that point
they might as well code:

rc = THEFUNCTION(inbuffer, inlength, inbuffer, inlength);

What we want is to allow both:
rc = THEFUNCTION(inbuffer, inlength, outbuffer, outlength);
and
rc = THEFUNCTION(inbuffer, inlength); /* Works same as if inbuffer/inlength 
specified again as 3rd&  4th parameters */

as we can in COBOL. Or even in C, for that matter. I still find it hard to 
believe that PL/I can't do this!

Remember that LIST seemed like the answer, except that the high bit never got 
set on the last parameter. And then LINKAGE(SYSTEM) seemed like the answer, 
except that you can't specify that on a function call.

...phsiii (will it go 'round in circles...?)


I'm confused here, because the title of the thread
is 'C calling HLASM' and here we are talking about
PL/I.

So what's really going on here that is the mystery?

My guess is: you have a C function that you want to
call from, in this instance, a PL/I program. Right?


Can you show us the definition of the C function
(not the body, just the definition of parameters
along with any pragma statements you might have,
and compiler options relevant to calls / function
references)?


Can you show us how you invoke the function from
C, COBOL, and Assembler? That is, some sample calls
or function references that work successfully, both
with two arguments and four arguments (BTW: do you
allow the output buffer to be specified without the
last length argument? How about no output buffer
but with a length? In other words, must the user
specify exactly two or exactly four arguments?)


Finally: there are some differences in the Enterprise
PL/I compiler regarding compile time options and
options available for declaring functions and
subroutines so I ask this: is your expectation that
your customers will be running the Enterprise PL/I
compiler or some earlier compiler?



--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: LE C calling HLASM

2012-04-10 Thread Phil Smith
Steve Comstock wrote:
>Ah, so that's what you want it for. But if the output buffer
>length is zero, doesn't that tell you to use the input buffer?

>And if an argument is omitted, it will appear as zero, right?
>I mean, why else would you pass a buffer length of zero?

Because users make mistakes? I mean, we could do that, but it doesn't really 
solve the problem. We don't want to force them to type OMITTED - at that point 
they might as well code:
   rc = THEFUNCTION(inbuffer, inlength, inbuffer, inlength);

What we want is to allow both:
   rc = THEFUNCTION(inbuffer, inlength, outbuffer, outlength);
and
   rc = THEFUNCTION(inbuffer, inlength); /* Works same as if inbuffer/inlength 
specified again as 3rd & 4th parameters */

as we can in COBOL. Or even in C, for that matter. I still find it hard to 
believe that PL/I can't do this!

Remember that LIST seemed like the answer, except that the high bit never got 
set on the last parameter. And then LINKAGE(SYSTEM) seemed like the answer, 
except that you can't specify that on a function call.

...phsiii (will it go 'round in circles...?)

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


Re: LE C calling HLASM

2012-04-10 Thread Steve Comstock

On 4/10/2012 5:58 AM, Phil Smith wrote:

Jan MOEYERSONS quoted the doc, then asked:

Is this not true then?


I know this has been a protracted thread, so I'll summarize: If I use LIST, I
can't use LINKAGE(SYSTEM), so it doesn't set the high bit. If

I use OMITTED, it passes a zero for that parameter, so I can't tell whether the
parameter was omitted or really passed as zero.


Our API is flexible: if you don't specify an output buffer& length, it uses

the input buffer& length. But that doesn't want to work in PL/I.




Ah, so that's what you want it for. But if the output buffer
length is zero, doesn't that tell you to use the input buffer?

And if an argument is omitted, it will appear as zero, right?
I mean, why else would you pass a buffer length of zero?


Ideas?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)




--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: LE C calling HLASM

2012-04-10 Thread Phil Smith
Jan MOEYERSONS quoted the doc, then asked:
>Is this not true then?

I know this has been a protracted thread, so I'll summarize:
If I use LIST, I can't use LINKAGE(SYSTEM), so it doesn't set the high bit. If 
I use OMITTED, it passes a zero for that parameter, so I can't tell whether the 
parameter was omitted or really passed as zero.

Our API is flexible: if you don't specify an output buffer & length, it uses 
the input buffer & length. But that doesn't want to work in PL/I.

Ideas?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)


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


Re: LE C calling HLASM

2012-04-10 Thread Elardus Engelbrecht
Shmuel Metz (Seymour J.) wrote:

>The original TMP ran unauthorized, including the TMP in SVS and OS/VS2 (MVS); 
>if you look at the COOKIE command, you will see that a nested TMP worked just 
>fine. As I recall, it was the TSO Command Package[1] that added the parallel 
>TMP structure that required authorization.

>[1] Swallowed by TSO/E when it came out.

Very interesting. 

Is this the thing you referred in:



http://publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.ikjb300%2Fpack.htm

Just curious if you don't mind please. :-D

Groete / Greetings
Elardus Engelbrecht

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


Re: LE C calling HLASM

2012-04-10 Thread Jan MOEYERSONS
On Fri, 6 Apr 2012 08:45:06 -0700, Phil Smith  wrote:

>Darn it, no matter what I've tried, I CANNOT get PL/I to handle a plist [what 
>I'd call] normally-marking the high bit on the last specified parameter. If I 
>use OPTIONAL, I get all the parameters, with zeroes for the ones that were 
>omitted. That's not right, because I can't tell whether they were omitted or 
>specified as zero.
>
>Ideas??

>From the FM (IBM PL/I for MVS & VM Programming Guide Release 1.1 Document 
>Number SC26-3113-01):

15.2.1 PL/I Parameter Passing Conventions
 
PL/I passes arguments using two methods:
 
   By passing the address of the arguments in the argument list
   By imbedding the arguments in the argument list
 
This section discusses the first method.  For information on the second method, 
see "Options BYVALUE" in topic 15.2.3.
 
When arguments are passed by address between PL/I routines, register 1 points 
to a list of addresses that is called an argument list.  Each address in the 
argument list occupies a fullword in storage.  The last fullword in the list 
must have its high-order bit turned on for the last argument address to be 
recognized.  If a function reference is used, the address of the returned value 
or its control block is passed as an implicit last argument.  In this 
situation, the 
implicit last argument is marked as the last argument, using the high-order bit 
flagging.
 
If no arguments are passed in a CALL statement, register 1 is set to zero.



Is this not true then?

Jantje.

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


Re: LE C calling HLASM

2012-04-09 Thread Shmuel Metz (Seymour J.)
In <4f804f4a.3070...@valley.net>, on 04/07/2012
   at 10:29 AM, Gerhard Postpischil  said:

>I ran into an analog of this trying to determine whether a  program
>is running under TSO - presence of TSO control blocks  does not
>indicate that the immediate caller was the TMP. IBM,  for whatever
>reason, disallowed multiple TMP invocation in MVS  (or perhaps SVS?),
>so these days one can just rely on the result  from EXTRACT.

If you're running under TSO, won't the length of the PLIST tell you
whether you were invoked directly by a command? Anything other than a
CPPL means a call.

The original TMP ran unauthorized, including the TMP in SVS and OS/VS2
(MVS); if you look at the COOKIE command, you will see that a nested
TMP worked just fine. As I recall, it was the TSO Command Package[1]
that added the parallel TMP structure that required authorization.

[1] Swallowed by TSO/E when it came out.
 
-- 
 Shmuel (Seymour J.) Metz, SysProg and JOAT
 ISO position; see  
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

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


Re: LE C calling HLASM

2012-04-07 Thread Gerhard Postpischil

On 4/6/2012 7:23 PM, Ken Brick wrote:

many years ago I needed to know, in DOS/VS, whether an assembler
routine was called from a PL/I or assembler module. I put in a
test to see if in DOS terms the weak extrn PLIMAIN was not 0.
Non zero meant a PL/I module was present.


This works for special cases, but not in general. For instance, 
consider a PL/I program calling ASM calling CoBOL calling ASM. 
The second ASM would incorrectly conclude it was called from PL/I.


I ran into an analog of this trying to determine whether a 
program is running under TSO - presence of TSO control blocks 
does not indicate that the immediate caller was the TMP. IBM, 
for whatever reason, disallowed multiple TMP invocation in MVS 
(or perhaps SVS?), so these days one can just rely on the result 
from EXTRACT.


Gerhard Postpischil
Bradford, VT

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


Re: LE C calling HLASM

2012-04-07 Thread Bernd Oppolzer

Maybe my misunderstanding is:

I'm assuming that I am called dynamically and not linked to the caller
(because at our site, we have ONLY dynamic calls).

Kind regards

Bernd



Am 07.04.2012 09:40, schrieb Bernd Oppolzer:

How do you do this at runtime in a fast way?

I would first walk up the save area, get the entry point address of the
caller and look if there is the LE signature at position 4 (X'01' 
followed

by 'CEE'), so I know that is is a PL/1 or C compiler (maybe COBOL, too,
I'm not sure about this). Then I could examine the PPA1, where the 
name of
the function is stored. But, IMHO, to get the information about the 
compiler

(and the language, and the version, etc.), I have to read the IDR records
of the load module, isn't it?

The old PL/1 compilers start with STM at the entry point and have the
name of the CSECT immediately before the EP.

Kind regards

Bernd




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


Re: LE C calling HLASM

2012-04-07 Thread Bernd Oppolzer

How do you do this at runtime in a fast way?

I would first walk up the save area, get the entry point address of the
caller and look if there is the LE signature at position 4 (X'01' followed
by 'CEE'), so I know that is is a PL/1 or C compiler (maybe COBOL, too,
I'm not sure about this). Then I could examine the PPA1, where the name of
the function is stored. But, IMHO, to get the information about the compiler
(and the language, and the version, etc.), I have to read the IDR records
of the load module, isn't it?

The old PL/1 compilers start with STM at the entry point and have the
name of the CSECT immediately before the EP.

Kind regards

Bernd



Am 07.04.2012 01:30, schrieb Steve Comstock:

On 4/6/2012 5:23 PM, Ken Brick wrote:
many years ago I needed to know, in DOS/VS, whether an assembler 
routine was
called from a PL/I or assembler module. I put in a test to see if in 
DOS terms
the weak extrn PLIMAIN was not 0. Non zero meant a PL/I module was 
present.


Ken

On 7/04/2012 03:46 AM, Phil Smith wrote:
Is there a reliable way to tell we were called by PL/I? If so, we 
could ignore
zeroes for PL/I. And document it. ISTR there being a magic fullword 
in the

savearea for PL/I?




Well, you could maybe do the same thing about the
PL/I LE signature CSECT, CEESG011.




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


Re: LE C calling HLASM

2012-04-06 Thread Steve Comstock

On 4/6/2012 5:23 PM, Ken Brick wrote:

many years ago I needed to know, in DOS/VS, whether an assembler routine was
called from a PL/I or assembler module. I put in a test to see if in DOS terms
the weak extrn PLIMAIN was not 0. Non zero meant a PL/I module was present.

Ken

On 7/04/2012 03:46 AM, Phil Smith wrote:

Is there a reliable way to tell we were called by PL/I? If so, we could ignore
zeroes for PL/I. And document it. ISTR there being a magic fullword in the
savearea for PL/I?




Well, you could maybe do the same thing about the
PL/I LE signature CSECT, CEESG011.


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: LE C calling HLASM

2012-04-06 Thread Ken Brick
many years ago I needed to know, in DOS/VS, whether an assembler routine 
was called from a PL/I or assembler module. I put in a test to see if  
in DOS terms the weak extrn PLIMAIN was not 0. Non zero meant a PL/I 
module was present.


Ken

On 7/04/2012 03:46 AM, Phil Smith wrote:

Is there a reliable way to tell we were called by PL/I? If so, we could ignore 
zeroes for PL/I. And document it. ISTR there being a magic fullword in the 
savearea for PL/I?


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



--
Ken

Mob: 0409 009 764

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


Re: LE C calling HLASM

2012-04-06 Thread Phil Smith
Is there a reliable way to tell we were called by PL/I? If so, we could ignore 
zeroes for PL/I. And document it. ISTR there being a magic fullword in the 
savearea for PL/I?


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


Re: LE C calling HLASM

2012-04-06 Thread Sam Siegel
On Fri, Apr 6, 2012 at 9:02 AM, Steve Comstock wrote:

> On 4/6/2012 9:53 AM, Sam Siegel wrote:
>
>> On Fri, Apr 6, 2012 at 8:45 AM, Phil Smith  wrote:
>>
>>  Darn it, no matter what I've tried, I CANNOT get PL/I to handle a plist
>>> [what I'd call] normally-marking the high bit on the last specified
>>> parameter. If I use OPTIONAL, I get all the parameters, with zeroes for
>>> the
>>> ones that were omitted. That's not right, because I can't tell whether
>>> they
>>> were omitted or specified as zero.
>>>
>>> Ideas??
>>>
>>>
>> When using OPTIONAL, isn't the address in the parmlist set to zero instead
>> of a valid address?  Said differently, if the address in the parmlist is
>> zero, the associated parameter is not available.
>>
>
> But his dilema is that in C data itself may be passed in the parmlist; now
> the dilema: is a pointer of zeros (address of parm is NULL) an indicator
> of an omitted argument or a deliberate pass of a value of zeros. There
> is no magic way for anyone to know: you have to establish conventions
> and protocols to make these distinctions. And with the latest compilers
> this conundrum exists in Assembler, COBOL, PL/I and C.
>


True - I missed that point.  Thanks for the correction.


>
>
> Adding flexibility always comes at a price of added complexity or
> potential ambiguity (or both), right?
>
>
>
>
>>
>>
>>  --
>>> ...phsiii
>>>
>>> Phil Smith III
>>> p...@voltage.com
>>> Voltage Security, Inc.
>>> www.voltage.com>
>>> (703) 476-4511 (home office)
>>> (703) 568-6662 (cell)
>>>
>>>
>>> --**--**
>>> --
>>> For IBM-MAIN subscribe / signoff / archive access instructions,
>>> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
>>>
>>>
>> --**--**
>> --
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
>>
>>
>
> --
>
> Kind regards,
>
> -Steve Comstock
> The Trainer's Friend, Inc.
>
> 303-355-2752
> http://www.trainersfriend.com
>
> * To get a good Return on your Investment, first make an investment!
>  + Training your people is an excellent investment
>
> * Try our tool for calculating your Return On Investment
>for training dollars at
>  
> http://www.trainersfriend.com/**ROI/roi.html
>
>
> --**--**--
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
>

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


Re: LE C calling HLASM

2012-04-06 Thread Steve Comstock

On 4/6/2012 9:53 AM, Sam Siegel wrote:

On Fri, Apr 6, 2012 at 8:45 AM, Phil Smith  wrote:


Darn it, no matter what I've tried, I CANNOT get PL/I to handle a plist
[what I'd call] normally-marking the high bit on the last specified
parameter. If I use OPTIONAL, I get all the parameters, with zeroes for the
ones that were omitted. That's not right, because I can't tell whether they
were omitted or specified as zero.

Ideas??



When using OPTIONAL, isn't the address in the parmlist set to zero instead
of a valid address?  Said differently, if the address in the parmlist is
zero, the associated parameter is not available.


But his dilema is that in C data itself may be passed in the parmlist; now
the dilema: is a pointer of zeros (address of parm is NULL) an indicator
of an omitted argument or a deliberate pass of a value of zeros. There
is no magic way for anyone to know: you have to establish conventions
and protocols to make these distinctions. And with the latest compilers
this conundrum exists in Assembler, COBOL, PL/I and C.


Adding flexibility always comes at a price of added complexity or
potential ambiguity (or both), right?







--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)


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



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




--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: LE C calling HLASM

2012-04-06 Thread Sam Siegel
On Fri, Apr 6, 2012 at 8:45 AM, Phil Smith  wrote:

> Darn it, no matter what I've tried, I CANNOT get PL/I to handle a plist
> [what I'd call] normally-marking the high bit on the last specified
> parameter. If I use OPTIONAL, I get all the parameters, with zeroes for the
> ones that were omitted. That's not right, because I can't tell whether they
> were omitted or specified as zero.
>
> Ideas??
>

When using OPTIONAL, isn't the address in the parmlist set to zero instead
of a valid address?  Said differently, if the address in the parmlist is
zero, the associated parameter is not available.



> --
> ...phsiii
>
> Phil Smith III
> p...@voltage.com
> Voltage Security, Inc.
> www.voltage.com
> (703) 476-4511 (home office)
> (703) 568-6662 (cell)
>
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
>

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


Re: LE C calling HLASM

2012-04-06 Thread Phil Smith
Darn it, no matter what I've tried, I CANNOT get PL/I to handle a plist [what 
I'd call] normally-marking the high bit on the last specified parameter. If I 
use OPTIONAL, I get all the parameters, with zeroes for the ones that were 
omitted. That's not right, because I can't tell whether they were omitted or 
specified as zero.

Ideas??
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)


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


Re: LE C calling HLASM

2012-03-30 Thread Phil Smith
Steve Comstock wrote:
> Well, Phil, one way is to use the built in functions I mentioned
>in one of my posts:


Sure, but this is a general API, not PL/I-specific, so I can't use . Seems hard 
to believe PL/I can't be teased into making this work.

Tinkering with OPTIONAL option now...
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)


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


Re: LE C calling HLASM

2012-03-30 Thread Steve Comstock

On 3/30/2012 2:01 PM, Phil Smith wrote:

Steve Comstock made some helpful suggestions; my big problem was having a comma before 
the "LIST" keyword. Making progress but not there yet.

So now I have:
   Declare MYFUNC  External('MYFUNC') Entry(
Char(*) byaddr,
Char(*) byaddr,
Fixed Bin(31) byaddr
list
   )
   returns( byvalue Fixed Bin(31) )
   options ( nodescriptor );

So that compiles and runs, BUT it appears not to be setting the high bit on
the last parameter. So if I issue:
   rc = MYFUNC(parm1,
input,
inputLength,
output,
outputLength,
error);

I get RC=0 and the input has been processed to the output as expected.

But if instead I issue:
   rc = MYFUNC(parm1,
input,
inputLength);

which works from COBOL, the function should put the output in the input

buffer. It doesn't: if I make the "short form" call first, it complains that the
output length is too long. If I make the "long form" call first, then reset the
output buffer to a known value and issue the "short form" call, I get RC=0 *and
the output buffer has been updated as if I'd specified it*. That made me think
the old parameter value is lying around in the work PLIST used by the compiler,
and the high bit isn't getting set.


Ah HAH, sez I, after searching for "high-order bit": LINKAGE(SYSTEM) is what I 
need! Nope:
IBM2019I S   9.1Unsupported LINKAGE used with the LIST attribute.

So if you can't use LIST with LINKAGE(SYSTEM), how is the called routine 
supposed to know the end of the plist?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)


Well, Phil, one way is to use the built in functions I mentioned
in one of my posts:

  The address of the first of these additional parameters may
  be obtained via the VARGLIST built-in function. This address
  may be used to obtain the addresses of any additional parameters as follows:

  * if the additional parameters to this procedure were passed BYVALUE,
successively incrementing this initial address by the value returned
by the VARGSIZE built-in function will return the addresses of any
additional parameters

  * if the additional parameters to this procedure were passed byaddr,
successively incrementing this initial address by the size of a
pointer will return the addresses of any additional parameters


so you could use VARGLIST and VARGSIZE

Another option is to have one of your entries in the
variable list contain a reserved end-of-list value
(typically f'-1' or f'0')

another option is to have your first entry in the
variable part of the list be a count of how many
additional parameters are being passed this time.





--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: LE C calling HLASM

2012-03-30 Thread Phil Smith
Steve Comstock made some helpful suggestions; my big problem was having a comma 
before the "LIST" keyword. Making progress but not there yet.

So now I have:
  Declare MYFUNC  External('MYFUNC') Entry(
   Char(*) byaddr,
   Char(*) byaddr,
   Fixed Bin(31) byaddr
   list
  )
  returns( byvalue Fixed Bin(31) )
  options ( nodescriptor );

So that compiles and runs, BUT it appears not to be setting the high bit on the 
last parameter. So if I issue:
  rc = MYFUNC(parm1,
   input,
   inputLength,
   output,
   outputLength,
   error);

I get RC=0 and the input has been processed to the output as expected.

But if instead I issue:
  rc = MYFUNC(parm1,
   input,
   inputLength);

which works from COBOL, the function should put the output in the input buffer. 
It doesn't: if I make the "short form" call first, it complains that the output 
length is too long. If I make the "long form" call first, then reset the output 
buffer to a known value and issue the "short form" call, I get RC=0 *and the 
output buffer has been updated as if I'd specified it*. That made me think the 
old parameter value is lying around in the work PLIST used by the compiler, and 
the high bit isn't getting set.

Ah HAH, sez I, after searching for "high-order bit": LINKAGE(SYSTEM) is what I 
need! Nope:
IBM2019I S   9.1Unsupported LINKAGE used with the LIST attribute.

So if you can't use LIST with LINKAGE(SYSTEM), how is the called routine 
supposed to know the end of the plist?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)


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


Re: LE C calling HLASM

2012-03-30 Thread Steve Comstock

On 3/28/2012 11:54 AM, Phil Smith wrote:

Steve Comstock wrote:
On 3/23/2012 2:57 PM, Phil Smith wrote:

Now for the next question: this allows us to implement variable
parameterlists in C, by declaring the functions thus:
int SOMEFUNCTION(char *someparm, ...); >
Is there an equivalent way to do this in PL/I?



In the declare of the subroutine, specify the word LIST in the last
argument descriptor, for example:



dcl avgyx entry (fixed bin(31),
  fixed decimal(7,2) optional,
  char (8),
  list byaddr)
  options(asm);



This indicates there are zero or more arguments from the point
of the LIST



Then, in the invocation, pass at least as many arguments as
arguments before the word LIST and any others you want:



call avgyx (test_no,
   weight,
   test_name,
   rand_var,
   score_low,
   score_high);


Hm. This isn't quite working:

Declare THEFN  External('THEFN') Entry(
  Char(*) byaddr,
  Char(*) byaddr,
  Fixed Bin(31) byaddr,
  Char(*) byaddr,
  Fixed Bin(31) byaddr,
  Char(*) byaddr
 )
 returns( byvalue Fixed Bin(31) )
 options ( nodescriptor );


Where's the word 'list'? That wasn't a variable name,
it's a required operand to get a variable number of
parameters. It's hard to say from your fragment, but
maybe something like:

Declare THEFN  External('THEFN') Entry(
 Char(*) byaddr,
 Char(*) byaddr,
 Fixed Bin(31) byaddr,
 Char(*) byaddr,
 Fixed Bin(31) byaddr,
 Char(*) byaddr list
)
returns( byvalue Fixed Bin(31) )
options ( nodescriptor );



On compile, this gets RC=4 and:
IBM1214I W  35.0A dummy argument will be created for argument number
 4 in entry reference VSHPROT.

Then it linkedits OK but gets a ABENDU4038 on run. This differs from your

recommendation by being an EXTERNAL function; I had to use NODESCRIPTOR because
ASM isn't supported for functions, apparently.

Yes; there is some more information, from the PL/I language reference:

  When the LIST attribute is specified, no descriptors are
  allowed, and OPTIONS(NODESCRIPTOR) must be specified on
  its PROCEDURE statement and on its corresponding ENTRY
  declaration.

  The address of the first of these additional parameters may
  be obtained via the VARGLIST built-in function. This address
  may be used to obtain the addresses of any additional parameters as follows:

  * if the additional parameters to this procedure were passed BYVALUE,
successively incrementing this initial address by the value returned
by the VARGSIZE built-in function will return the addresses of any
additional parameters

  * if the additional parameters to this procedure were passed byaddr,
successively incrementing this initial address by the size of a
pointer will return the addresses of any additional parameters



Ideas?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)

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




--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: LE C calling HLASM

2012-03-28 Thread Phil Smith
Steve Comstock wrote:
On 3/23/2012 2:57 PM, Phil Smith wrote:
>>Now for the next question: this allows us to implement variable parameter 
>>lists in C, by declaring the functions thus:
>>int SOMEFUNCTION(char *someparm, ...);

>>Is there an equivalent way to do this in PL/I?

>In the declare of the subroutine, specify the word LIST in the last
>argument descriptor, for example:

>dcl avgyx entry (fixed bin(31),
>  fixed decimal(7,2) optional,
>  char (8),
>  list byaddr)
>  options(asm);

>This indicates there are zero or more arguments from the point
>of the LIST

>Then, in the invocation, pass at least as many arguments as
>arguments before the word LIST and any others you want:

>call avgyx (test_no,
>   weight,
>   test_name,
>   rand_var,
>   score_low,
>   score_high);

Hm. This isn't quite working:

Declare THEFN  External('THEFN') Entry(
 Char(*) byaddr,
 Char(*) byaddr,
 Fixed Bin(31) byaddr,
 Char(*) byaddr,
 Fixed Bin(31) byaddr,
 Char(*) byaddr
)
returns( byvalue Fixed Bin(31) )
options ( nodescriptor );

On compile, this gets RC=4 and:
IBM1214I W  35.0A dummy argument will be created for argument number
4 in entry reference VSHPROT. 

Then it linkedits OK but gets a ABENDU4038 on run. This differs from your 
recommendation by being an EXTERNAL function; I had to use NODESCRIPTOR because 
ASM isn't supported for functions, apparently.

Ideas?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)

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


Re: LE C calling HLASM

2012-03-25 Thread Shmuel Metz (Seymour J.)
In
,
on 03/23/2012
   at 04:55 PM, John Gilmore  said:

>o to invoke the HLASM from PL/I using PL/I descriptors,

I did that with F and "optimizing", but don't know where to find
mapping macros for file descriptors and control blocks in Enterprise
PL/I.

Do the LE macros for conditions work with PL/I?
 
-- 
 Shmuel (Seymour J.) Metz, SysProg and JOAT
 ISO position; see  
We don't care. We don't have to care, we're Congress.
(S877: The Shut up and Eat Your spam act of 2003)

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


Re: LE C calling HLASM

2012-03-23 Thread John Gilmore
There are several ways to do what you want to do in PL/I, among them
the ways Steve Comstock suggests.  I personally prefer

o to invoke the HLASM from PL/I using PL/I descriptors, which are easy
to work with in assembly language, and

o to invoke PL/I from the HLASM using the PL/I descriptors that a PL/I
routine expects when it is invoked from another PL/I routine,

i.e., to avoid any use of options(asm) anywhere.

Descriptors are your friends; they provide generality and power; and
they are what generated PL/I code expects to work with.

John Gilmore, Ashland, MA 01721 - USA

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


Re: LE C calling HLASM

2012-03-23 Thread Steve Comstock

On 3/23/2012 2:57 PM, Phil Smith wrote:

Thanks. The #pragma was the answer. We had tried that but thought it wasn't 
working for some reason.

Now for the next question: this allows us to implement variable parameter lists 
in C, by declaring the functions thus:
int SOMEFUNCTION(char *someparm, ...);

Is there an equivalent way to do this in PL/I?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com



Yes.

In the declare of the subroutine, specify the word LIST in the last
argument descriptor, for example:

dcl avgyx entry (fixed bin(31),
   fixed decimal(7,2) optional,
   char (8),
   list byaddr)
   options(asm);

This indicates there are zero or more arguments from the point
of the LIST


Then, in the invocation, pass at least as many arguments as
arguments before the word LIST and any others you want:

call avgyx (test_no,
weight,
test_name,
rand_var,
score_low,
score_high);



Again, this is from our course "Cross Program Communication in z/OS"
see http://www.trainersfriend.com/Language_Environment_courses/m520descr.htm
for details of the course.



--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: LE C calling HLASM

2012-03-23 Thread Phil Smith
Thanks. The #pragma was the answer. We had tried that but thought it wasn't 
working for some reason.

Now for the next question: this allows us to implement variable parameter lists 
in C, by declaring the functions thus:
int SOMEFUNCTION(char *someparm, ...);

Is there an equivalent way to do this in PL/I?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com


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


Re: LE C calling HLASM

2012-03-23 Thread Steve Comstock

On 3/23/2012 1:16 PM, Phil Smith wrote:

When writing an LC C program that calls an HLASM function, the last element
of

the parameter list does not have the high-order bit set. Is there an option to
force it to do so? We can't seem to find one?!

--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)



Simplist is to include something like:

#pragma linkage(sub_name,OS)


This, and a lot more, is covered in our course
"Cross Program Communication in z/OS"
 (see http://www.trainersfriend.com/Language_Environment_courses/m520descr.htm )


Alternatively, you can use

#pragma runopts(PLIST(OS))

and work with the __osplist macro

This, and a lot more, is covered in our course
"Introduction to TSO and REXX APIs"
  (see http://www.trainersfriend.com/TSO_Clist_REXX_Dialog_Mgr/a780descrpt.htm )




--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

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


Re: LE C calling HLASM

2012-03-23 Thread Sam Siegel
Look at #pragma linkage.   Use linkage OS.  You will get a list of addresses 
w/HO bit set on the last address
Sent from my Verizon Wireless BlackBerry

-Original Message-
From: Phil Smith 
Sender: IBM Mainframe Discussion List 
Date: Fri, 23 Mar 2012 12:16:09 
To: 
Reply-To: IBM Mainframe Discussion List 
Subject: LE C calling HLASM

When writing an LC C program that calls an HLASM function, the last element of 
the parameter list does not have the high-order bit set. Is there an option to 
force it to do so? We can't seem to find one?!
--
...phsiii

Phil Smith III
p...@voltage.com<mailto:p...@voltage.com>
Voltage Security, Inc.
www.voltage.com<http://www.voltage.com>
(703) 476-4511 (home office)
(703) 568-6662 (cell)


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

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


Re: LE C calling HLASM

2012-03-23 Thread McKown, John
Not really. As best as I can tell, the C calling sequence is __horrible__. Too 
much is "call by value". Variable length argument lists are accessed via the 
"va_args" functions. Try reading here:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ccrug130/3.67
Have you looked at Metal C?
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ccrug130/1.2
It uses "standard z/OS linkage conventions". You might also look at "#pragma 
linkage"
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/cbclr1a0/18.5.24
but it doesn't say that it sets the high order bit on.

--
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * 
john.mck...@healthmarkets.com * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

 

> -Original Message-
> From: IBM Mainframe Discussion List 
> [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of Phil Smith
> Sent: Friday, March 23, 2012 2:16 PM
> To: IBM-MAIN@bama.ua.edu
> Subject: LE C calling HLASM
> 
> When writing an LC C program that calls an HLASM function, 
> the last element of the parameter list does not have the 
> high-order bit set. Is there an option to force it to do so? 
> We can't seem to find one?!
> --
> ...phsiii
> 
> Phil Smith III
> p...@voltage.com<mailto:p...@voltage.com>
> Voltage Security, Inc.
> www.voltage.com<http://www.voltage.com>
> (703) 476-4511 (home office)
> (703) 568-6662 (cell)
> 
> 
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
> 
> 

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


Re: LE C calling HLASM

2012-03-23 Thread Don Poitras
#pragma linkage(identifier, OS)


In article  
you wrote:
> When writing an LC C program that calls an HLASM function, the last element 
> of the parameter list does not have the high-order bit set. Is there an 
> option to force it to do so? We can't seem to find one?!
> --
> ...phsiii

> Phil Smith III
> p...@voltage.com
> Voltage Security, Inc.
> www.voltage.com
> (703) 476-4511 (home office)
> (703) 568-6662 (cell)

-- 
Don Poitras - SAS Development  -  SAS Institute Inc. - SAS Campus Drive
sas...@sas.com   (919) 531-5637Cary, NC 27513

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


LE C calling HLASM

2012-03-23 Thread Phil Smith
When writing an LC C program that calls an HLASM function, the last element of 
the parameter list does not have the high-order bit set. Is there an option to 
force it to do so? We can't seem to find one?!
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)


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