You could generalize this in a macro. The following code is untested but
should work for all non-negative values that can be represented in your
format.

Assume the macro accepts three input parameters: &VALA, &VALB and &VALC.

&VALAHI  SETA &VALA/65536
&VALAMID SETA ((&VALA/256) AND 255)
&VALALO  SETA (&VALA AND 255)

&VALBHI  SETA &VALB/256
&VALBLO  SETA (&VALB AND 255)

&VALC like &VALA

Then the literal becomes
=AL1(&VALAHI,&VALAMID,&VALALO,&VALBHI,&VALBLO,&VALCHI,&VALCMID,&VALCLO)

You could use the SRL built-in function instead if you liked that better
than division by 256 or 65536.

Seemed odd to me that the assembler does not have a built-in modulus
function but I didn't see one.

Charles


-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]]
On Behalf Of Charles Mills
Sent: Saturday, May 5, 2018 6:51 AM
To: [email protected]
Subject: Re: Literals: are terms with different length attributes permitted?

That will work. Will work exactly "as-is" assuming the three values (1, 2, 3
in the OP's example) are positive integers between 0 and 255 inclusive.

Charles


-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]]
On Behalf Of Don Higgins
Sent: Saturday, May 5, 2018 5:34 AM
To: [email protected]
Subject: Re: Literals: are terms with different length attributes permitted?

All

Here is a way to code the literal that works on z390 and I think will work
on HLASM:

TEST CSECT
     USING *,15
     MVC   D8,=AL1(0,0,1,0,2,0,0,3)
     ABEND 1
D8   DC    XL8'FF'
     END

I ran it on Windows 10 with z390 GUI with ASMLG and DUMP option on to verify
8 byte literal is moved to D8 before issuing ABEND.

Don Higgins
[email protected]
www.don-higgins.net 

-----Original Message-----
From: IBM Mainframe Assembler List <[email protected]> On
Behalf Of Jonathan Scott
Sent: Saturday, May 5, 2018 5:29 AM
To: [email protected]
Subject: Re: Literals: are terms with different length attributes permitted?

> I'm wondering if I can avoid coding the DC statement, and do something 
> like this instead (I know this syntax is wrong):
>
>          MVC   0(8,R1),=(AL3(1),AL2(2),AL3(3))

A literal is equivalent to a single operand of a DC statement, so there is
no syntax similar to this that can be used.

If you don't want to define the operand separately and you use the
programming convention of having a separate LOCTR within the code control
section for static storage such as literals, constants and executed
instructions (which is especially useful for routines which only use
relative branches) then you can simply switch to that LOCTR to define a
constant with a systematically generated name.

Jonathan Scott
IBM Hursley, UK

Reply via email to