IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

use of EQU * in program


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
er_neo

New User


Joined: 10 Jan 2006
Posts: 18
Location: Indore

PostPosted: Fri Apr 11, 2008 5:41 pm
Reply with quote

Can anyone help me out in finding out what EQU * does when we use it in program.

For example following line as the first line of any para/lable

MP1005 EQU *

and some times we also use

MP1010 CKEQU *


Thanks
Bharat
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Apr 11, 2008 5:54 pm
Reply with quote

From distant memory (college course in 1967) - * refers to "here" - so this EQUates the name with this address.

Real assembler programmers - please aadvise.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Apr 11, 2008 6:14 pm
Reply with quote

In your example, MP1005 EQU * translates to; equate the current location counter to this label MP1005.

I'm unsure about MP1005 CKEQU *, because CKEQU is not a valid Assembler directive. Perhaps it's an in-house Macro which expands into an EQU *?

Somtimes a DS 0H is used in place of the EQU *, to ensure alignment.

HTH....

Regards,

Bill
Back to top
View user's profile Send private message
er_neo

New User


Joined: 10 Jan 2006
Posts: 18
Location: Indore

PostPosted: Fri Apr 11, 2008 6:33 pm
Reply with quote

Bill,
by your explainaing am i correct to derive a conclusion that at the begining of every label i have to use this EQU * dircetive?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Apr 11, 2008 7:01 pm
Reply with quote

No.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Apr 11, 2008 7:10 pm
Reply with quote

er_neo wrote:
Bill,
by your explainaing am i correct to derive a conclusion that at the begining of every label i have to use this EQU * dircetive?

My answer to this is "It depends".

Most of the time, an EQU * will suffice to equate the current location counter to the given label.

However, if you find existing code that uses a DS 0H as opposed to an EQU * to the current location counter, then this indicates that the programmer wanted to ensure alignment of the next instruction on a halfword-boundary.

Some Assembler programmers specify a label and at that label, they're issuing an instruction, for example, an MVC.

This is also valid, but (IMHO), including the EQU * of the label then followed by the instruction is good documentation and will not cause the load-module to be any larger.

So, it's up to the programmer as to how the label is defined and used in the given program. Personally, a label with an EQU *, then the next line specifying an instruction is my preference.

An EQU * can be used in many other ways, such as dynamically calculating a length or the remaining storage (IE: FILLER) of an area, something I wish COBOL would add to their next version. icon_cool.gif

EG:

Code:

STGDSECT DSECT                     CALLER'S REENTRANT-STG           
STGAREA  DS    0XL256              BEGIN CALLER-STG                       
RETNCODE DS    H                   RETURN-CODE HWORD                     
OFFSET   DS    H                   ALIGNED HWORD-OFFSET WORKAREA         
WRKFWORD DS    F                   ALIGNED FWORD-WORKAREA                 
RTNREGSA DS    F                   ALIGNED FWORD-SAVEAREA                 
DBLWORD  DS    D                   ALIGNED DBLWORD-WORKAREA               
REGSAVE  DS    18F                 18-WORD REGISTER-SAVEAREA             
OPENSTAT DS    CL1                 STATUS OF CALLER'S FILE               
WTOMSGA  DS    CL71                WTO-MSGAREA                           
EMPTYFIL DS    CL1                 EMPTY-FILE ('Y')                       
STGCALCR EQU   STGAREA+L'STGAREA-* CALCULATED STG-REMAINDER               
STGRMNDR DS    XL(STGCALCR)        REMAINING-STG                         

Basically, this calculation is "Calculate STGCALCR = Address of STGAREA plus the length of STGAREA minus the Current Location Counter". In this example, the result is X'0057'.

HTH....

Regards,

Bill
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Apr 11, 2008 9:18 pm
Reply with quote

Hello,

From long ago (when there were no online editors and assembler was "punched" on cards) the EQU * was often used so that a label could be put on a statement that was NOT an instruction. If it was necessary to add some instruction(s) after the label yet before the instruction extra "punch"ing was required. Also, using the EQU * often made the code more readable.
Back to top
View user's profile Send private message
er_neo

New User


Joined: 10 Jan 2006
Posts: 18
Location: Indore

PostPosted: Mon Apr 14, 2008 11:57 am
Reply with quote

Thanks a ton to all for such a nice explaination.
This helped my matter a lot.
Thanks again
Back to top
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Wed Apr 30, 2008 3:12 am
Reply with quote

It is better to use EQU * in a control section, only if we ensure that there are no data declarations in between.
All the instructions in assembler should be alligned to half-word boundary. and all the ad-cons adn v-cons should be aligned to fullword/double word boundaries.
It would result in a s0c6 abend, by improper use of EQU *
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top