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: 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: 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