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
 

 

Passing values from JCL to Assembler program

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

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Wed May 19, 2010 6:50 pm    Post subject: Passing values from JCL to Assembler program
Reply with quote

Can anyone please explain how we can pass and retrieve the parameter values from a JCL to an Assembler program with the help of an example?

Alok Agarwal
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed May 19, 2010 7:03 pm    Post subject:
Reply with quote

I can only assume that you have neither read the manual nor searched the forum.

A google search finds four or five examples on this forum.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 19, 2010 9:38 pm    Post subject:
Reply with quote

Hello,

What have you tried? Where are you stuck?
Back to top
View user's profile Send private message
alokagarwaljgd

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Wed May 19, 2010 11:09 pm    Post subject: Reply to: Passing values from JCL to Assembler program
Reply with quote

Hi Expat and Dick,

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.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Wed May 19, 2010 11:23 pm    Post subject:
Reply with quote

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 ).
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 19, 2010 11:52 pm    Post subject: Reply to: Passing values from JCL to Assembler program
Reply with quote

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

MOVEPARM MVC   PARMAREA(*-*),2(R10) POPULATE PARMAREA (EXECUTED)

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.

So, you may want to double check this....

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 BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 1 Tue Jul 25, 2017 12:12 am
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Compiling program in endeavor for tra... RALAKKAL Compuware & Other Tools 4 Mon Jun 05, 2017 8:27 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am


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