🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.asm370
Article #71

Re: Help with a code problem

#71
From: john gilmore
Date: Sat, 08 Oct 2005 14:13
169 lines
7068 bytes
Gerhard Postpischl's suggestions are worthy ones, but I should go
further.

When a sequence of macro instructions is used to generate a single
table, it is worthwhile to make the sequencing machinery used ex-
plicit.  Specifying, say,

o usage=initial|i

for a first required macro instruction,

o usage=entry|e

for (usually) N macro instructions that define table entries, and

o usage=final|f

for a final macro instruction that triggers table generation is
highly desirable.

It is also worthwhile to make such a macro definition 'reentrant'
in a Pickwickian but important sense.  If, say, a four-character
keyword parameter, call it &stem, is required, it can be used to
construct RSECT names of the form

'&stem'.'&sequence_string'

where &sequence_string has the successive values

'0000', '0001', '0002', . . .

It then becomes possible to use &stem= values for other purposes
too.  In particular they can form part of the identifiers of  the
created global character set-symbol arrays used to hold table-
element values between macro expansions.

For example,

|&rsid     setc  '&macname'.'_&stem'.'_rsect'
|           gblc  &(&rsid)(1)

yields a created global character set-symbol array in which suc-
cessive RSECT names can be stored, and group and user-within-group
names can then be constructed in the same way.

Doing this makes it possible to construct multiple instances of a
table concurrently: Macro instructions for different tables can be
intermixed, as in

|          TABGEN usage=initial,stem=ABCD, . . .
|          TABGEN usage=entry,stem=ABCD, . . .
|          TABGEN usage=initial,stem=EFGH, . . .
|          TABGEN usage=entry,stem=ABCD, . . .
|          TABGEN usage=entry,stem=ABCD, . . .
|          TABGEN usage=entry,stem=EFGH, . . .
|          TABGEN usage=entry,stem=ABCD, . . .
|          TABGEN usage=entry,stem=ABCD, . . .
|          TABGEN usage=entry,stem=EFGH, . . .
|          TABGEN usage=final,stem=ABCD, . . .
|          TABGEN usage=entry,stem=EFGH, . . .
|          TABGEN usage=entry,stem=EFGH, . . .
|          TABGEN usage=entry,stem=EFGH, . . .
|          TABGEN usage=final,stem=EFGH, . . .


More generally, I strongly recommend that 'hidden' identifiers for
globals be avoided.  Created set-symbols that permit these identi-
fiers to be constructed dynamically should be used instead.

Three final comments of a different sort:

o Always dimension set-symbol arrays as &(&identifier)(1) in their
  defining GBLx or LCLx statements (What you get is what you should
  see),

o Avoid LCLx declarations for scalars; constructs like

  |         lcla  &counter
  |&counter seta  0

  are otiose when the contextual declaration

  |&counter seta  0

  alone suffices.


o parameterize MNOTE statements, as in

  |&macname setc  'GUBBINS'
  |&version     setc  '2'
  |&level        setc  '0'
  |&mnid        setc  '&macname'.'.&version'.'.&level..'
  |&es           seta  8
  | . . .
  |                mnote &es,'&mnid.00i.  . . . '
  | . . .
  |                mnote &es,'&mnid.02i.  . . . '

Perhaps a little unfairly, failure to do things of this sort stigmatizes
your
code as amateurish.

John Gilmore
Ashland, MA 01721
USA


