Passing Parameter Lists?

High Level Assembler(HLASM) for MVS & VM & VSE

Passing Parameter Lists?

Postby Susansuth » Thu Nov 06, 2014 9:20 am

I understand the workings of a subroutine and passing a parameter list into a subroutine.

I'm kind of stymied, though, about how to continue passing parameters lists on.

So, let's say you have a Main routine, a subroutine A and a print routine.

You pass a parameter list from Main to Print. So far, so good.

How can you take parameters passed into Print and send them from Print to A?

Do you store the inputted parameters into a storage area and then load a parameter list like normal? I've tried different ways of doing it, but it doesn't seem to work properly. The correct addresses aren't being passed.

Can you use a register in a parameter list?

Any help would be appreciated! Thank you!

Posts: 15
Joined: Tue Oct 07, 2014 8:36 am
Has thanked: 9 times
Been thanked: 0 time

Re: Passing Parameter Lists?

Postby steve-myers » Thu Nov 06, 2014 10:50 am

A parameter list in Assembler can be a little difficult. There's the official rule and the rule usually used.

The official rule

A parameter list is a group of addresses. The address of this group of addresses is in register 1 when your program gets control. For example -
         CALL  XYZ,(DATA1,DATA2),VL
DATA1    DC    ...
DATA2    DC    ...

What program XYZ gets in register 1 is the address of
         DC    A(DATA1,X'80000000'+DATA2)
The VL in the CALL macro directs the macro to store the high order bit in the last word of the parameter list.

Now, in z/OS, if program XYZ is called from JCL, say
Register 1 will point to
         DC    A(X'80000000'+PARMLEN)
Obviously the contents of register 0, and registers 2 through 12 are pretty much undefined when a program is called through JCL. This is also true when a program is entered the ATTACH.

Unoffical Usage

When a program is entered through static linkage – that is with a CALL macro – registers 2 through 12 are not altered. Register 0 is not altered unless it is used by the macro for some reason, as is true of register 1. In other words,
         CALL  XYZ
will not alter registers 0 and 1.

In my work I heavily use a program that creates messages from a format. It is called like this.
         LA    0,FMTWORK
         LA    1,FORMAT
         L     15,=V(FMTPGM)
         CALL  (15)
FORMAT   ...
FMTWORK is just a work area, but it is also used as a buffer for the completed message. The contents of the FORMAT data area are just codes for FMTPGM to create the message.

You mentioned using a register. Well, part of the codes in the format are instructions to use registers as data addresses, or if it is done correctly, to use the contents of registers as data. For example
         DC    AL.2(3),AL.6(0),AL1(L'DCBDDNAM,0),SL2(DCBDDNAM),X'FF'
Now I won't go into much detail about the format - it would really work correctly with the format program. The SL2(DCBDDNAM) part of the last line is an address in base register offset form just like in an instruction. The format program constructs the address just like the hardware does for an instruction and inserts the data into the message.

Can you use a register in a parameter list?

Yes and no.
         LA    3,DATA2
         CALL  XYZ,(DATA1,(3)),VL
will not work; the CALL macro is too dumb. On the other hand
         LA   3,DATA2
         CALL  XYZ,(DATA1,(3)),VL,MF=(E,PARMLIST)
works fine. What you're doing here is creating a remote parameter list. The MF=(E,PARMLIST) stuff tells the CALL macro to create a remote parameter list and where it is.

You are asking good questions. I don't know enough about Assist to know the answers in Assist. The answers I'm giving apply to regular Assembler.
Global moderator
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Return to Assembler


  • Related topics
    Last post