View previous topic :: View next topic
|
Author |
Message |
er_neo
New User
Joined: 10 Jan 2006 Posts: 18 Location: Indore
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
er_neo
New User
Joined: 10 Jan 2006 Posts: 18 Location: Indore
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
No. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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.
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
er_neo
New User
Joined: 10 Jan 2006 Posts: 18 Location: Indore
|
|
|
|
Thanks a ton to all for such a nice explaination.
This helped my matter a lot.
Thanks again |
|
Back to top |
|
|
manikawnth
New User
Joined: 07 Feb 2007 Posts: 61 Location: Mumbai
|
|
|
|
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 |
|
|
|