Why the 3 types of macros, list, execute, and generate forms



High Level Assembler(HLASM) for MVS & VM & VSE

Why the 3 types of macros, list, execute, and generate forms

Postby michel123 » Sun Apr 24, 2011 9:09 pm

Hello,

What difference and what job must be done with these 3 forms of macros, list, execute, and generate forms?

I mixture a little of all these ideas!
michel123
 
Posts: 58
Joined: Tue Dec 28, 2010 12:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: Why the 3 types of macros, list, execute, and generate f

Postby steve-myers » Mon Apr 25, 2011 1:31 am

Some macros pass a parameter list to the function. Some examples are OPEN, CLOSE and CALL. A few macros like LINK and ATTACH have two parameter lists; a "system" parameter list and a "regular" parameter list.
         OPEN  (ADCB,INPUT)        "Inclusive"
         OPEN  MF=(E,OPENPARM)     "Execute"
OPENPARM OPEN  (ADCB,INPUT),MF=L   "List"

         LINK  EP=PROGRAM,PARAM=(ADDR1,ADDR2) "Inclusive"
         LINK  SF=(E,LINKPARM),PARAM=(ADDR1,ADDR2),MF=(E,PGMPARM)
LINKPARM LINK  SF=L,EP=PROGRAM
PGMPARM  CALL  ,(0,0),MF=L

Macros that pass a parameter list to a function usually have three types of expansions: an "inclusive" expansion that generates the parameter list inline, an "execute" expansion, where the parameter list is not inline, and a "list"expansion, to create a parameter list.

Some newer macros have alternate expansions, like the "generate" expansion in michel123's query.

The reason for this is reenterable programs cannot alter the program text, so these alternate macro forms allow a programmer to construct remote parameter lists in a work area
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Why the 3 types of macros, list, execute, and generate f

Postby steve-myers » Mon Apr 25, 2011 11:14 am

Some examples of macro expansions.
                                      2          OPEN  (ADCB,INPUT)
000000                                3+         CNOP  0,4
000000 4510 C008            00008     4+         BAL   1,*+8
000004 80                             5+         DC    AL1(128)
000005 000068                         6+         DC    AL3(ADCB)
000008 0A13                           7+         SVC   19
                                      8          OPEN  MF=(E,OPENPARM)
00000A 4110 C010            00010    10+         LA    1,OPENPARM
00000E 0A13                          11+         SVC   19
                                     12 OPENPARM OPEN (ADCB,INPUT),MF=L
000010                               13+OPENPARM DC    0F'0'
000010 80                            14+         DC    AL1(128)
000011 000068                        15+         DC    AL3(ADCB)
                                     16          LINK  EP=PROGRAM,
                                                       PARAM=(ADDR1,ADDR2)
000014                               20+         CNOP  0,4
000014 4110 C01C            0001C    21+         LA    1,IHB0007
000018 47F0 C024            00024    22+         B     IHB0007A
                      0001C          23+IHB0007  EQU   *
00001C 00000068                      24+         DC    A(ADDR1)
000020 00000068                      25+         DC    A(ADDR2)
                      00024          26+IHB0007A EQU   *
000024                               29+         CNOP  0,4
000024 45F0 C038            00038    30+         BAL   15,*+20
000028 00000030                      31+         DC    A(*+8)
00002C 00000000                      32+         DC    A(0)
000030 D7D9D6C7D9C1D440              33+         DC    CL8'PROGRAM'
000038 0A06                          34+         SVC   6
                                     35          LINK  SF=(E,LINKPARM),
                                                       PARAM=(ADDR1,ADDR2),
                                                       MF=(E,PARMLIST)
00003A 4110 C060            00060    40+         LA    1,PARMLIST
00003E 41E0 C068            00068    41+         LA    14,ADDR1
000042 41F0 C068            00068    42+         LA    15,ADDR2
000046 90EF 1000            00000    43+         STM   14,15,0(1)
00004A 41F0 C050            00050    46+         LA    15,LINKPARM
00004E 0A06                          47+         SVC   6
                                     48 LINKPARM LINK  SF=L,EP=PROGRAM
000050                               52+         CNOP  0,4
000050 00000058                      53+LINKPARM DC    A(*+8)
000054 00000000                      54+         DC    A(0)
000058 D7D9D6C7D9C1D440              55+         DC    CL8'PROGRAM'
                                     56 PARMLIST CALL  ,(0,0),MF=L
000060                               60+PARMLIST DS    0F
000060 00000000                      61+         DC    A(0)
000064 00000000                      62+         DC    A(0)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Why the 3 types of macros, list, execute, and generate f

Postby michel123 » Tue Apr 26, 2011 12:10 am

Steve, thank you for your answers I will look before you requestionner because it is not too clear in my mind.
michel123
 
Posts: 58
Joined: Tue Dec 28, 2010 12:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: Why the 3 types of macros, list, execute, and generate f

Postby steve-myers » Tue Apr 26, 2011 4:57 am

Yes, you have to investigate each macro you want to use in the appropriate manual, and also carefully examine the expansions. There is not always very much consistency. Some MF=E expansions generate the complete and correct parameter list, some don't. Some MF=L macros generate a valid parameter list, some just generate binary 0s, though the length is correct. You have to be wary of addresses that point to storage in your work area; an MF=L expansion will fail. Some macro operands specify bit settings in the parameter list; they won't be reflected in your work area.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post