View previous topic :: View next topic
|
Author |
Message |
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
I have written below mentioned test code for calling a subprogram.
Code: |
L R15,=V(TESTPGM)
LA R1,ADDDATE
WTO 'SUBPROGRAM TESTPGM INVOKED'
BALR R14,R15
WTO 'RETURNED FROM TESTPGM'
ADDDATE DC 0CL80
OPERTN DC CL3' '
FILLER1 DC C' '
ADD1 DC F'30'
FILLER2 DC C' '
ADD2 DC H'20'
FILLER3 DC C' '
RESULT DC F'0'
FILLER4 DC CL64' ' |
I am getting SOC1 at the BALR instruction. The compilation of this program is successful . Please let me know anything else to be done while calling a subprogram. Thanks |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
You should never invoke other macros where you have done with your first WTO.
R1 is used by many macros and, in this case, WTO has used R1 and you have lost the addressability to the parameters to be passed to the called module.
Can you show the assembly listing? Is the PSW pointing at the BALR instruction?
Garry. |
|
Back to top |
|
|
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
This is what I could find in Abend Dump,
Code: |
* CALLING A SUBPROGRAM
L R15,=V(TESTPGM)
LA R1,ADDDATE
WTO 'SUBPROGRAM TESTPGM INVOKED
+ CNOP 0,4
+ BRAS 1,IHB0081A
+ DC AL2(30)
+ DC B'0000000000000000'
+ DC C'SUBPROGRAM TESTPGM INVO
+
+IHB0081A DS 0H
+ SVC 35
BALR R14,R15
WTO 'RETURNED FROM TESTPGM' |
Thanks a lot Gary. The prob is using the MACRO WTO before BALR instruction. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
You're welcome - glad I could help.
It's GaRRy though, not GaRy....
Garry. |
|
Back to top |
|
|
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
Hi Garry,
I am sorry ask this type questions. I tried to fidure out the reason but i couldn't find the issue.
Code: |
* CALLING A SUBPROGRAM
L R15,=V(TESTPGM)
L R1,=A(OPERTN,ADD1,ADD2,RESULT)
BALR R14,R15
WTO 'RETURNED FROM TESTPGM'
BACK RETURN (14,12),RC=0
*
ADDFLD DSECT
OPERTNA DC CL3' '
FILLER1A DC C' '
ADD1A DC FL4'30'
FILLER2A DC C' '
ADD2A DC HL2'20'
FILLER3A DC C' '
RESULTA DC FL4'0'
FILLER4A DC CL64' ' |
TESTPGM
Code: |
STM R14,R12,12(R13)
LA R14,SAVE18
ST R13,4(R0,R14)
ST R14,8(R0,R13)
LR R13,R14
LR R2,R1
WTO 'INSIDE TESTPGM'
L R3,0(R0,R2)
MVC OPERTN,0(R3)
WTO 'AFTER MVC OPERTN'
L R3,3(R0,R2)
MVC ADD1,0(R3)
WTO 'AFTER MVC ADD1'
SAVE18 DS 18F
ADDDATE DC 0CL80
OPERTN DC CL3' '
FILLER1 DC C' '
ADD1 DC F'30'
FILLER2 DC C' '
ADD2 DC H'20'
FILLER3 DC C' '
RESULT DC F'0'
FILLER4 DC CL64' ' |
Job is abending with SOC4 after displaying the message 'INSIDE TESTPGM'. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Quote: |
Job is abending with SOC4 after displaying the message 'INSIDE TESTPGM'. |
At which instruction in which program is the PSW pointing when it gets S0C4? I see you don't show a RETURN from the called program? If this is missing the system will try to interpret the contents at SAVE18 as instructions....
Garry. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Maybe I missed it, but I don't see CSECT addressability being established.
Also, I don't believe your PARMLIST for R1 is correct.
Instead -
Code: |
LA R1,OPERTN POINT TO 1ST-PARM
ST R1,PARMLIST STORE IN PARMLIST
LA R1,ADD1 POINT TO 2ND-PARM
ST R1,PARMLIST+4 STORE IN PARMLIST
LA R1,ADD2 POINT TO 3RD-PARM
ST R1,PARMLIST+8 STORE IN PARMLIST
LA R1,RESULT POINT TO 4TH-PARM
ST R1,PARMLIST+12 STORE IN PARMLIST
OI PARMLIST+12,X'80' INDICATE END-OF-PARMS
LA R1,PARMLIST POINT TO PARMLIST
*
PARMLIST DS XL16
|
Bill |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Bill O'Boyle wrote: |
Maybe I missed it, but I don't see CSECT addressability being established.
Bill |
This TS is notorious for only supllying snippets of code. |
|
Back to top |
|
|
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
I could see this message in JESMSGLG
TESTPGM ABENDED S0C4 AT 34+ DC C"OPEN OUTPUT FILE SUCCESS"
Job is abdending in called program.
I have established the addressability useing CSECT and also i have below to return back to calling program.
Code: |
LM R14,R12,12(R13)
BR R14 |
|
|
Back to top |
|
|
vinayknj
New User
Joined: 26 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
I could see this message in JESMSGLG
TESTPGM ABENDED S0C4 AT 34+ DC C"OPEN OUTPUT FILE SUCCESS"
But i haven't coded the line which is displayed above.
Job is abdending in called program.
I have established the addressability useing CSECT and also i have below to return back to calling program.
Code: |
LM R14,R12,12(R13)
BR R14 |
|
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Bill,
The instruction
Code: |
L R1=A(P1,P2,P3,P4) |
will genarate code whereby the ADCON addresses a group of addresses.
vinayknj
You may have established addressability but we can't see that 'cos you are only giving snippets of code. If you give the entire program(s) we can help more easily.
Your return from called program is suspect as you haven't first set R13 back to the caller's savearea. You are returning god-alone-knows-what from the called program's SAVEAREA instead of returning the values in the calling program's savearea. For this reason, you have unpredictable contents in R14 and then you try to RETURN there.
Garry. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Garry,
In all my years, I have never done it this way.
But, the last address doesn't indicate end-of-parms (high-order bit is on).
I like rudimentary approaches, it keeps my sanity....
Thanks,
Bill |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Bill,
I noticed that it doesn't set the end-of-parms bit and I most certainly don't do it that way myself - I just threw in a quick Assembly to see whether it assembles OK or not.
Can't speak to my own sanity....
Garry. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Unless you're specifically using the contents of R0 as an INDEX register, remove R0 and substitute it with a comma, because you really don't know what the value in R0 could be, unless of course, you're sure it's F'0'. The Assembler will recognize this comma as the omission of an INDEX register in the LOAD/STORE and other instructions -
Code: |
ST R13,4(,R14)
ST R14,8(,R13)
L R3,0(,R2)
L R3,3(,R2)
|
Bill |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
A correction. Use of R0 as an INDEX register informs the Assembler you've omitted this register. I've been using commas for years so the R0 thingy never dawned on me, unless I was using a non-R0 INDEX register.
I stand corrected....
Bill |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
If you want to actually get your code working you need to post more complete/useful info from now on. Do not pick and choose what you think someone here could use.
For starters, post the complete code from beginning to end and the informational messages printed before and after this:
"TESTPGM ABENDED S0C4 AT 34+ DC C"OPEN OUTPUT FILE SUCCESS"
It i quite possible that your system has a diagnostic or abend module like ABEND-AID that is trying to help you isolate the problem. |
|
Back to top |
|
|
|