What makes your program non-reentrant is failing to serialize shared data. Long ago in a galaxy far away IBM actually shipped reentrant code that modified itself; AFAIK they have cleaned up that abomination.
In the case of WTO, use of MF=L in the CSECT does not keep the code from being reentrant if, as you describe later, the only use made of it is to initialize dynamic storage. Used that way there are no shared data, hence no need serialize. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List <[email protected]> on behalf of Jon Perryman <[email protected]> Sent: Monday, November 25, 2019 5:37 PM To: [email protected] Subject: Re: WTO On Monday, November 18, 2019, 05:56:09 AM PST, scott Ford <[email protected]> wrote: > My chief complaint is samples. > I spend a lot of time digging for examples. > Working examples which I can refer to and understand > (prototype) before I start writing code. CBTTAPE.ORG has tons of real world code. There is probably a variation on your request there but you will need to think creatively to find it. Since you wanted an exit that issues a WTO then look at IEFACTRT. This implementation will not work in every exit. Samples need to be generic with very little risk. A sample WTO in an exit could easily be misconstrued or unfit for your intended use. > When to use the execute form of the macro vs list, MF= is common and rarely deviates from the accepted standard. MF=(E,label) creates the executable code and belongs in your code where you want to execute the functionality. Think of it as the instruction. MF=L is the problem. Think of this as a DC instruction to reserve storage. Using MF=L in your CSECT makes your program non-reentrant. Using MF=L in your workarea DSECT makes your program reentrant but loses the constant initializer (initializes with X'00'). To be reentrant, it must occur in your CSECT and workarea DSECT. You must copy from the CSECT to the workarea DSECT and make sure the alignment is correct. You must also ensure the pointers are correct. Some programs skip the copy from CSECT to DSECT but they are at risk. Jon. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
