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

EQU Directive in Assembler


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

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Tue Sep 09, 2008 10:50 am
Reply with quote

Hi,

Can any one please let me know the meaning of EQU, when two parameters are mentioned after EQU. For example, in the below example, in the first EQU 4 and 4 is quoted and in the second EQU 8 and 4 is quoted.

PUTPTR EQU 4,4
EOBO EQU 8,4

I understand that if it is
PUTPTR EQU 4,
that implies that PUTPTR will be replaced by 4 in the program, but I am not sure what does the second parameter do?

Any help in this regard is highly appreciated.

Thanks,
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Tue Sep 09, 2008 4:25 pm
Reply with quote

Second perameter of EQU indicates length attribute of the field. If it is not specified assembler will assign the length attribute from first expression.

Manual reads like this.

The EQU instruction allows you to assign absolute or relocatable values to symbols. You can use it to:
: Assign single absolute values to symbols.
: Assign the values of previously defined symbols or expressions to new symbols, thus allowing you to use different mnemonics for different purposes.
: Compute expressions whose values are unknown at coding time or difficult to calculate. The value of the expressions is then assigned to a symbol.


FORMAT

symbol EQU expression_1,expression_2,expression_3

symbol is one of the following:

: An ordinary symbol
: A variable symbol that has been assigned a character string with a value that is valid for an ordinary symbol

expression_1

represents a value that the assembler assigns to the symbol in the name field. Expression_1 may have any value allowed for an assembly expression: absolute (including negative), relocatable, or complexly relocatable. The assembler carries this value as a signed 4-byte (32-bit) number; all four bytes are printed in the program listings opposite the symbol.

Any symbols used in expression_1 need not be previously defined. However, if any symbol is not previously defined, the value of expression_1 is not assigned to the symbol in the name field until assembly time and therefore may not be used during conditional assembly.

If expression_1 is a complexly relocatable expression, the whole expression, rather than its value, is assigned to the symbol. During the evaluation of any expression that includes a complexly relocatable symbol, that symbol is replaced by its own defining expression.
Consider the following example, in which A1 and A2 are defined in one control section, and B1 and B2 in another:

X EQU A1+B1
Y EQU X–A2–B2

The first EQU statement assigns a complexly relocatable expression (A1+B1) to X. During the evaluation of the expression in the second EQU statement, X is replaced by its defining relocatable expression (A1+B1), and the assembler evaluates the resulting expression (A1+B1-A2-B2) and assigns an absolute value to Y, because the relocatable terms in the expression are paired.

expression_2

represents a value that the assembler assigns as a length attribute value to the symbol in the name field. It is optional, but, if specified, must be an absolute value in the range 0 to 65,535. This value overrides the normal length attribute value implicitly assigned from expression_1.

All symbols appearing in expression_2 must have been previously defined. If expression_2 is omitted, the assembler assigns a length attribute value to the symbol in the name field according to the length attribute value of the extreme left (or only) term of expression_1, as follows:

1. If the extreme left term of expression_1 is a location counter reference (*), a self-defining term, or a symbol length attribute value reference, the length attribute is 1. This also applies if the extreme left term is a symbol that is equated to any of these values.

2. If the extreme left term of expression_1 is a symbol that is used in the name field of a DC or DS instruction, the length attribute value is equal to the implicit or explicit length of the first (or only) constant specified in the DC or DS operand field.

3. If the extreme left term is a symbol that is used in the name field of a machine instruction, the length attribute value is equal to the length of the assembled instruction.

4. Symbols that name assembler instructions, except the DC, DS, CCW, CCW0, and CCW1 instructions, have a length attribute value of 1. Symbols that name a CCW, CCW0, or CCW1 instruction have a length attribute value of 8.

5. The length attribute value described in cases 2, 3, and 4 above is the assembly-time value of the attribute. The length attribute value assigned by the assembler during conditional assembly processing is always 1.
Back to top
View user's profile Send private message
alokagarwaljgd

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Tue Sep 09, 2008 5:53 pm
Reply with quote

Hi hchinnam,

Seems like you have pasted the content from the below link, which I had already undergone. But I am not able to understand it.
publib.boulder.ibm.com/infocenter/ratdevz/v7r1m1/index.jsp?topic=/com.ibm.ent.asm.zos.doc/topics/fn1pgmst365.htm

Hence, I had requested to explain the concept with the example that I had quoted.

Thanks,
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 Build dataset list with properties us... PL/I & Assembler 4
No new posts Finding Assembler programs PL/I & Assembler 5
No new posts How Can I Recall a Migrated Data Set ... PL/I & Assembler 3
No new posts step by step trace 4 ISPF dialog call... TSO/ISPF 17
No new posts Getting SOC4 while calling a Cobol DB... PL/I & Assembler 4
Search our Forums:

Back to Top