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
 

 

How to pass more than one parameters in Assembler?

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

New User


Joined: 18 Mar 2005
Posts: 48
Location: india

PostPosted: Mon Sep 18, 2006 11:51 am    Post subject: How to pass more than one parameters in Assembler?
Reply with quote

Hello Guys,

I have to write an assembler program which gets two parameters for eg. Name and address. Name is 10 character and address is 20 characters. Now I have to accept this two parameters and then I have to write the output to a file. How to do this ?

Also, How to identify the number of incoming parameters to an assembler program?

Please let me know if you need any clarification on my question.

Thanks in advance.

Regards,
Gokuldass
Back to top
View user's profile Send private message

kamran

New User


Joined: 01 May 2005
Posts: 55

PostPosted: Mon Sep 18, 2006 3:02 pm    Post subject: Re: How to pass more than one parameters in Assembler?
Reply with quote

Hi,
Depending on calling procedure input data have different format. eg. if you call your program directly with jcl and passing data to it through PARM filed of EXEC statement,upon entering to your program register 1 contains the address of input parm such that it's first two byte(half word) contains the length of input parm.So you can pass both the Name and address with parm field and define a dsect in your program to use them.
under tso the logic is the same except that register 1 contains address of a structure which is listed bellow:
first: a half word contains overall parm length including command(program name) and input parm +4.
second: a half word contains command(program name) length.
third:a string with length equal second half word containing command name.
forth: a string which contains the actual passed parm which it's length can be calculated upon previous information.
Anyhow as I can guess you are trying to call your program from another.In these cases again it depends on the calling program that how it arranged passing parameter.in most cases when there is multiple parameters passed to a program upon entrance to called program register 1 contains address of sequences of addresses which those point to each parameter.
at final it depends on the way which the parameters arranged in calling program but all of them pass an addresses to called program through general register 1.
you can explain your requirement specifically if you need more help.
one way to show number of parameter to called program is to pass a null word at end of the parameter addresses chain with high bit on.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 755
Location: Germany

PostPosted: Mon Sep 18, 2006 3:08 pm    Post subject:
Reply with quote

Hi !

Are these parms passed by an other programm to your ass-pgm or by JCL ? The difference is, that if it's passed by JCL the number of parms are static as long as you not change the JCL. By a programm-call the numer of parms can vary, if youe design that. But this depends on your design and the things, your programm has to do.

But anyway, the adress of the adress of the parameters your getting in Register-One. The length of the parameterlist is in the first halfword.


So, if your programm gets them form JCL, here's an example

SR R3,R3 ...clean register 3
SR R5,R5 ...clean register 5

L R3,0(R1) ...load adress
LH R5,0(R3) ...load length

LTR R5,R5 ...check length zero
BZ NO_PARAMETERS

C R5,=F'30' ...check correct length of a parm-string
BNE NO_CORRECT_PARAMETERS

EX R5,GET_PARAMETERS
....store parm in pgm-field depending on length

GET_PARAMETERS MVC PARAMS,2(R3)

PARAMS DS 0CL30
PA_NAME DC CL10
PA_ADRESS DC CL20


So, if your programm gets them form another , here's an example

Parm like this: 10bytes name followed by 20bytes adress

L R1,0(R1) ....load adress of adress
L R3,0(R1) ...now load adress of parmfield (30Bytes)

MVC FIELD(30),0(R3)

or parm is like this: adress of name-field, adress of adress-field

L R1,0(R1) ....load adress of adress
L R3,0(R1) ...now load adress of parm-name (10Bytes)
L R4,4(R1) ...now load adress of parm-adress (30Bytes)

or parm is like this: adress of two adresses, first=name&second=adress

L R1,0(R1) ...load adress of adress
LM R3,R4,0(R1) ...R3 points to parm-name / R4 to parm-adress

Hope that satisfies, regards, UmeySan
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 A not very Christmassy PL/I tale, wit... prino PL/I & Assembler 3 Mon Dec 26, 2016 1:01 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Online Assembler Program Starting point Aditya.Srivastava PL/I & Assembler 4 Fri Jul 08, 2016 6:48 pm


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