Ref:  Your note of 27 November 2016, 17:14:43 -0800

Here's a general solution which I mentioned on this list earlier
this year (in the thread "Friday Puzzle: CNOP 1,2"), which shows
how to use ORG for the general case:

         MACRO
&LABEL   ALIGN &BOUNDARY,&OFFSET
         ORG   *+&BOUNDARY-(&OFFSET),&BOUNDARY,&OFFSET-(&BOUNDARY)
&LABEL   DS    0X
         MEND  ,

Note that unlike CNOP this macro expects boundary first then
offset, but you can of course invent your own macro the other way
round.  In many cases, the ORG can be simplified a little, but
this rather complicated form works even when the current location
counter is less than the specified offset from the start of the
section or LOCTR.

Jonathan Scott
IBM Hursley, UK

Charles Mills wrote:
> I have a DSECT where I want to define a fullword such that the next address
> after the fullword will be on a doubleword boundary. I would like the
> alignment to be independent of the preceding alignment (be change-proof).
>
> CNOP 4,8 would do exactly what I want, but CNOP seems inappropriate in
> non-executable code.
>
> I naively coded ORG *,8,-4. As luck would have it the existing alignment was
> six bytes into a doubleword and so that ended up effectively being ORG *-2.
>
> How do I use ORG to accomplish what I want? Can I use something like what I
> coded but always have it ORG forwards and never backwards? I could probably
> figure this out but hoped there was someone here who knew the answer right
> off.
>
> Or should I shut up and use CNOP: "If it ain't broke, don't fix it."
>
> Charles

Reply via email to