C445585@UMCVMB.BITNET ("John M. Kelsey") (04/11/91)
Can anyone explain what list and execute forms of systme macros is used for, and how it works? I've been looking through a manual that continually refers to list and execute forms of macros, but doesn't explain what the @#$% they are.... Thanks.... --John
seb1525@mvs.draper.COM ("Stephen E. Bacher") (04/11/91)
In message <40391.2803bc39@ccfvx3.draper.com>, "John M. Kelsey" <C445585%UMCVMB.BITNET@ohstvma.acs.ohio-state.edu> asks: > Can anyone explain what list and execute forms of systme macros is > used for, and how it works? I've been looking through a manual that > continually refers to list and execute forms of macros, but doesn't > explain what the @#$% they are.... Briefly (since you'll probably get many responses)... List and execute forms of macros are needed for reentrant programs. Since system macros usually expand into SVC's or calls to system routines that require parameter lists, those parameter lists have to be built somewhere. Typically a macro will build the list inline and have the code jump over it, but since the parameter list has to be built by macro-generated code at run time (and sometimes gets updated by the system service itself), this technique is not valid for a reentrant program. Hence, the list and execute forms. The list form is used to construct just the parameter list, and the execute form actually calls the system service given a pointer to the parameter list you've built via the LIST form. The catch is that for truly reentrant code, you've often got to code the LIST form twice: once in your code, to establish the parameter settings in the list, and once in your GETMAINed area, so that the copy the system service uses is mutable. You would then have to copy the static one to the dynamic one before using, which means that you may have to set up a length equate to do it. Example: In your static data section: STATIC_FOO FOOMAC FOO=1,BAR=2,MF=L FOO_LENGTH EQU *-STATIC_FOO In your dynamic (DSECT) data section: DYNAMIC_FOO FOOMAC FOO=1,BAR=2,MF=L Note that even though this will be in a DSECT where values are irrelevant because it's all gotten at run time, it's usually a good idea to include all the parameters, mainly because which parameters you specify often determines the size of the parameter list at assembly time. In your executable code... MVC DYNAMIC_FOO(FOO_LENGTH),STATIC_FOO FOOMAC MF=(E,STATIC_FOO) Hope this helps. (Maybe it wasn't so brief after all...:-) - Steve Bacher <seb1525@mvs.draper.com> - Draper Laboratory
LDW@USCMVSA.BITNET (Leonard D Woren) (04/12/91)
On Thu, 11 Apr 91 07:48:00 EDT, "Stephen E. Bacher" <seb1525%mvs.draper.com@RELAY.CS.NET> said: > (good explanation removed for brevity) > The catch is that for truly reentrant code, you've often got to code > the LIST form twice: ... > > In your static data section: > > STATIC_FOO FOOMAC FOO=1,BAR=2,MF=L > FOO_LENGTH EQU *-STATIC_FOO > > In your dynamic (DSECT) data section: > > DYNAMIC_FOO FOOMAC FOO=1,BAR=2,MF=L I often avoid coding the MF=L twice like this: DS 0F DYNAMIC_FOO DS XL(FOO_LENGTH) Of course, this only works if you put your DSECTs at the end of the program (after the DCs.) Yet another reason why I hate CICS -- they put all the DSECT clutter at the beginning. /Leonard