Re: getting length of macro symbol
Mr. Perryman's notion that that the number of lines of code it replaces/generates is an appropriate criterion for deciding whether to use a macro is not one that I find congenial. Padding operations of one sort or another are ubiquitous, and the merit of using a parametric macro to do them is that, once developed and tested, you can turn your back on it without being stabbed in that back Such a macro can also be equipped with diagnostic and error-mnote machinery that is never in my experience provided in line. At a more fundamental level the whole notion that macros only generate code is a dubious and, I think, deleterious one. Historically, information was easy to import into them but very difficult to export from them. They perforce embodied their work in generated code. This situation changed in a fundamental way when the HLASM made created global set symbols and set-symbol arrays available. My PADDER macro, for example, pads instances of such symbols, leaving their use elsewhere to its invokers. The macros I use most heavily do not generate code at all. There is, however, room in the world for more than one view of how the HLASM should be used. Mr. Perryman and I disagree, sharply, about this issue and may others; but that is no bad thing. -- John Gilmore, Ashland, MA 01721 - USA
Re: getting length of macro symbol
I think it is K'WORD http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ASMR1020/9.3.6 On Wed, Feb 12, 2014 at 8:47 AM, Tony Thigpen t...@vse2pdf.com wrote: Within a macro, I need the length of a parm passed to the macro. What is the format of the seta statement? open code: mymac word=abcd mymac word=abcdefg macro code: macro mymac word= word_length seta ???what do I use here -- Tony Thigpen -- Wasn't there something about a PASCAL programmer knowing the value of everything and the Wirth of nothing? Maranatha! John McKown
Re: getting length of macro symbol
Perhaps DCLEN? http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ASMR1020/9.9.2.2 On Wed, Feb 12, 2014 at 9:38 AM, Martin Truebner mar...@pi-sysprog.dewrote: But K does not consider ' and proper. Tony - there is an alternative to K (which is in the book) that is superior to plain K. IIRC it is a function -- Martin Pi_cap_CPU - all you ever need around MWLC/SCRT/CMT in z/VSE more at http://www.picapcpu.de -- Wasn't there something about a PASCAL programmer knowing the value of everything and the Wirth of nothing? Maranatha! John McKown
Re: getting length of macro symbol
Tony, judge for yourself 1 MACRO 2 X A 3 LA SETA K'A 4 MNOTE 'LENGTH OF A IS LA' 5 MEND 6 XPARAMETER 7+LENGTH OF A IS 9 8 X'ABC''XC' 9+LENGTH OF A IS 9 10 XPARAMETER 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
Re: getting length of macro symbol
John, DCLEN thats it -- Martin Pi_cap_CPU - all you ever need around MWLC/SCRT/CMT in z/VSE more at http://www.picapcpu.de
Re: getting length of macro symbol
thanks. Tony Thigpen -Original Message - From: John McKown Sent: 02/12/2014 10:02 AM I think it is K'WORD http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ASMR1020/9.3.6 On Wed, Feb 12, 2014 at 8:47 AM, Tony Thigpen t...@vse2pdf.com wrote: Within a macro, I need the length of a parm passed to the macro. What is the format of the seta statement? open code: mymac word=abcd mymac word=abcdefg macro code: macro mymac word= word_length seta ???what do I use here -- Tony Thigpen -- Wasn't there something about a PASCAL programmer knowing the value of everything and the Wirth of nothing? Maranatha! John McKown
Re: getting length of macro symbol
Yes, I was simply replying to the claim that K' wouldn't work. You get the literal length of the parameter. Whether that is what is required is another matter. -Ursprüngliche Nachricht- Von: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] Im Auftrag von Martin Truebner Gesendet: Mittwoch, 12. Februar 2014 17:05 An: ASSEMBLER-LIST@LISTSERV.UGA.EDU Betreff: Re: getting length of macro symbol Tony, judge for yourself 1 MACRO 2 X A 3 LA SETA K'A 4 MNOTE 'LENGTH OF A IS LA' 5 MEND 6 XPARAMETER 7+LENGTH OF A IS 9 8 X'ABC''XC' 9+LENGTH OF A IS 9 10 XPARAMETER 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
Re: getting length of macro symbol
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 CANCELS=0 CMAXSETA CANCELS N SETA 1 .CLOOP ANOP AIF ('N' GT 'CMAX').CMAXED NX4 SETC '000N' 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 XPARAMETER 7+LENGTH OF A IS 9 8 X'ABC''XC' 9+LENGTH OF A IS 9 10 XPARAMETER 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
Re: getting length of macro symbol
David, wouldn't work I di not say that. I did say does not consider ' and and for the purpose Tony wants it K' is the better approach. But that was not obvious- could have been text (i.e. for error-messages). -- Martin Pi_cap_CPU - all you ever need around MWLC/SCRT/CMT in z/VSE more at http://www.picapcpu.de
Re: getting length of macro symbol
continued. . . |padkseta 3-k |seqcs setcd 'zeros2'(1,0).'seqcs' yields label segments that are ALL three characters in length, even for seqno 99 for which 'zeros2'(1,0) yields the nul string. On 2/12/14, John Gilmore jwgli...@gmail.com wrote: A distinction is called for here. k'character set-symbol identifier is always useful, but it is not always useful simplistically. For Tony's particular problem |zeros2 setc '00' |seqno seta 0 | . . . |seqno seta seqno+1 seqno_overflow setb (seqno gt 999) aif (seqno_overflow).seqno_overflow |seqcs seta A2D(seqno) |k seta k'seqcs padk On 2/12/14, David Stokes sto...@interchip.de wrote: Oh right, something like K' doesn't like quote and ampersand? (I've deleted the original). I guess that was easy to misinterpret. -Ursprüngliche Nachricht- Von: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] Im Auftrag von Martin Truebner Gesendet: Mittwoch, 12. Februar 2014 18:17 An: ASSEMBLER-LIST@LISTSERV.UGA.EDU Betreff: Re: getting length of macro symbol David, wouldn't work I di not say that. I did say does not consider ' and and for the purpose Tony wants it K' is the better approach. But that was not obvious- could have been text (i.e. for error-messages). -- Martin Pi_cap_CPU - all you ever need around MWLC/SCRT/CMT in z/VSE more at http://www.picapcpu.de -- John Gilmore, Ashland, MA 01721 - USA -- John Gilmore, Ashland, MA 01721 - USA
Re: getting length of macro symbol
In the 2nd segment of my response 'setcd' should of course be 'setc'. -- John Gilmore, Ashland, MA 01721 - USA
Re: getting length of macro symbol
Your counter doesn't have to start at 0. Start it at 1 and you will always have 5 digits or more. Just drop the first digit. CNT SETA 1 DATA SETC 'CNT'(2,*) Jon Perryman. From: Tony Thigpen t...@vse2pdf.com 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.
Re: getting length of macro symbol
I do not see much difference in performance between my substringing operation and Mr. Perryman's; and I prefer that counters count what they are counting in unbiased, if you will simplistic, fashion. Tricks lead others astray unless they are accompanied by tediously detailed comments, and sometimes even then. Mais, a chacun son goûte. In any case all such operations should be packageded up in a macro. My own is imaginatively called PADDER. It pads on the left or right parametrically with repetitions of a nominated or default single character or repetitions, perhaps truncated, of a nominated character string of non-identical characters. John Gilmore, Ashland, MA 01721 - USA
Re: getting length of macro symbol
Now, that solution I like. I will have to also add 1 to the max value also. Off to test. Well, I tested it and I like it better than my original solution. Tony Thigpen -Original Message - From: Jon Perryman Sent: 02/12/2014 02:35 PM Your counter doesn't have to start at 0. Start it at 1 and you will always have 5 digits or more. Just drop the first digit. CNT SETA 1 DATA SETC 'CNT'(2,*) Jon Perryman. From: Tony Thigpen t...@vse2pdf.com 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.
Re: getting length of macro symbol
There's no performance difference. Although I add comments, most just look at the code and quickly understand it's padding by dropping the 1 off the front of the number. If you don't like the TRICK, then use one of the following. I tend not to write macros for 1 line. 4 lines if you check the size. PADDED SETC '000C'(K'C,4) pad left to 4 characters PADDED SETC 'C.000'(1,4) pad right to 4 characters Jon Perryman. From: John Gilmore jwgli...@gmail.com I do not see much difference in performance between my substringing operation and Mr. Perryman's; and I prefer that counters count what they are counting in unbiased, if you will simplistic, fashion. Tricks lead others astray unless they are accompanied by tediously detailed comments, and sometimes even then. Mais, a chacun son goûte. In any case all such operations should be packageded up in a macro. My own is imaginatively called PADDER. It pads on the left or right parametrically with repetitions of a nominated or default single character or repetitions, perhaps truncated, of a nominated character string of non-identical characters.