Conditional Assemble GBL(x) Definition



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

Conditional Assemble GBL(x) Definition

Postby papadilbert » Tue Aug 24, 2021 7:19 am

I'm attempting to dust off a few brain cells.

How do I concatenate the GBLB variable name using 2 variables?

I'm writing a data macro (DSECT) that I want to suffix.
the GBLB really needs to be something like &MYMAC&SUF to set/check the global if I've already called the macro with this suffix.

I'm thinking that I can set a
GBLA &MAC
&MAC SETA C'MYMAC'
GBLB &MAC&SUF

...
&MAC&SUF SETB 1
...
IF(&MAC&SUF.1).AGO .SKIP

How do I concatenate the GBLB variable name using 2 variables?


       MACRO
        MYMAC &REG,&SUF
        GBLB   &SFX
        AIF   (&SFX.1).AGO .SKIP
  MYMAC&SUF DSECT
ALAB1&SUF DS   CL5
ALAB2&SUF DS   CL10
.SKIP  ANOP
         USING  MYMAC&SUF,&REG
&SFX  SETB   1
         MEND


       MYMAC  REG=1,SUF=IN
       MYMAC  REG=2,SUF=OUT
....
       MYMAC  REG=3,SUF=IN
papadilbert
 
Posts: 8
Joined: Mon Apr 21, 2014 11:05 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Conditional Assemble GBL(x) Definition

Postby willy jensen » Tue Aug 24, 2021 1:18 pm

Logically speaking you cannot concatenate two bits as the result would not be a bit, but part of a byte.
You can only concatenate GBLCs and LCLCs, so you could do like this:
         gblb  &b1,&b2
         lclc  &c1          
&b1      setb  1            
&b2      setb  1            
&c1      setc  '&b1&b2'    
          aif   ('&c1' eq '10').first

But personally I would use AND / OR in the test like
  AIF (&GB1 AND &GB2).BOTH
willy jensen
 
Posts: 352
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 49 times

Re: Conditional Assemble GBL(x) Definition

Postby steve-myers » Tue Aug 24, 2021 10:21 pm

Certainly you can can build a variable, like this -
        MACRO
&PREFIX  GENDSECT
         GBLB  &CNTR
         LCLC  &NAME
&NAME    SETC  '&PREFIX&CNTR'
&NAME    DSECT                
&NAME    SETC  '&PREFIX.A&CNTR'
&NAME    DS    CL8
&NAME    SETC  '&PREFIX.B&CNTR'
&NAME    DS    F
&NAME    SETC  '&PREFIX.C&CNTR'
&NAME    DS    F
         MEND
         GBLB &CNTR
S        GENDSECT
&CNTR    SETB (1)
T        GENDSECT
         END

I prefer to create the additional symbol in the way I used in my macro definition: it produces a more pleasing expansion -

                                     14          GBLB &CNTR
                                     15 S        GENDSECT
000000                00000 00010    16+S0       DSECT
000000                               17+SA0      DS    CL8
000008                               18+SB0      DS    F
00000C                               19+SC0      DS    F
                                     20 &CNTR    SETB (1)
                                     21 T        GENDSECT
000000                00000 00010    22+T1       DSECT
000000                               23+TA1      DS    CL8
000008                               24+TB1      DS    F
00000C                               25+TC1      DS    F
                                     26          END
steve-myers
Global moderator
 
Posts: 2095
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 236 times


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post