Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

EQU Directive in Assembler

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: EQU Directive in Assembler
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    Post subject:
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    Post subject: EQU Directive in Assembler
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.
http://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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Dump analysis of an assembler module monica1 PL/I & Assembler 4 Tue May 09, 2017 10:05 am
No new posts A not very Christmassy PL/I tale, wit... prino PL/I & Assembler 3 Mon Dec 26, 2016 1:01 am
No new posts Online Assembler Program Starting point Aditya.Srivastava PL/I & Assembler 4 Fri Jul 08, 2016 6:48 pm
This topic is locked: you cannot edit posts or make replies. MVS Assembler profiles for Pune Locat... shailesh_do Mainframe Jobs 0 Mon Feb 22, 2016 6:21 pm
No new posts ASRA abend calling Assembler from CICS surya8 PL/I & Assembler 13 Thu Sep 10, 2015 7:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us