Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-28 Thread Peter Relson
Allowing reentrant programs to be writable for fetches from 
non-APF-authorized data sets / concatenations was something that had to be 
maintained for compatibility, but was not felt to have sufficient 
justification to accommodate for "new cases".

"New cases" include loads via BPX1LOD and loads in a task that was 
attached with KEY=NINE.
Those cases do not care about the APF state of the data set / 
concatenation when determining the subpool.

The newer of those "new cases" is almost 20 years old now.

Peter Relson
z/OS Core Technology Design


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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-27 Thread Jesse 1 Robinson
Around 1980 when I first got into Systems, I was given an assembler program 
that processed SMF data. One particular record type had changed recently: the 
offset of some data of interest had shifted. The previous program owner had 
chosen to accommodate this change by checking some upfront flag to determine 
format. If new format, alter some MVC instructions accordingly (!), otherwise 
run as originally written. I was scandalized. It worked but violated most every 
principle I had adopted as an application programmer. My first action was to 
impose civility on the program. Sheesh.   

.
.
J.O.Skip Robinson
Southern California Edison Company
Electric Dragon Team Paddler 
SHARE MVS Program Co-Manager
323-715-0595 Mobile
626-543-6132 Office ⇐=== NEW
robin...@sce.com


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Seymour J Metz
Sent: Sunday, May 27, 2018 11:05 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: (External):Re: How to get BPX loadhfs (BPX1LOD) to load module into 
writable memory?

There's the definition of reentrant and then there's the handling of the RENT 
option in various contexts. Don't expect the Binder to be consistent with the 
Linkage Editor, or that the behavior of load modules, program objects and Unix 
files will be consistent. But it would be nice if IBM ever disentangled the 
mess.

BTW, I consider it bad form for code to modify itself, even if it is in fact 
reentrant or refreshable.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List  on behalf of 
Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu>
Sent: Friday, May 25, 2018 7:49 PM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable 
memory?

On Fri, 25 May 2018 22:23:09 +0200, Peter Hunkeler wrote:

