On 4/16/2012 12:26 PM, John Gilmore wrote:
Suppose that I wish to do something to each of the elements of an
assembly-time array in turn.  In the macro language of the HLASM I
must write something like

|&ne       seta   n'&array
|&i          seta   0
|.traverse_loop anop
|&i          seta&i+1
|&elements_exhausted setb (&i gt&ne)
|             aif       (&elements_exhausted).traverse_lend
|  .  .  .<process&array(&i)
|             ago    .traverse_loop
|.traverse_lend anop

"Must" you? <g>  In this case I would prefer:

.* &i       seta    0       *default*
.trvloop aif    (&i ge n'&array).trvend
&i  seta    &i+1
.  .  .<process&array(&i)>
        ago     .trvloop
.trvend anop    ,

That's six statements instead of nine. I was raised in the era of six (ForTran) and eight character variables, and find those easier to read. I'd use &ne only for larger array sizes; for small ones the savings are not noticeable.

Whether or not code is aesthetically pleasing is very much a matter of nurture. With effective comments, the structure of code isn't all that critical, and discussions of GOTO versus GOTO-less programming are about as useful as religious arguments.

Gerhard Postpischil
Bradford, VT

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to