>From: Gerhard Postpischil <gerhard@valley.net>
>Reply-To: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU>
>To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
>Subject: Re: Help with a code problem
>Date: Sat, 8 Oct 2005 00:34:38 -0400
>
>Scott McFall wrote:
>>Hi Assembler Gurus,
>>
>>My colleague Bob Stark asked me to float a problem he's currently
>>experiencing on an account out to some of the listservers for MVS and
>>Assember to see if anyone can help us debug this problem.
>>
>>If you post back, can you please also copy your response to Bob at
>>bstark@protechpts.com?
>
>In the past I've used a different approach. If you can, don't use a
>half-word length, but a BXLE DC. Having a GRP$ macro for each user id
>makes the deck a little longer, but much easier to maintain. I haven't
>tried to write a macro, but the code is straight-forward. Use a global
>array for each group name, and a counter for the number of defined
>groups, and an integer for the current group name, or a character
>variable with the current name.
>
>        GRP$    userid,GROUP=xyz
>CSGRP001 CSECT  ,
>        DC      CL8'userid'
>primary  CSECT  ,
>        GRP$    user2           defaults to prior group
>CSGRP001 CSECT  ,
>        DC      CL8'user2'
>primary  CSECT  ,
>        GRP$    user3,GROUP=rst start new group
>CSGRP002 CSECT  ,               new CSECT for new group
>        DC      CL8'user3'
>primary  CSECT  ,
>        GRP$    user4,GROUP=xyz allow intermixed groups
>CSGRP001 CSECT  ,
>        DC      CL8'user4'
>primary  CSECT  ,
>        ...
>table   GRP$    *END*   trigger the appropriate pointer expansions
>CSGRP001 CSECT  ,
>CSEND001 EQU    *
>CSGRP002 CSECT  ,
>CSEND002 EQU    *
>primary  CSECT  ,
>table   DC      A(CSGRP001,8,CSEND001-8),CL8'xyz '
>        DC      A(CSGRP002,8,CSEND002-8),cl8'rst '
>        DC      A(0,8,0)        end of groups
>
>Gerhard Postpischil
>Bradford, VT
>
>
>

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee®
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Technical Details
Message-ID: <BAY104-F42820321DB0F9800AE8B8FC6870@phx.gbl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!newspeer.tds.net!sn-xit-02!sn-xit-06!sn-xit-14!supernews.com!149.173.6.116.MISMATCH!foggy!vm.sas.com!msn.com!john_w_gilmore

Show Full Headers
Complete Article Headers
X-Google-Thread: fcdcb,3ec2dbadd23f826c
X-Google-Attributes: gidfcdcb,public
X-Google-Language: ENGLISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!newspeer.tds.net!sn-xit-02!sn-xit-06!sn-xit-14!supernews.com!149.173.6.116.MISMATCH!foggy!vm.sas.com!msn.com!john_w_gilmore
From: john gilmore <john_w_gilmore@msn.com>
Newsgroups: bit.listserv.asm370
Subject: Re: Help with a code problem
Date: Sat, 8 Oct 2005 14:13:08 +0000
Organization: SAS Inc.
Lines: 169
Sender: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU>
Message-ID: <BAY104-F42820321DB0F9800AE8B8FC6870@phx.gbl>
NNTP-Posting-Host: mozart.unx.sas.com
Mime-Version: 1.0
Content-Type: text/plain; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: foggy.unx.sas.com 1128781118 11285 10.19.150.41 (8 Oct 2005 14:18:38 GMT)
X-Complaints-To: usenet@unx.sas.com
NNTP-Posting-Date: Sat, 8 Oct 2005 14:18:38 +0000 (UTC)
Comments: Gated by NETNEWS@VM.SAS.COM
Return-Path: <owner-assembler-list@LISTSERV.UGA.EDU>
X-Originating-IP: [151.203.202.51]
X-Originating-Email: [john_w_gilmore@msn.com]
X-Sender: john_w_gilmore@msn.com
X-OriginalArrivalTime: 08 Oct 2005 14:13:08.0365 (UTC)
                       FILETIME=[687123D0:01C5CC12]
Approved-By: john gilmore <john_w_gilmore@MSN.COM>
In-Reply-To: <43474C5E.6060900@valley.net>
Return-Path: owner-assembler-list@LISTSERV.UGA.EDU
X-Mime-Autoconverted: from 8bit to quoted-printable by mime827
Originator: daemon@mozart.unx.sas.com