Martin,

I see the difference, but it's not applicable to my situation. Of
course, I am sure there is a better way to do it anyway.

I am generating branch labels that are numbers such as:
ABEND_0001 DS 0H
         MVC   ABEND_NUMBER,=H'1'
         B     CANCEL_MSG
ABEND_0002 DS 0H
         MVC   ABEND_NUMBER,=H'2'
         B     ABEND_MSG
.... and so on
and I need all the labels to have exactly 4 digits in the suffix.
Forcing the suffix to 4 digits is where I needed the K' code.

My macro is simply:

         MACRO
&NAME XXXXXXXX &CANCELS=0
&CMAX    SETA  &CANCELS
&N       SETA  1
.CLOOP   ANOP
         AIF   ('&N' GT '&CMAX').CMAXED
&NX4     SETC  '000&N'
&L       SETA  K'&NX4-3
&NX4     SETC  '&NX4'(&L,4)
ABEND_&NX4 DS 0H
         MVC   ABEND_NUMBER,=H'&N'
         B     ABEND_MSG
&N       SETA  &N+1
         AGO   .CLOOP
.CMAXED  ANOP

(I always hate to post code that I know that there must be a better way.)


Tony Thigpen

-----Original Message -----
 From: Martin Truebner
 Sent: 02/12/2014 11:05 AM
Tony,

judge for yourself

     1      MACRO
     2       X     &A
     3 &LA   SETA  K'&A
     4       MNOTE 'LENGTH OF A IS &LA'
     5       MEND
     6       X    PARAMETER
     7+LENGTH OF A IS 9
     8       X    'ABC''XC'
     9+LENGTH OF A IS 9
    10       X    PARA&&METER
    11+LENGTH OF A IS 11



--
Martin

Pi_cap_CPU - all you ever need around MWLC/SCRT/CMT in z/VSE
more at http://www.picapcpu.de


Reply via email to