The OP may want to change to an AREAD loop within one macro. I have attached one of my simpler ones. It generates a branch table with range checking. I have more complex ones that build tables just like the OP wants. The attached macro us used thus:
         BRANCH_ON (R15)
               SSS_CK_ENTRIES          0
               SSS_CK_TOO_MANY         4
               SSS_CK_NONE             8
               SSS_CK_BADR15           12
               SSS_CK_BADR15           16
               -----
SSS_CK_BADR15 DS 0H
         MESSAGE 0026,=CL8'CHECK',RETCODE
         B     RETURN16

Here is an example of the data input to one of my complex macros build a data table:

         PTABLE PREFIX=PK_,LENGTH_ID=KT_E_LENGTH
DUMMY                CHAR
COMPANY_NAME         CHAR
PASSWORD             CHAR
SUPPORT_EMAIL_ADDR   CHAR
FFFFFF XXX

The program using this macro actually builds about 200 table rows, not just the 4 I am showing.
Tony Thigpen

Keven wrote on 3/4/19 11:47 PM:
The OP’s table is built with multiple macro invocations so a global SETC variable is required in order for the table to persist from one invocation to the next.
Keven
        
        

        



On Mon, Mar 4, 2019 at 7:51 PM -0600, "Jon Perryman" <[email protected]> 
wrote:










  Using GBLC is rarely needed to generate these types of tables (e.g. cics and 
IMS definitions).
If you really need the table in a different location, then use LOCTR. Even 
generating a different CSECT would work.
Regards, Jon.
     On Monday, March 4, 2019, 11:27:15 AM PST, Charles Mills  wrote:
Cool! New since I was last writing serious HLASM macros. Also suggested by someone else. It's a good solution to the stated problem but I think the GBLC array might be his best solution overall since it would feed directly into generating the table. It's not elegant -- sequentially searching an unsorted character array again and again in what is basically an interpreted language -- but it would do the job.

Charles


         MACRO
&NAME    BRANCH_ON &ADDR,&BAD_VALUE=                                  ~
&GOBAD   SETC  'A&SYSNDX'
         AIF   ('&BAD_VALUE' EQ '' ).NOBV
&GOBAD   SETC  '&BAD_VALUE'
.NOBV    ANOP
         MACPARM L,R1,&ADDR
         CL    R1,A&SYSNDX             MUST BE LOGICAL, NOT NBR COMPARE
         BH    &GOBAD                  . BRANCHES FOR BOTH HIGH & MINUS
         LA    R0,3
         NR    R0,R1
*        LTR   R0,R0      REMOVED 8/25/12 AS NR SETS THE CC
         BNZ   &GOBAD
         B     B&SYSNDX.(R1)
B&SYSNDX DS    0F
.READ    ANOP
&CARD    AREAD NOSTMT
&FLD     SETC  '&CARD'(16,39)
&COMMENT SETC  '&CARD'(40,30)
         AIF   ('&CARD'(1,1) EQ '*').READ
         AIF   ('&CARD'(16,1) EQ '-').CARDEND
         AIF   ('&CARD'(16,1) EQ ' ').INVALID
         AIF   ('&CARD'(16,3) EQ 'N/A').INVALID
.GETL    ANOP
&L       SETA  0
.GETFLD  AIF   ('&FLD'(&L+1,1) EQ ' ').STORE
&L       SETA  &L+1
         AGO   .GETFLD
.INVALID ANOP
&FLD     SETC  '&GOBAD '
         AGO   .GETL
.STORE   ANOP
&WHERE   SETC  '&FLD'(1,&L)
&WHEREX  SETC  '&WHERE                         '(1,24)
         B     &WHEREX&COMMENT
         AGO   .READ
.CARDEND ANOP
         DS    0H
A&SYSNDX DC    X'0000'    FORCE ABEND  | MUST BE TOGETHER FOR THE
C&SYSNDX DC    Y(*-B&SYSNDX-4-2)       | CL TEST TO WORK
         MEND

Reply via email to