***********************************************************************
MAIN STM 14,12,12(13)
BALR 12,0
USING *,12
ST 13,SAVE+4
LA 13,SAVE
***********************************************************************
* DYNAMIC CALL USING LOAD MACROS -- CALLING PROGRAM
* PASSING PARAMETER
***********************************************************************
LOAD EPLOC=SUBPGM03
ST 0,WSREG0
L 15,WSREG0
LA 1,LPARM
* L 1,=A(P1)
BASSM 14,15
**********************************************************************
* DYNAMIC CALL USING LOAD MACROS -- CALLING PROGRAM
* PASSING PARAMETER
**********************************************************************
LOAD EPLOC=SUBPGM03
ST 0,WSREG0
L 15,WSREG0
LA 1,LPARM
* L 1,=A(P1)
BASSM 14,15
LTR 15,15
BZ CALL2
ABEND 4080,DUMP
CALL2 L 15,WSREG0
LA 1,LPARM
WTO 'CALL2'
BALR 14,15
LTR 15,15
BZ EXIT
ABEND 4080,DUMP
***********************************************************************
*
***********************************************************************
EXIT L 13,SAVE+4
L 14,12(0,13)
LM 0,12,20(13)
BR 14
***********************************************************************
* STORAGE SECTION
***********************************************************************
SAVE DS 18F
WSF DS F
WSREG0 DS F
SUBPGM03 DC CL8'TESTPG03'
P1 DC F'5'
P2 DC F'600'
P3 DC F'700'
LPARM DS 0F
DC A(P1)
DC A(P2)
DC A(P3)
END
***********************************************************************
MAIN STM 14,12,12(13)
BALR 12,0
USING *,12
LR 3,1
GETMAIN R,LV=LEN,LOC=BELOW
ST 13,4(0,1)
LR 13,1
USING WS,13
***********************************************************************
* DYNAMIC CALL USING LOAD MACROS -- CALLING PROGRAM
* PASSING PARAMETER
***********************************************************************
* LR 5,3
LM 5,7,0(3)
L 8,0(5)
L 9,0(,6)
L 10,0(,7)
XR 4,4
AR 4,8
AR 4,9
AR 4,10
***********************************************************************
*
***********************************************************************
EXIT L 2,13
L 13,4(0,2)
FREEMAIN R,LV=LEN,A=(2)
RETURN (14,12),,RC=0
***********************************************************************
* STORAGE SECTION
***********************************************************************
WS DSECT
SAVE DS 18F
LEN EQU *-WS
END
***********************************************************************
MAIN STM 14,12,12(13)
BALR 12,0
USING *,12
GETMAIN R,LV=LEN,LOC=BELOW
ST 13,4(0,1)
LR 13,1
USING WS,13
***********************************************************************
* DYNAMIC CALL USING LOAD MACROS -- CALLING PROGRAM
* PASSING PARAMETER
***********************************************************************
WTO 'TEST'
***********************************************************************
*
***********************************************************************
EXIT L 2,13
L 13,4(0,2)
FREEMAIN R,LV=LEN,A=(2)
RETURN (14,12),,RC=0
***********************************************************************
* STORAGE SECTION
***********************************************************************
WS DSECT
SAVE DS 18F
LEN EQU *-WS
END
For allocating and de-allocating main-storage, i'm always using a sub-programm, which receives the required length and storage-mode from the calling programm. Then it returns adress of space.
If functionmode is "GETT", it does a getmain
If functionmode is "FREE", it does a freemain
GETMAIN
MVC ANZBYTES,MDL00910_ANZBYTE ...get needed bytes
...from calling pgm
L R7,ANZBYTES ...load them into reg
LPR R8,R7 ...make them positiv
IF MDL00910_STOMODE,EQ,=C'24'
GETMAIN RU,LV=(R8),BNDRY=PAGE,LOC=BELOW
EIF
IF MDL00910_STOMODE,EQ,=C'31'
GETMAIN RU,LV=(R8),BNDRY=PAGE,LOC=ANY
EIF
ST R1,ANZBYTES ...adress of storage
MVC MDL00910_ADRESSE,ANZBYTES ...return it to calling-pgm
FREEMAIN
MVC ANZBYTES,MDL00910_ANZBYTE ...length
L R0,ANZBYTES ...into reg-0
MVC ANZBYTES,MDL00910_ADRESSE ...adress
L R1,ANZBYTES ...into reg-1
I am able to solve the problem to some extent which was earlier due GETMAIN and FREEMAIN macros.
Actually, what i am trying do is i have two programs TESTP03 (Calling prog) and TESTPG03 (called prog).
I am calling TESTPG03 two times from TESTP03.
First time.
I have called subprog using LOAD and BALR. This call was successfull.
But second time (As per my knowledge) the Subprog is already in storage because i didnt issue DELETE macro after executing the sub prog first time. So i am just passing control to same prog TESTPG03 second time using BALR. Here i got SOC1 abend saying that unable to point the subprog TESTPG03 again.
And also TESTPG03 subprog is re entrant. I can call it in same prog number of times (Please correct if i am wrong).
My question is how can i load the program second time using LOAD macro.
Is the subprog TESTP03 is properly coded for Re entrant.? ( I have compiled this using rent option and i didnt see any where that subprog is failed for reentrant. )
i have pasted modified prog again please ignore the prog i pasted earlier.
***********************************************************************
MAIN STM 14,12,12(13)
BALR 12,0
USING *,12
ST 13,SAVE+4
LA 13,SAVE
***********************************************************************
* DYNAMIC CALL USING LOAD MACROS -- CALLING PROGRAM
* PASSING PARAMETER
***********************************************************************
LOAD EPLOC=SUBPGM03
ST 0,WSREG0
L 15,WSREG0
LA 1,LPARM
BASSM 14,15
LTR 15,15
BZ CALL2
ABEND 4080,DUMP
CALL2 L 15,WSREG0
LA 1,LPARM
WTO 'CALL2'
BASSM 14,15
LTR 15,15
BZ EXIT
ABEND 4080,DUMP
***********************************************************************
*
***********************************************************************
EXIT L 13,SAVE+4
L 14,12(0,13)
LM 0,12,20(13)
BR 14
***********************************************************************
* STORAGE SECTION
***********************************************************************
SAVE DS 18F
WSF DS F
WSREG0 DS F
SUBPGM03 DC CL8'TESTPG03'
P1 DC F'5'
P2 DC F'600'
P3 DC F'700'
LPARM DS 0F
DC A(P1)
DC A(P2)
DC A(P3)
END
***********************************************************************
MAIN STM 14,12,12(13)
BALR 12,0
USING *,12
LR 3,1
L 2,WKSIZE
GETMAIN R,LV=(2)
ST 13,4(0,1)
LR 13,1
USING WS,13
***********************************************************************
* DYNAMIC CALL USING LOAD MACROS -- CALLING PROGRAM
* PASSING PARAMETER
***********************************************************************
LM 5,7,0(3)
L 8,0(5)
L 9,0(,6)
L 10,0(,7)
XR 4,4
AR 4,8
AR 4,9
AR 4,10
***********************************************************************
*
***********************************************************************
EXIT LR 1,13
L 0,WKSIZE
L 13,4(0,1)
FREEMAIN R,LV=(0),A=(1)
RETURN (14,12),,RC=0
***********************************************************************
* STORAGE SECTION
***********************************************************************
DS 0D
WKSIZE DC F'131072'
WKADR DS F
WS DSECT
SAVE DS 18F
LEN EQU *-WS
END
I have a question about reentrancy. what are the ways that we can make subprog as reentrant? i am facing SOC1 abend. please have look at this.
Actually, what i am trying do is i have two programs TESTP03 (Calling prog) and TESTPG03 (called prog).
I am calling TESTPG03 two times from TESTP03.
First time.
I have called subprog two times using LOAD and BALR. This call was successfull.
But second time (As per my knowledge) the Subprog is already in storage because i didnt issue DELETE macro after executing the sub prog first time. So i am just passing control to same prog TESTPG03 second time using BALR. Here i got SOC1 abend saying that unable to point the subprog TESTPG03 again.
And also TESTPG03 subprog is re entrant. I can call it in same prog number of times (Please correct if i am wrong).
My question is how can i load the program second time using LOAD macro.
Is the subprog TESTP03 is properly coded for Re entrant.? ( I have compiled this using rent option and i didnt see any where that subprog is failed for reentrant. )
***********************************************************************
MAIN STM 14,12,12(13)
BALR 12,0
USING *,12
ST 13,SAVE+4
LA 13,SAVE
***********************************************************************
* DYNAMIC CALL USING LOAD MACROS -- CALLING PROGRAM
* PASSING PARAMETER
***********************************************************************
LOAD EPLOC=SUBPGM03
ST 0,WSREG0
L 15,WSREG0
LA 1,LPARM
BASSM 14,15
LTR 15,15
BZ CALL2
ABEND 4080,DUMP
CALL2 L 15,WSREG0
LA 1,LPARM
WTO 'CALL2'
BASSM 14,15
LTR 15,15
BZ EXIT
ABEND 4080,DUMP
***********************************************************************
*
***********************************************************************
EXIT L 13,SAVE+4
L 14,12(0,13)
LM 0,12,20(13)
BR 14
***********************************************************************
* STORAGE SECTION
***********************************************************************
SAVE DS 18F
WSF DS F
WSREG0 DS F
SUBPGM03 DC CL8'TESTPG03'
P1 DC F'5'
P2 DC F'600'
P3 DC F'700'
LPARM DS 0F
DC A(P1)
DC A(P2)
DC A(P3)
END
***********************************************************************
MAIN STM 14,12,12(13)
BALR 12,0
USING *,12
LR 3,1
L 2,WKSIZE
GETMAIN R,LV=(2)
ST 13,4(0,1)
LR 13,1
USING WS,13
***********************************************************************
* DYNAMIC CALL USING LOAD MACROS -- CALLING PROGRAM
* PASSING PARAMETER
***********************************************************************
LM 5,7,0(3)
L 8,0(5)
L 9,0(,6)
L 10,0(,7)
XR 4,4
AR 4,8
AR 4,9
AR 4,10
***********************************************************************
*
***********************************************************************
EXIT LR 1,13
L 0,WKSIZE
L 13,4(0,1)
FREEMAIN R,LV=(0),A=(1)
RETURN (14,12),,RC=0
***********************************************************************
* STORAGE SECTION
***********************************************************************
DS 0D
WKSIZE DC F'131072'
WKADR DS F
WS DSECT
SAVE DS 18F
LEN EQU *-WS
END
Note: You used WTO between Loading R1=Parm-Adr and the BALR.
Wto returns an identifikation-numer in R1 after sending message.
Also please use RoutCode in WTO, so that your messages will not damage the console-log. RoutCode=11 is for programmers. You will see your messages in sdsf.
First, you can load it several times, but there is a limit and it's not useful do so an it costs storage.
Second, Load it once, store the eploc in fullword. Allways load this fullword and BALR.
Definition for eploc of called programm
MDL50330_ADR DC A(0)
Test if eploc-field is zero, yes, then load, else, has been already loaded,
then only balr
SPACE
IF (MDL50330_ADR,Z,MDL50330_ADR,OC)
THEN C='CHECK PROGRAMM HAS BEEN LOAD'
LOAD EP=MDL50330
ST R0,MDL50330_ADR ...store eploc
EIF
SPACE
LA R1,MDL30§PADR ...load Parm
L R15,MDL50330_ADR ...load storesd eploc
In the SDSF iam able to see the 'call' and but no actual results. can you provide me the reason why it is not displaying. Cant we display the contents of DSECT?
Dear CICS guy/ William Thompson / enrico-sorichetti,
thanks for spenting your valuable time.
why i re posted the code because i made some silly mistakes in prog
1. coded L 2,13 by missing to code LR instead.
2. Requesting storage without mentioning the storage length.
Sorry, could not answer earlier.
Must work to get some money for a new car, evil world !!!
Also i'm a little confused about your code. I think, you will display a content of a field via WTO. Make your Field printable. Move it into the WTO-Command.
Quick, easy & simple example:
MVC WTLST+30(04),Field
WTLST WTO 'MDL00880 Value: XX XX',ROUTCDE=11
Remenber the length of WTO-Command, 8Bytes. So the first possible position is Command+8 (WTO 'xxxx').