It was a (not the only) common coding technique "in the old days" to put the 
fields referenced by a subroutine at the end of that subroutine. If the last 
field were an odd length then if the next subroutine began with label EQU * you 
ended up with the alignment problem referenced in these posts. Nowadays putting 
data near instructions is a terrible technique never minding alignment because 
it drives the hardware's cache management crazy. Actually you code use that 
technique now and avoid both alignment and caching problems through the use of 
LOCTR.

Charles


-----Original Message-----
From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On 
Behalf Of Schmitt, Michael
Sent: Tuesday, June 2, 2020 9:18 AM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Re: z/OS HLASM: EQU for statement labels

Thank you for your replies.

I too was originally taught to use DS 0H for a label statement, because it 
guaranteed halfword instruction alignment. But I recently started using EQU * 
because a) it seemed to be clearer as to the intent, and b) I figured that if 
your instructions weren't aligned you've got bigger problems. I hadn't 
considered someone intentionally embedding an odd size storage area in the 
instruction stream without taking care to realign.  I may rethink this, perhaps 
with Charles Mills suggestion to use DS 0H at the start of routines but 
continue to use EQU * inside them.

As for the question of stand-alone labels vs. putting the label on the next 
instruction, I like the stand-alone labels because it promotes maintainable 
code. You can put comments on the label, but more important is that you can 
code multiple labels for the same address.

For example, if you have this kind of structure (begging Outlook not to 
collapse the leading spaces):

if x
   if y
      do a
   endif
else
   do b
endif

you can code one label for the first ENDIF and another for the ELSE.  Then 
later if you want to insert more instructions immediately before the ELSE, it 
is very clear where to put them and none of the labels change.

DXC Technology Company - Headquarters: 1775 Tysons Boulevard, Tysons, Virginia 
22102, USA.
DXC Technology Company -- This message is transmitted to you by or on behalf of 
DXC Technology Company or one of its affiliates.  It is intended exclusively 
for the addressee.  The substance of this message, along with any attachments, 
may contain proprietary, confidential or privileged information or information 
that is otherwise legally exempt from disclosure. Any unauthorized review, use, 
disclosure or distribution is prohibited. If you are not the intended recipient 
of this message, you are not authorized to read, print, retain, copy or 
disseminate any part of this message. If you have received this message in 
error, please destroy and delete all copies and notify the sender by return 
e-mail. Regardless of content, this e-mail shall not operate to bind DXC 
Technology Company or any of its affiliates to any order or other contract 
unless pursuant to explicit written agreement or government initiative 
expressly permitting the use of e-mail for such purpose. --.

Reply via email to