Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to pass dynamically parameters to the sub program

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

New User


Joined: 19 Nov 2004
Posts: 24
Location: Banglore

PostPosted: Wed Jul 23, 2008 3:32 pm    Post subject: How to pass dynamically parameters to the sub program
Reply with quote

Hi all,
Could any one please let me know the answers for the below assembler questions

1) How to pass parameters to the sub program and how we will recieve it back? ( I need this with sample code)

2) How to access array elements in assembler?

3) what is the significane of NOP ( No Operation)

4) How you can call a sub program dynamicaly
Back to top
View user's profile Send private message

Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 998
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Jul 23, 2008 3:51 pm    Post subject:
Reply with quote

1) Parameters are passed, by convention, using register 1 (R1). R1 is set to the address of the first parameter. The last parameter in the parameter list has the high-order bit set 'on'.

Thus:
Code:
 

            L    R1,=A(FIRST)
            ST  R1,PARM1                 
            L    R1,=A(SECOND)
            ST  R1,PARM2
            L    R1,=A(THIRD)
            ST  R1,PARM3
            OI  PARM3,X'80' 
            L    R1,=A(PARMLIST)
         
            CALL  NEXTPROG


PARMLIST    DS   0F
PARM1       DS   F       
PARM2       DS   F       
PARM3       DS   F   




NEXTPROG will have code to retrieve these parms - e.g.

Code:


              LM    R2,R4,0(R1)
              LA    R4,0(R4)              * lose high-order bit



Any changes made are visible to the calling program at the addresses specified.

2) A number of ways. For an array with multiple fields per array entry, provide a DSECT which describes those fields. Using registers, caclulate the offset to the array entry to require and align the DSECT before using the field names.

3) NOP is a "no operation". Its significance depends on the program context. It might be modified "on the fly" to a branch, though that's frowned upon these days.

4) If you don't link the program as static at linkedit time it should be called dynamically.

Regards,
Garry.
Back to top
View user's profile Send private message
kalpana

New User


Joined: 19 Nov 2004
Posts: 24
Location: Banglore

PostPosted: Wed Jul 23, 2008 5:11 pm    Post subject: Reply to: How to pass dynamically parameters to the sub prog
Reply with quote

Thanks alot for ur quick response.
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm
No new posts Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 5 Sat Aug 19, 2017 2:33 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us