>>> What was Peter H. (informally?) quoting without citation?
> >
>>In: z/OS  IBM MVS Program Management: User's Guide and Reference 
>>Version 2 Release 3  SA23-1393-30
>
>Re-read my post and you will find my citation. I admit I missed the word 
>"Reference" and I did not include the pubs number. I thought it would be 
>understood, nevertheless. It seems, not. I'm sorry for the confusion this may 
>have caused.
>
OK.  You posted from "Glossary" (which I hadn't noticed):
reenterable
The reusability attribute that allows a program to be used concurrently by 
more
than one task. A reenterable module can modify its own data or other shared
resources, if appropriate serialization is in place to prevent interference 
between
using tasks. See reusability.
>
That's how I recall the behavior from decades ago.  But it appears to be 
contradicted, at least in spirit, by the "options reference":

On Fri, 25 May 2018 13:23:58 -0500, Paul Gilmartin wrote:

>On Tue, 22 May 2018 15:27:32 -0400, Thomas David Rivers wrote:
>
>>The BPX loadhfs function (BPX1LOD) loads an HFS executable into 
>>memory.
>>
>>It seems, that sometimes, this is loaded into writable memory and 
>>sometimes into read-only memory.
>>
>>There doesn't seem to be a way to indicate which is desired.. is there 
>>some OS-interface that writable memory be used?
>>
>What was Peter H. (informally?) quoting without citation?
>
>In: z/OS  IBM MVS Program Management: User's Guide and Reference 
>Version 2 Release 3  SA23-1393-30
>
>Chapter 6. Binder options reference
>Binder options
>REUS: Reusability options`
>RENT
>The module is reenterable. It can be executed by more than one
>task at a time. A task can begin executing it before a previous
>task has completed execution. A reenterable module is ordinarily
>expected not to modify its own code. In some cases, MVS protects
>the reentrant module's virtual storage so that it cannot be
>modified except by a program running in key 0. These cases
>include programs which the system treats as having been loaded
>from an authorized library, and also programs running under UNIX
>unless a debugging environment has been specified.
>
>Reenterable modules are also serially reusable.
>
>So, WAD.
>
>I dislike some things about this:
>
>o "include" is undesirably vague.  The Ref. should specify exactly
>  the cases in which ... programs are [so] treated.  A precise "are"
>  is preferable to the imprecise "include".  What other cases may
>  there be?  "[T]reats as having been ..." is likewise vague.  Provide
>  at least a citation of an explanation of what this means.
>
>o Simpler Is Better.  I see no good reason to treat "programs running
>  under UNIX" differently from other programs.
>
>o "ordinarily expected".  Is this a retreat from the earlier well-known
>  rule (cited by Peter) that a RENT program was allowed to modify its
>  own code given proper serialization?

-- gil


--
For IBM-MAIN 

Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-27 Thread Seymour J Metz
There's the definition of reentrant and then there's the handling of the RENT 
option in various contexts. Don't expect the Binder to be consistent with the 
Linkage Editor, or that the behavior of load modules, program objects and Unix 
files will be consistent. But it would be nice if IBM ever disentangled the 
mess.

BTW, I consider it bad form for code to modify itself, even if it is in fact 
reentrant or refreshable.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List  on behalf of 
Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu>
Sent: Friday, May 25, 2018 7:49 PM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable 
memory?

On Fri, 25 May 2018 22:23:09 +0200, Peter Hunkeler wrote:

>>> What was Peter H. (informally?) quoting without citation?
> >
>>In: z/OS  IBM MVS Program Management: User's Guide and Reference
>>Version 2 Release 3  SA23-1393-30
>
>Re-read my post and you will find my citation. I admit I missed the word 
>"Reference" and I did not include the pubs number. I thought it would be 
>understood, nevertheless. It seems, not. I'm sorry for the confusion this may 
>have caused.
>
OK.  You posted from "Glossary" (which I hadn't noticed):
reenterable
The reusability attribute that allows a program to be used concurrently by 
more
than one task. A reenterable module can modify its own data or other shared
resources, if appropriate serialization is in place to prevent interference 
between
using tasks. See reusability.
>
That's how I recall the behavior from decades ago.  But it appears to be 
contradicted,
at least in spirit, by the "options reference":

On Fri, 25 May 2018 13:23:58 -0500, Paul Gilmartin wrote:

>On Tue, 22 May 2018 15:27:32 -0400, Thomas David Rivers wrote:
>
>>The BPX loadhfs function (BPX1LOD) loads an HFS executable
>>into memory.
>>
>>It seems, that sometimes, this is loaded into writable memory
>>and sometimes into read-only memory.
>>
>>There doesn't seem to be a way to indicate which is desired.. is there
>>some OS-interface that writable memory be used?
>>
>What was Peter H. (informally?) quoting without citation?
>
>In: z/OS  IBM MVS Program Management: User's Guide and Reference
>Version 2 Release 3  SA23-1393-30
>
>Chapter 6. Binder options reference
>Binder options
>REUS: Reusability options`
>RENT
>The module is reenterable. It can be executed by more than one
>task at a time. A task can begin executing it before a previous
>task has completed execution. A reenterable module is ordinarily
>expected not to modify its own code. In some cases, MVS protects
>the reentrant module's virtual storage so that it cannot be
>modified except by a program running in key 0. These cases
>include programs which the system treats as having been loaded
>from an authorized library, and also programs running under UNIX
>unless a debugging environment has been specified.
>
>Reenterable modules are also serially reusable.
>
>So, WAD.
>
>I dislike some things about this:
>
>o "include" is undesirably vague.  The Ref. should specify exactly
>  the cases in which ... programs are [so] treated.  A precise "are"
>  is preferable to the imprecise "include".  What other cases may
>  there be?  "[T]reats as having been ..." is likewise vague.  Provide
>  at least a citation of an explanation of what this means.
>
>o Simpler Is Better.  I see no good reason to treat "programs running
>  under UNIX" differently from other programs.
>
>o "ordinarily expected".  Is this a retreat from the earlier well-known
>  rule (cited by Peter) that a RENT program was allowed to modify its
>  own code given proper serialization?

-- gil

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

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-26 Thread Lizette Koehler
Peter

>From the first email

I'd like to use loadhfs() to bring a module from the HFS into my
program, but in writable memory.

Hope that helps


> -Original Message-
> From: IBM Mainframe Discussion List  On Behalf Of
> Peter Relson
> Sent: Saturday, May 26, 2018 6:27 AM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable
> memory?
> 
> I might have missed it, but was there a reason given why the OP wanted to get
> the reentrant module into writable memory?
> 
> But to answer the question: no there is no interface to change the decision.
> You can only change the attributes of the module (reentrant) or your
> environment (APF authorization for LOAD, but that is not relevant for
> BPX1LOD).
> 
> As has been noted, if the system has identified a particular debug mode, the
> system can factor that in.
> 
> Peter Relson
> z/OS Core Technology Design   

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-26 Thread Peter Relson
I might have missed it, but was there a reason given why the OP wanted to 
get the reentrant module into writable memory?

But to answer the question: no there is no interface to change the 
decision. You can only change the attributes of the module (reentrant) or 
your environment (APF authorization for LOAD, but that is not relevant for 
BPX1LOD).

As has been noted, if the system has identified a particular debug mode, 
the system can factor that in.

Peter Relson
z/OS Core Technology Design


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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-26 Thread Peter Hunkeler
>OK.  You posted from "Glossary" (which I hadn't noticed):


No, I did not. The paragraph I posted is from chapter 2 "Creating programs from 
source modules", topic "Module reusability", page 30.


I was looking up in the z/OS V2.2 issue of that manual. When I read the text 
you posted, I thought IBM has changed the text in the V2.3 issue. Not so. There 
seem to be contradicting definitions of RENT on the very same manual.


As long as I know, the rule I cited has been in place. This rule allows a 
program to modify its own storage, and still be used in a reenterable way, this 
disallowing it to be loaded into write-protected storage.


As long as I know, there was the special rule for modules loaded from APF 
authorized libraries.


I have not noticed the paragraph you posted until now. The wording "ordinarily" 
does not exclude above case. However, the wording related to z/OS UNIX:


 "... These cases include programs which the system treats as having been 
loaded from an authorized library, and also programs running under UNIX unless 
a debugging environment has been specified."

... surely cannot be correct. LOAD will still abide to the same rules, no 
matter whether the LOAD SVC was called from a dubbed task or a non-dubbed task. 
At least I hope so.




It is ok for the "new" service BPX1LOD to behave differently. However, this 
different behaviour must be clearly documented, which it is not.




Apart from BPX1LOD, loading program objects from the UNIX file system should be 
no different as loading a program object (or load module) from a load library.


If a (RENT) program is in a (non APF-authorized) load library, it can simply be 
copied into the file system, and vice versa.


I would expect both to behave identically. The former being loaded into SP251, 
the later into SP252?? Really?? If true, the sticky bit will change the 
behaviour of loaded code unexpectedly.



--
Peter Hunkeler

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-25 Thread Paul Gilmartin
On Fri, 25 May 2018 22:23:09 +0200, Peter Hunkeler wrote:

>>> What was Peter H. (informally?) quoting without citation?
> >
>>In: z/OS  IBM MVS Program Management: User's Guide and Reference
>>Version 2 Release 3  SA23-1393-30
>
>Re-read my post and you will find my citation. I admit I missed the word 
>"Reference" and I did not include the pubs number. I thought it would be 
>understood, nevertheless. It seems, not. I'm sorry for the confusion this may 
>have caused.
>
OK.  You posted from "Glossary" (which I hadn't noticed):
reenterable
The reusability attribute that allows a program to be used concurrently by 
more
than one task. A reenterable module can modify its own data or other shared
resources, if appropriate serialization is in place to prevent interference 
between
using tasks. See reusability.
>
That's how I recall the behavior from decades ago.  But it appears to be 
contradicted,
at least in spirit, by the "options reference":

On Fri, 25 May 2018 13:23:58 -0500, Paul Gilmartin wrote:

>On Tue, 22 May 2018 15:27:32 -0400, Thomas David Rivers wrote:
>
>>The BPX loadhfs function (BPX1LOD) loads an HFS executable
>>into memory.
>>
>>It seems, that sometimes, this is loaded into writable memory
>>and sometimes into read-only memory.
>>
>>There doesn't seem to be a way to indicate which is desired.. is there
>>some OS-interface that writable memory be used?
>>
>What was Peter H. (informally?) quoting without citation?
>
>In: z/OS  IBM MVS Program Management: User's Guide and Reference
>Version 2 Release 3  SA23-1393-30
>
>Chapter 6. Binder options reference
>Binder options
>REUS: Reusability options`
>RENT
>The module is reenterable. It can be executed by more than one
>task at a time. A task can begin executing it before a previous
>task has completed execution. A reenterable module is ordinarily
>expected not to modify its own code. In some cases, MVS protects
>the reentrant module's virtual storage so that it cannot be
>modified except by a program running in key 0. These cases
>include programs which the system treats as having been loaded
>from an authorized library, and also programs running under UNIX
>unless a debugging environment has been specified.
>
>Reenterable modules are also serially reusable.
>
>So, WAD.
>
>I dislike some things about this:
>
>o "include" is undesirably vague.  The Ref. should specify exactly
>  the cases in which ... programs are [so] treated.  A precise "are"
>  is preferable to the imprecise "include".  What other cases may
>  there be?  "[T]reats as having been ..." is likewise vague.  Provide
>  at least a citation of an explanation of what this means.
>
>o Simpler Is Better.  I see no good reason to treat "programs running
>  under UNIX" differently from other programs.
>
>o "ordinarily expected".  Is this a retreat from the earlier well-known
>  rule (cited by Peter) that a RENT program was allowed to modify its
>  own code given proper serialization?

-- gil

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


AW: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-25 Thread Peter Hunkeler
>> What was Peter H. (informally?) quoting without citation?
 >
>In: z/OS  IBM MVS Program Management: User's Guide and Reference
>Version 2 Release 3  SA23-1393-30


Re-read my post and you will find my citation. I admit I missed the word 
"Reference" and I did not include the pubs number. I thought it would be 
understood, nevertheless. It seems, not. I'm sorry for the confusion this may 
have caused.


--
Peter Hunkeler




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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-25 Thread Seymour J Metz
> "ordinarily expected".  Is this a retreat from the earlier well-known
>   rule (cited by Peter) that a RENT program was allowed to modify its
>   own code given proper serialization?

I read it as saying that it's permitted but bad form, and I agree. 


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List  on behalf of 
Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu>
Sent: Friday, May 25, 2018 2:23 PM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable 
memory?

On Tue, 22 May 2018 15:27:32 -0400, Thomas David Rivers wrote:

>The BPX loadhfs function (BPX1LOD) loads an HFS executable
>into memory.
>
>It seems, that sometimes, this is loaded into writable memory
>and sometimes into read-only memory.
>
>There doesn't seem to be a way to indicate which is desired.. is there
>some OS-interface that writable memory be used?
>
What was Peter H. (informally?) quoting without citation?

In: z/OS  IBM MVS Program Management: User's Guide and Reference
Version 2 Release 3  SA23-1393-30

Chapter 6. Binder options reference
Binder options
REUS: Reusability options`
RENT
The module is reenterable. It can be executed by more than one
task at a time. A task can begin executing it before a previous
task has completed execution. A reenterable module is ordinarily
expected not to modify its own code. In some cases, MVS protects
the reentrant module's virtual storage so that it cannot be
modified except by a program running in key 0. These cases
include programs which the system treats as having been loaded
from an authorized library, and also programs running under UNIX
unless a debugging environment has been specified.

Reenterable modules are also serially reusable.

So, WAD.

I dislike some things about this:

o "include" is undesirably vague.  The Ref. should specify exactly
  the cases in which ... programs are [so] treated.  A precise "are"
  is preferable to the imprecise "include".  What other cases may
  there be?  "[T]reats as having been ..." is likewise vague.  Provide
  at least a citation of an explanation of what this means.

o Simpler Is Better.  I see no good reason to treat "programs running
  under UNIX" differently from other programs.

o "ordinarily expected".  Is this a retreat from the earlier well-known
  rule (cited by Peter) that a RENT program was allowed to modify its
  own code given proper serialization?

-- gil

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

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-25 Thread Paul Gilmartin
On Tue, 22 May 2018 15:27:32 -0400, Thomas David Rivers wrote:

>The BPX loadhfs function (BPX1LOD) loads an HFS executable
>into memory.
>
>It seems, that sometimes, this is loaded into writable memory
>and sometimes into read-only memory.
>
>There doesn't seem to be a way to indicate which is desired.. is there
>some OS-interface that writable memory be used?
>
What was Peter H. (informally?) quoting without citation?

In: z/OS  IBM MVS Program Management: User's Guide and Reference
Version 2 Release 3  SA23-1393-30

Chapter 6. Binder options reference
Binder options
REUS: Reusability options`
RENT
The module is reenterable. It can be executed by more than one
task at a time. A task can begin executing it before a previous
task has completed execution. A reenterable module is ordinarily
expected not to modify its own code. In some cases, MVS protects
the reentrant module's virtual storage so that it cannot be
modified except by a program running in key 0. These cases
include programs which the system treats as having been loaded
from an authorized library, and also programs running under UNIX
unless a debugging environment has been specified.

Reenterable modules are also serially reusable.

So, WAD.

I dislike some things about this:

o "include" is undesirably vague.  The Ref. should specify exactly
  the cases in which ... programs are [so] treated.  A precise "are"
  is preferable to the imprecise "include".  What other cases may
  there be?  "[T]reats as having been ..." is likewise vague.  Provide
  at least a citation of an explanation of what this means.

o Simpler Is Better.  I see no good reason to treat "programs running
  under UNIX" differently from other programs.

o "ordinarily expected".  Is this a retreat from the earlier well-known
  rule (cited by Peter) that a RENT program was allowed to modify its
  own code given proper serialization?

-- gil

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-25 Thread Seymour J Metz
No, I just finished looking for appropriate references for pure, reentrant and 
refreshable for use in an edit to a Wikipedia talk page. As usual, gargle 
insists that it knows better than me what I want to search form, and gives me 
lots of BS links.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List  on behalf of 
John McKown 
Sent: Friday, May 25, 2018 12:30 PM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable 
memory?

On Fri, May 25, 2018 at 11:16 AM Seymour J Metz  wrote:

> The CS community uses "pure" for read-only.
>

​Thanks. I thought that I had read something like like in the past, but I
couldn't find the reference. By chance do you have a URL that I could refer
to? I tried various searches, including "pure code" "pure program" "pure
executable" and other "pure ..." type searches, but no useful results.​



>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of John McKown 
> Sent: Thursday, May 24, 2018 3:58 PM
> To: IBM-MAIN@listserv.ua.edu
> Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable
> memory?
>
> On Thu, May 24, 2018 at 2:09 PM Seymour J Metz  wrote:
>
> > No. It means that the code will run correctly even if the OS refreshes it
> > from DASD. That might mean that it is R/O, or it might only mean that the
> > changes are not relevant to correct operation, e.g., storing data for
> dump
> > analysis that the module never looks at again.
> >
> > Now, IMHO it's bad form to play such games, but it's legal.
> >
>
> ​Thanks. I thought that there was a word/phrase for a program which does
> not modify anything within itself, including "data" areas. E.g. something
> better than "not self-modifying". The only thing that I have found in my
> searching is "ROMable code". Which I hope is self evident as "code which
> will run correctly even if stored in ReadOnlyMemory". Apparently this is
> what some of the ARM programmers, especially "embedded" programmers, use
> for this. ​
>
> Now, personally, I _love_ that I can have z/OS fetch place RENT code in key
> 0 memory. Hum, are those pages also marked "read only", or is the
> protection only that most programs don't run key 0? I was hoping that I
> could use the IARV64 REQUEST=PROTECT to make the memory ReadOnly, but
> apparently that API can only be used with "memory objects" which are "above
> the bar", not memory in the 0K-2GiB range.
>
>
>
> >
> >
> > --
> > Shmuel (Seymour J.) Metz
> > http://mason.gmu.edu/~smetz3
>
>
> --
> Once a government places vague notions of public safety and security above
> the preservation of freedom, a general loss of liberty is sure to follow.
>
> GCS Griffin -- Pelaran Alliance -- TFS Guardian (book)
>
>
> Maranatha! <><
> John McKown
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>


--
Once a government places vague notions of public safety and security above
the preservation of freedom, a general loss of liberty is sure to follow.

GCS Griffin -- Pelaran Alliance -- TFS Guardian (book)


Maranatha! <><
John McKown

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

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-25 Thread John McKown
On Fri, May 25, 2018 at 11:16 AM Seymour J Metz  wrote:

> The CS community uses "pure" for read-only.
>

​Thanks. I thought that I had read something like like in the past, but I
couldn't find the reference. By chance do you have a URL that I could refer
to? I tried various searches, including "pure code" "pure program" "pure
executable" and other "pure ..." type searches, but no useful results.​



>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
> 
> From: IBM Mainframe Discussion List  on behalf
> of John McKown 
> Sent: Thursday, May 24, 2018 3:58 PM
> To: IBM-MAIN@listserv.ua.edu
> Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable
> memory?
>
> On Thu, May 24, 2018 at 2:09 PM Seymour J Metz  wrote:
>
> > No. It means that the code will run correctly even if the OS refreshes it
> > from DASD. That might mean that it is R/O, or it might only mean that the
> > changes are not relevant to correct operation, e.g., storing data for
> dump
> > analysis that the module never looks at again.
> >
> > Now, IMHO it's bad form to play such games, but it's legal.
> >
>
> ​Thanks. I thought that there was a word/phrase for a program which does
> not modify anything within itself, including "data" areas. E.g. something
> better than "not self-modifying". The only thing that I have found in my
> searching is "ROMable code". Which I hope is self evident as "code which
> will run correctly even if stored in ReadOnlyMemory". Apparently this is
> what some of the ARM programmers, especially "embedded" programmers, use
> for this. ​
>
> Now, personally, I _love_ that I can have z/OS fetch place RENT code in key
> 0 memory. Hum, are those pages also marked "read only", or is the
> protection only that most programs don't run key 0? I was hoping that I
> could use the IARV64 REQUEST=PROTECT to make the memory ReadOnly, but
> apparently that API can only be used with "memory objects" which are "above
> the bar", not memory in the 0K-2GiB range.
>
>
>
> >
> >
> > --
> > Shmuel (Seymour J.) Metz
> > http://mason.gmu.edu/~smetz3
>
>
> --
> Once a government places vague notions of public safety and security above
> the preservation of freedom, a general loss of liberty is sure to follow.
>
> GCS Griffin -- Pelaran Alliance -- TFS Guardian (book)
>
>
> Maranatha! <><
> John McKown
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>


-- 
Once a government places vague notions of public safety and security above
the preservation of freedom, a general loss of liberty is sure to follow.

GCS Griffin -- Pelaran Alliance -- TFS Guardian (book)


Maranatha! <><
John McKown

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-25 Thread Seymour J Metz
The CS community uses "pure" for read-only.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List  on behalf of 
John McKown 
Sent: Thursday, May 24, 2018 3:58 PM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable 
memory?

On Thu, May 24, 2018 at 2:09 PM Seymour J Metz  wrote:

> No. It means that the code will run correctly even if the OS refreshes it
> from DASD. That might mean that it is R/O, or it might only mean that the
> changes are not relevant to correct operation, e.g., storing data for dump
> analysis that the module never looks at again.
>
> Now, IMHO it's bad form to play such games, but it's legal.
>

​Thanks. I thought that there was a word/phrase for a program which does
not modify anything within itself, including "data" areas. E.g. something
better than "not self-modifying". The only thing that I have found in my
searching is "ROMable code". Which I hope is self evident as "code which
will run correctly even if stored in ReadOnlyMemory". Apparently this is
what some of the ARM programmers, especially "embedded" programmers, use
for this. ​

Now, personally, I _love_ that I can have z/OS fetch place RENT code in key
0 memory. Hum, are those pages also marked "read only", or is the
protection only that most programs don't run key 0? I was hoping that I
could use the IARV64 REQUEST=PROTECT to make the memory ReadOnly, but
apparently that API can only be used with "memory objects" which are "above
the bar", not memory in the 0K-2GiB range.



>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3


--
Once a government places vague notions of public safety and security above
the preservation of freedom, a general loss of liberty is sure to follow.

GCS Griffin -- Pelaran Alliance -- TFS Guardian (book)


Maranatha! <><
John McKown

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

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Jim Mulder
  What I said below is for load modules and program objects in PDSEs.

  For BPX1LOD, it is a little different.
RENT modules are loaded into subpool 252 regardless of the authorization 
of 
the file from which they are loaded (since this was new stuff in the 
1990s, it
didn't have to be compatible with the screwy way load modules had worked 
for a long time).

  Also, BLX1LOAD doesn't do the REFRPROT stuff for REFR objects
(probably because of my ignorance about its existence when I implemented
REFRPROT). 

Jim Mulder z/OS Diagnosis, Design, Development, Test  IBM Corp. 
Poughkeepsie NY

> From: Jim Mulder/Poughkeepsie/IBM
> To: ibm-main@listserv.ua.edu
> Date: 05/24/2018 05:34 PM
> Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into 
> writable memory?
> 
>   PGSER PROTECT is the corresponding service for the 0K-2GiB range.
> 
>   RENT modules from APF authorized libraries are loaded into 
> subpool 252 (key 0, non-fetch protected).If the undocumented
> CSVRENTSP252 trap is enabled in DIAGxx, subpool 252 is also used for
> RENT modules from unauthorized libraries.
> 
>   If REFRPROT is in effect via PROGxx or SETPROG, REFR modules
> are loaded into subpool 252 (regardless of whether or not the library is
> APF authorized), and the full 4K pages are protected via
> PGSER PROTECT. 
> 
> 
> Jim Mulder z/OS Diagnosis, Design, Development, Test  IBM Corp. 
> Poughkeepsie NY

> John McKown  wrote on 05/24/2018 03:58:29 
PM:
> 
> > Now, personally, I _love_ that I can have z/OS fetch place RENT code 
in key
> > 0 memory. Hum, are those pages also marked "read only", or is the
> > protection only that most programs don't run key 0? I was hoping that 
I
> > could use the IARV64 REQUEST=PROTECT to make the memory ReadOnly, but
> > apparently that API can only be used with "memory objects" which are 
"above
> > the bar", not memory in the 0K-2GiB range.



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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Paul Gilmartin
On Thu, 24 May 2018 17:52:27 +0200, Peter Hunkeler wrote:
>
>Module reusability:
>o Reenterable (reentrant). The module is designed for concurrent execution by 
>multiple tasks. If a reenterable module modifies its own data areas or other 
>shared resources in any way, appropriate serialization must be in place to 
>prevent interference between using tasks.
> 
Is this from Program Management Guide?

This suggests a couple experiments:

o Mark a program object RENT but not REFR.  Code it to store into itself then
  restore the initial content.  Serialize with a simple CS-STIMER loop.  Any
  ABEND or program check should merit SR, even under OMVS.  WAD?

o LINK to such an object in two different processes, each invoked with
  _BPX_SHAREAS=MUST spawn().  Compare load addresses to see whether
  the instance is shared.  If not shared it's a quality/performance matter,
  perhaps not SR.

-- gil

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Jim Mulder
  PGSER PROTECT is the corresponding service for the 0K-2GiB range.

  RENT modules from APF authorized libraries are loaded into 
subpool 252 (key 0, non-fetch protected).If the undocumented
CSVRENTSP252 trap is enabled in DIAGxx, subpool 252 is also used for
RENT modules from unauthorized libraries.

  If REFRPROT is in effect via PROGxx or SETPROG, REFR modules
are loaded into subpool 252 (regardless of whether or not the library is
APF authorized), and the full 4K pages are protected via
PGSER PROTECT. 


Jim Mulder z/OS Diagnosis, Design, Development, Test  IBM Corp. 
Poughkeepsie NY

John McKown  wrote on 05/24/2018 03:58:29 
PM:
 
> Now, personally, I _love_ that I can have z/OS fetch place RENT code in 
key
> 0 memory. Hum, are those pages also marked "read only", or is the
> protection only that most programs don't run key 0? I was hoping that I
> could use the IARV64 REQUEST=PROTECT to make the memory ReadOnly, but
> apparently that API can only be used with "memory objects" which are 
"above
> the bar", not memory in the 0K-2GiB range.



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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread John McKown
On Thu, May 24, 2018 at 2:09 PM Seymour J Metz  wrote:

> No. It means that the code will run correctly even if the OS refreshes it
> from DASD. That might mean that it is R/O, or it might only mean that the
> changes are not relevant to correct operation, e.g., storing data for dump
> analysis that the module never looks at again.
>
> Now, IMHO it's bad form to play such games, but it's legal.
>

​Thanks. I thought that there was a word/phrase for a program which does
not modify anything within itself, including "data" areas. E.g. something
better than "not self-modifying". The only thing that I have found in my
searching is "ROMable code". Which I hope is self evident as "code which
will run correctly even if stored in ReadOnlyMemory". Apparently this is
what some of the ARM programmers, especially "embedded" programmers, use
for this. ​

Now, personally, I _love_ that I can have z/OS fetch place RENT code in key
0 memory. Hum, are those pages also marked "read only", or is the
protection only that most programs don't run key 0? I was hoping that I
could use the IARV64 REQUEST=PROTECT to make the memory ReadOnly, but
apparently that API can only be used with "memory objects" which are "above
the bar", not memory in the 0K-2GiB range.



>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3


-- 
Once a government places vague notions of public safety and security above
the preservation of freedom, a general loss of liberty is sure to follow.

GCS Griffin -- Pelaran Alliance -- TFS Guardian (book)


Maranatha! <><
John McKown

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Seymour J Metz
No. It means that the code will run correctly even if the OS refreshes it from 
DASD. That might mean that it is R/O, or it might only mean that the changes 
are not relevant to correct operation, e.g., storing data for dump analysis 
that the module never looks at again.

Now, IMHO it's bad form to play such games, but it's legal.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List  on behalf of 
John McKown 
Sent: Thursday, May 24, 2018 2:56 PM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable 
memory?

On Thu, May 24, 2018 at 12:55 PM Steve Smith  wrote:

> IBM would like (for obvious reasons) to have an attribute that means
> "read-only", but for some reason, they've never managed to just say so.
> The standard definitions of RENT and REFR do not logically require
> read-only modules, but both are treated as if they do.
>

​It's too bad that RENT implies "read only". It makes complete sense that
REFR does. IIRC, back in the very old days, there was the "SVC transient"
area (2K or 4K) into which an type 3 SVC or one of the parts of a type 4
SVC was dynamically loaded. ​These modules were "refreshable" which I think
meant "MVS, you are allowed to refetch this module from disk and just
continue running it because I guarantee that the code & data areas in it
are not ever going to change".



>
> sas
>
>
--
Once a government places vague notions of public safety and security above
the preservation of freedom, a general loss of liberty is sure to follow.

GCS Griffin -- Pelaran Alliance -- TFS Guardian (book)


Maranatha! <><
John McKown

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

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread John McKown
On Thu, May 24, 2018 at 12:55 PM Steve Smith  wrote:

> IBM would like (for obvious reasons) to have an attribute that means
> "read-only", but for some reason, they've never managed to just say so.
> The standard definitions of RENT and REFR do not logically require
> read-only modules, but both are treated as if they do.
>

​It's too bad that RENT implies "read only". It makes complete sense that
REFR does. IIRC, back in the very old days, there was the "SVC transient"
area (2K or 4K) into which an type 3 SVC or one of the parts of a type 4
SVC was dynamically loaded. ​These modules were "refreshable" which I think
meant "MVS, you are allowed to refetch this module from disk and just
continue running it because I guarantee that the code & data areas in it
are not ever going to change".



>
> sas
>
>
-- 
Once a government places vague notions of public safety and security above
the preservation of freedom, a general loss of liberty is sure to follow.

GCS Griffin -- Pelaran Alliance -- TFS Guardian (book)


Maranatha! <><
John McKown

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Steve Smith
IBM would like (for obvious reasons) to have an attribute that means
"read-only", but for some reason, they've never managed to just say so.
The standard definitions of RENT and REFR do not logically require
read-only modules, but both are treated as if they do.

sas

On Thu, May 24, 2018 at 11:52 AM, Peter Hunkeler  wrote:

>
> >Loading from the HFS seems to prefer to load RENT modules in read-only
> memory; without the "a" attribute.
>
>
>
>
> I haven't tested, and I believe what you say is what you see. However,
> this is not expected behaviour, since RENT does *not* mean the program must
> not modify itself. The Program Management User's Guide explicitly mentions
> that:
>
>
> Module reusability:
> o Reenterable (reentrant). The module is designed for concurrent execution
> by multiple tasks. If a reenterable module modifies its own data areas or
> other shared resources in any way, appropriate serialization must be in
> place to prevent interference between using tasks.
>
>
> --
> Peter Hunkeler
>

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Peter Hunkeler

>Loading from the HFS seems to prefer to load RENT modules in read-only
memory; without the "a" attribute.




I haven't tested, and I believe what you say is what you see. However, this is 
not expected behaviour, since RENT does *not* mean the program must not modify 
itself. The Program Management User's Guide explicitly mentions that:


Module reusability:
o Reenterable (reentrant). The module is designed for concurrent execution by 
multiple tasks. If a reenterable module modifies its own data areas or other 
shared resources in any way, appropriate serialization must be in place to 
prevent interference between using tasks.


--
Peter Hunkeler



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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Peter Hunkeler

>I believe that lately there's a PARMLIB option (REFRPROT?) which modulates 
>this.


As the name implies, this has influence on the loading REFResable load modules. 
The manual does not mention it has any influence on loading RENT module.

--
Peter Hunkeler

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


Re: AW: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Paul Gilmartin
On Thu, 24 May 2018 12:54:41 +0200, Peter Hunkeler wrote:
>
>>It primarily has to do with the module attributes (is it reentrant?) and the 
>>APF authorization of the job step.
>
>I hate to correct you, but ISTR it is RENT plus loaded from an authorized 
>library, no matter whether the step is actually running APF authorized or not.
>
I believe that lately there's a PARMLIB option (REFRPROT?) which modulates this.

>David: Does you HFS module have the "a" extended attribute set, and is it 
>really required?

-- gil

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


Re: AW: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Thomas David Rivers

Peter Hunkeler wrote:



 

It primarily has to do with the module attributes (is it reentrant?) and  
   

the APF authorization of the job step. 



I hate to correct you, but ISTR it is RENT plus loaded from an authorized 
library, no matter whether the step is actually running APF authorized or not.


David: Does you HFS module have the "a" extended attribute set, and is it really required? 



--
Peter Hunkeler

 


Loading from the HFS seems to prefer to load RENT modules in read-only
memory; without the "a" attribute.

By default, it seems, the c99/cc/etc.. drivers set things up so that 
REUSE=RENT
is specified (or perhaps that's the binder default when writing an HFS 
program

object?)

And - HFS loading seems to really like putting things in read-only memory.

That's way, to debug anything with dbx, you have to specify the environment
variable (_BPX_PTRACE_ATTACH=yes) to get the programs loaded in
writable storage so dbx can set break-pts.  


But - when you programatically invoke BPX1LOD; there is no way to honor
the environment variable...   I suppose the exec family of functions can
examine the environment variable (since they have it) and somehow load
the module appropriately, but BPX1LOD has no similar function.

   - Dave R. -


--
riv...@dignus.comWork: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

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


AW: Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-24 Thread Peter Hunkeler

>It primarily has to do with the module attributes (is it reentrant?) and
the APF authorization of the job step.


I hate to correct you, but ISTR it is RENT plus loaded from an authorized 
library, no matter whether the step is actually running APF authorized or not.


David: Does you HFS module have the "a" extended attribute set, and is it 
really required?


--
Peter Hunkeler



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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-23 Thread Thomas David Rivers

Peter Relson wrote:

I believe that the rules for whether BPX1LOD brings a module into writable 
memory are the same as for whether the LOAD service does.
It primarily has to do with the module attributes (is it reentrant?) and 
the APF authorization of the job step.


Peter Relson
z/OS Core Technology Design
 

Just to follow-up... If I add  -Wl,REUS=NONE to the link step (the c99 
command)

for building the HFS load module - that seems to mark the module
appropriately so that it is loaded into writable memory.

  - Dave Rivers -

--
riv...@dignus.comWork: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-23 Thread Thomas David Rivers

Peter Relson wrote:

I believe that the rules for whether BPX1LOD brings a module into writable 
memory are the same as for whether the LOAD service does.
It primarily has to do with the module attributes (is it reentrant?) and 
the APF authorization of the job step.


Peter Relson
z/OS Core Technology Design

 



Ah - but what if, although the module might be marked RENT,
I'd _really_ like it to loaded into writable storage without re-linking
it?

No way to do that?

  - Dave R. -

--
riv...@dignus.comWork: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-23 Thread Peter Relson
I believe that the rules for whether BPX1LOD brings a module into writable 
memory are the same as for whether the LOAD service does.
It primarily has to do with the module attributes (is it reentrant?) and 
the APF authorization of the job step.

Peter Relson
z/OS Core Technology Design


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


Re: How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-22 Thread Tony Harminc
On 22 May 2018 at 15:27, Thomas David Rivers  wrote:
> The BPX loadhfs function (BPX1LOD) loads an HFS executable
> into memory.
>
> It seems, that sometimes, this is loaded into writable memory
> and sometimes into read-only memory.
>
> There doesn't seem to be a way to indicate which is desired.. is there
> some OS-interface that writable memory be used?

Surely it cannot load a module that is not linked/bound as RENT or
REFR into read-only memory...? Even if your program *is* RENT, what
happens if you mark it as not in the Binder?

Tony H.

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


How to get BPX loadhfs (BPX1LOD) to load module into writable memory?

2018-05-22 Thread Thomas David Rivers

The BPX loadhfs function (BPX1LOD) loads an HFS executable
into memory.

It seems, that sometimes, this is loaded into writable memory
and sometimes into read-only memory.

There doesn't seem to be a way to indicate which is desired.. is there
some OS-interface that writable memory be used?

I did see that if the process is being debugged with the ptrace service,
then loadhfs loads the module into writable memory but that isn't going
on here I'd like to use loadhfs() to bring a module from the HFS into
my program, but in writable memory.

There is the _BPX_PTRACE_ATTACH="yes" environment variable; but
I don't see where loadhfs() honors that (or how it might even know
of its existence, since there isn't BPX-level management of environment
variables.)

   - Thanks -
 - Dave Rivers -

--
riv...@dignus.comWork: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

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