IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Fourth Day Class (Assembler E-learning Cource)

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> PL/I & ASSEMBLER
View previous topic :: View next topic  
Author Message
kalpana



Joined: 19 Nov 2004
Posts: 25
Location: Banglore

Posted: Wed Dec 21, 2005 3:06 pm    Post subject: Fourth Day Class (Assembler E-learning Cource)  

I will explain simple Program
For adding two numbers
here is the code

NAME OPERATION OPERND FIELD
SAMPLE START 0
BALR 12,0
USING *,12

L 3,A1
A 3,A2
ST 3,RESULT

A1 DC F'10'
A2 DC F'20'
RESULT DS F
BR 14
END

This is a simple assembler code which adds two numbers and place the result in result variable.
Every assembler program should start with START command and ends with END command. In assembly language we will perform all operations uding registers tottaly 16 register we will use.
In assembler coding we have to establish addersabilty of the program. This can be achieved by using two instructions ie; BALR and Using
BALR is RR instruction in which the next sequential instruction vale will stired in the first operand. In this sample next sequential instruction value will be stored in 12 register and the secon opernad specifies the place where u want to branch. Here BALR 12,0 specifies 0 means no branching.
L--> stands for Load
L 3,A1
Load instructuion says that load the content of the memory location(A1) into the register 3
A--> Stands for Addition
A 3,A2
Add the content of memory loction (A2) to the register 3
ST--> Stands for Store
ST 3,Result
Store the content of the register (3) to the variabke Result
Then we need to define the space for the memory variables this can done by suing DC & DS statements
DC -Define Constant
By using this we can reserve memry space for a variable as well as we can assign value to the variale
DS --> Define Storage
By using this we can only reserve space for a variable

BR 14 --> Branch 14
It halts the execution of assembler program. Its like Stoprun in cobol.
Back to top  
Gautam512



Joined: 05 Oct 2005
Posts: 347
Location: Vizag / US

Posted: Fri Jan 06, 2006 11:48 pm    Post subject: Re: Fourth Day Class (Assembler E-learning Cource)  

Thanks for the Class,

Learnt Assembler a bit.

-Gau
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> PL/I & ASSEMBLER
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM