I am aware of the fact that we can pass values from JCL to the assembler program by using PARM parameter in JCL and can accept them in the program by R1 register. But, when I saw some of the code in my org. I was confused. As soon as, the program is starting, they are moving the values from R01 to some other register by using L e.g. L R10,0(R1)
In this case, what does R10 contains,
1) does it contain the actual parm values or
2) does it contain the address that points to the actual parm values?
I thought that it contained the actual parm values because LOAD instruction will copy the value in the memory pointed by second operand to the first operand register. In the above example, the displacement is 0 and hence its actual address = content of R1 + 0 = content of R1 = address of the location where parm is stored. Thus, the value at the actual address is taken and loaded into the register by the L instruction.
Please let me know if my understanding is correct or not.
At entry, R1 points to a LIST of ADDRESSES, each of which points to one of the parms passed to the program. In the case of EXEC parms being passed from JCL, there is only ONE parm - hence R1 points to a LIST which contains only one address: the address of the Exec Parm.
Thus, the instruction
L R10,0(R1)
loads the FIRST ( 0 offset ) address contained in the list into R10. So, after the Load, R10 will contain the address of the FIRST parm ( which, if passed from JCL is also the ONLY parm ).
Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
As Ron said, after the LOAD instruction, R10 will contain the address of the parm. Because there is only one parm, the high-order bit of this address will be on (X'80') to signify the end of parms.
Code:
PARMAREA DS CL100 MAXIMUM PARMAREA IS 100-BYTES
PARMLGTH DS H HWORD-LGTH (FOR EX)
L R10,0(,R1) PARM ADDRESSABILITY
MVC PARMLGTH,0(R10) MOVE HWORD-LGTH
LH R15,PARMLGTH LOAD R15 WITH LGTH
AHI R15,-1 DECREMENT FOR 'EX'
BM BADPARML PROBLEM - R15 WENT NEGATIVE
XC PARMAREA,PARMAREA ENSURE X'00'S
EX R15,MOVEPARM POPULATE PARMAREA
As far as I recall, the length of the halfword (2) is not part of the overall parm-length. So, if there are 60-bytes of parm-data, the halfword would equal 60 (R15 is 59 for the EX) and the data would begain at 2-off R10.