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
 

 

Housekeeping activities in Assembler

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Wed May 12, 2010 8:13 pm    Post subject: Housekeeping activities in Assembler
Reply with quote

Hi All,

Can anyone give some idea on Housekeeping activities in Assembler?

I means activities need to carried out in the beginning of the program and just before end of the program.

Kindly let me know why these activities need to carried out.

I would be very much thankful if you explain with some examples.

Thanks in advance.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Wed May 12, 2010 8:22 pm    Post subject:
Reply with quote

no much philosophical difference between PL/1 and COBOL.
since your skills are COBOL (and PL/1), I imagine you can answer the question, yourself.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Wed May 12, 2010 8:27 pm    Post subject:
Reply with quote

Very similar to the COBOL prologue (assuming you've looked at the pseudo assembler generated by COBOL). Starting the program, you have to establish addressability for your program, set up save area linkage, and so forth. Ending the program, you have to restore registers, set the return code and any returned values before exiting.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Wed May 12, 2010 8:39 pm    Post subject: Reply to: Housekeeping activities in Assembler
Reply with quote

Is this CICS or Batch?

Bill
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Thu May 13, 2010 11:46 am    Post subject:
Reply with quote

Thank you all for your quick reply,

Hi Robert,

I have looked at pseudo assembler generated by COBOL/PL1 but I was not aware of Assembler so I couldn't understand what is happening there.

Now I have understand in the starting of a ASM program we need to
1. Establish addressability for the program
2. Set up save area linkage, and so forth.

And in ending the program,

1. Need to restore registers
2. Set the return code and any returned values

Could you please explain me above points by taking some sample code if available? then I will have some clear idea.

I am very sorry if I am troubling you with my questions.

Thanks in advance.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Thu May 13, 2010 4:32 pm    Post subject:
Reply with quote

This is customized for some things I was doing, but start up code should look something like:
Code:
MF0119   CSECT
         REGEQU                       Use variables for registers for cross reference
         STM   R14,R12,12(R13)        Save registers in calling program save area
         LR    R12,R15                Save address of program
         USING MF0119,R12             Establish addressability
         LA    R15,SAVEAREA           Set up save area
         ST    R13,4(R15)             Forward save area chain
         ST    R15,8(R13)             Backwards save area chain
         LR    R13,R15                New save area
while the wrap up code can be something like
Code:
         L     R13,SAVEAREA+4     CALLING PROGRAM SAVE AREA
         XR    R15,R15            RETURN CODE ZERO
         RETURN (14,12),RC=(15)   MACRO TO RESTORE REGS, USING RC IN 15
Return is an IBM macro stored in SYS1.MACLIB typically.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2433
Location: Netherlands, Amstelveen

PostPosted: Thu May 13, 2010 4:53 pm    Post subject:
Reply with quote

see :

http://ibmmainframes.com/viewtopic.php?t=47046&highlight=initscc
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Thu May 13, 2010 5:54 pm    Post subject: Reply to: Housekeeping activities in Assembler
Reply with quote

For CICS/Assembler, the normal Prologue Code will perform most of your housekeeping as Robert has posted for Batch.

When returning to the Caller, set your R15 (this is a substitute for the RETURN Macro) and issue -

Code:

CICSPROG DFHEIENT CODEREG=R3,DATAREG=R13,EIBREG=R11
         XR    R15,R15             SET 'NORMAL' RETURN-CODE
CICSRETN EQU   *
         DFHEIRET RCREG=R15        RETURN TO CALLER
         END   

The DFHEIRET Macro will generate an internal FREEMAIN and free the previously acquired Dynamic-Stg (DFHEISTG) from the Prologue and return to the Caller, preserving R15, which can then be checked by the Caller. For COBOL Callers, R15 equates to the RETURN-CODE Special-Register.

For the most part, you can optionally substitute DFHEIRET for an EXEC CICS RETURN, but this should be confirmed.

Note: Be cautious with R12 because it contains the address of the Common Anchor Area (CAA) from the HLL Caller. I've gotten in the habit of using R3 instead and have left R12 "Off Limits".

Bill
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 To know activities on db2 tables ashek15 DB2 4 Fri Mar 03, 2017 11:23 pm
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


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