Article View: bit.listserv.asm370
Article #61Re: Structured Macros Infinite Loop Warning
From: Edward E. Jaffe
Date: Fri, 07 Oct 2005 15:18
Date: Fri, 07 Oct 2005 15:18
83 lines
6084 bytes
6084 bytes
John Leonard wrote: >Just goes to show you if you want to code an IF statement code it in COBOL > >Those case macros just generate code that with generated labels creating >code difficult to read modify and maintain. >If see no advantage between an IF = instead BE > > There are *tremendous* advantages ... So-called "label management" -- e.g., coming up with unique labels, renumbering after an insertion of code (assuming you use numeric suffixes as many people do), etc. -- is error prone busy work. Every seasoned assembler programmer has seen the common error in which a loop is created by "cloning" a routine from one part of a program to another and forgetting to "fix up" one of the branches in the cloned routine. HLASM is an equal opportunity assembler -- all labels are equal. The assembler cannot distinguish a label that denotes the start of a subroutine -- for which all source code references are legitimate -- versus those "utility labels" used to create programming structures such as IF/THEN/ELSE, DO, SELECT, etc. Each label placed into the source code provides an opportunity for someone to jump to it. Jumping to a label in the middle of a "structure" is how unstructured "spaghetti" gets created. The SPMs take away the opportunity to write unstructured code by taking away the "utility labels" to which one might branch. Indentation of code is _by far_ the most powerful heuristic ever devised for programming languages to illustrate program flow. Some languages (e.g., ISPF panel language, Python, etc.) *require* indentation whereas most popular languages merely support its use. People write code formatters to enforce standards by indenting code. Source code editors, such as ISPF, have special support to help manage source code indentation. Use of the SPMs facilitates the use of indentation for assembler programs. For example: | ***************************************************** | * Issue Warning Message for Each Unreferenced Group * | ***************************************************** | ICM R4,B1111,PSECGDEF Point to group definitions | IF NZ If groups exist | DO INF Do for all groups | DOEXIT C,R4,GE,PSECGDEFP Exit if no more groups | USING GRPDEF,R4 *** Synchronize GRPREF | LHI R15,4 Assume reference not found | ICM R5,B1111,PSECGREF Point to group references | IF NZ If references exist | USING GRPREF,R5 *** Synchronize GRPREF | DO INF Do for all references | DOEXIT C,R5,GE,PSECGREFP Exit if no more references | IF CLC,GRPDEFName,EQ, If matching group | GRPREFName (same) | XR R15,R15 Show reference found | LEAVE , Exit the loop | ENDIF , EndIf matching group | AHI R5,GRPREFLen Advance reference pointer | ENDDO , EndDo for all references | DROP R5 *** Drop GRPREF | ENDIF , EndIf references exist | IF LTR,R15,R15,NZ If unreferenced group | . | . (issue warning message) | . | ENDIF , EndIf unreferenced group | AHI R4,GRPDEFLen Advance group pointer | ENDDO , EndDo for all groups | ENDIF , EndIf groups exist My hope is that one day HLASM will natively support -- as its name implies -- a truly "high level" assembler language that will make the SPMs unnecessary. In the mean-time, the SPMs provide an acceptable substitute - IMHO. -- .-----------------------------------------------------------------. | Edward E. Jaffe | | | Mgr, Research & Development | edjaffe@phoenixsoftware.com | | Phoenix Software International | Tel: (310) 338-0400 x318 | | 5200 W Century Blvd, Suite 800 | Fax: (310) 338-0801 | | Los Angeles, CA 90045 | http://www.phoenixsoftware.com | '-----------------------------------------------------------------'
Technical Details
Message-ID:
<434691B1.7040005@phoenixsoftware.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!sn-xit-02!sn-xit-06!sn-xit-14!supernews.com!149.173.6.116.MISMATCH!foggy!vm.sas.com!phoenixsoftware.com!edjaffeReferences:
<OFBC1F2B54.20B857C0-ON85257092.005648E3-85257092.00568ADA @westfield-cos.com>Show Full Headers
Complete Article Headers
X-Google-Thread: fcdcb,89ec88f8cee0d19f
X-Google-Attributes: gidfcdcb,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!sn-xit-02!sn-xit-06!sn-xit-14!supernews.com!149.173.6.116.MISMATCH!foggy!vm.sas.com!phoenixsoftware.com!edjaffe
From: "Edward E. Jaffe" <edjaffe@phoenixsoftware.com>
Newsgroups: bit.listserv.asm370
Subject: Re: Structured Macros Infinite Loop Warning
Date: Fri, 7 Oct 2005 08:18:09 -0700
Organization: SAS Inc.
Lines: 83
Sender: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU>
Message-ID: <434691B1.7040005@phoenixsoftware.com>
References: <OFBC1F2B54.20B857C0-ON85257092.005648E3-85257092.00568ADA
@westfield-cos.com>
NNTP-Posting-Host: mozart.unx.sas.com
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: foggy.unx.sas.com 1128698556 6213 10.19.150.41 (7 Oct 2005 15:22:36 GMT)
X-Complaints-To: usenet@unx.sas.com
NNTP-Posting-Date: Fri, 7 Oct 2005 15:22:36 +0000 (UTC)
Comments: Gated by NETNEWS@VM.SAS.COM
Return-Path: <owner-assembler-list@LISTSERV.UGA.EDU>
User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)
X-Accept-Language: en-us, en
Approved-By: "Edward E. Jaffe" <edjaffe@PHOENIXSOFTWARE.COM>
In-Reply-To: <OFBC1F2B54.20B857C0-ON85257092.005648E3-85257092.00568ADA
@westfield-cos.com>
Return-Path: owner-assembler-list@LISTSERV.UGA.EDU
X-OriginalArrivalTime: 07 Oct 2005 15:22:34.0695 (UTC)
FILETIME=[F15AE570:01C5CB52]
Originator: daemon@mozart.unx.sas.com