IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How can i call Rentrant prog several times using LOAD macro.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GAFUR

New User


Joined: 19 May 2005
Posts: 31

PostPosted: Tue Feb 26, 2008 8:11 pm
Reply with quote

Dear freinds,

Question--1.
I have coded one assembler program for testing purpose it is abending.

One prog is a main prog calling onother prog. called prog is reentrant prog.

i am getting S30A abend, COMPLETION CODE SYSTEM = 30A REASON CODE = 0000001C .

1C - Zero length is not specified on a subpool FREEMAIN. Zero length must be specified on a subpool FREEMAIN.

I coded a simple prog another TEST1 it is also giving same error.

Can anyone help me what might be the reason for these abends.
Code:
TESTP03  CSECT                                                         
***********************************************************************
                                                                       
***********************************************************************
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             

Sub program.
Code:
TESTPG03 CSECT                                                         
***********************************************************************
                                                                       
***********************************************************************
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

Code:
TEST1    CSECT                                                         
***********************************************************************
                                                                       
***********************************************************************
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
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Wed Feb 27, 2008 3:10 pm
Reply with quote

Hi !

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

FREEMAIN R,LV=(R0),A=(R1)


Regards, UmeySan
Back to top
View user's profile Send private message
GAFUR

New User


Joined: 19 May 2005
Posts: 31

PostPosted: Wed Feb 27, 2008 8:06 pm
Reply with quote

Dear UmeySan,

Thanks for your suggestion.

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.

i have posted a same query on re entrant issue.
Code:
TESTP03  CSECT                                                         
***********************************************************************
                                                                       
***********************************************************************
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                             

SUB PROGRAM
Code:
TESTPG03 CSECT                                                         
***********************************************************************
                                                                       
***********************************************************************
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
Back to top
View user's profile Send private message
GAFUR

New User


Joined: 19 May 2005
Posts: 31

PostPosted: Wed Feb 27, 2008 8:11 pm
Reply with quote

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 calling prog.
Code:
TESTP03  CSECT                                                         
***********************************************************************
                                                                       
***********************************************************************
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                             

SUB PROGRAM
Code:
TESTPG03 CSECT                                                         
***********************************************************************
                                                                       
***********************************************************************
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
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Feb 27, 2008 8:31 pm
Reply with quote

GAFUR wrote:
i have pasted modified prog again please ignore the prog i pasted earlier.
Jeez, why haven't you figured out that posting 'Code' makes it more readable? icon_rolleyes.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Feb 27, 2008 8:35 pm
Reply with quote

What do you have against posting the program/data in 'Code'.... icon_rolleyes.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Feb 27, 2008 8:40 pm
Reply with quote

I Coded it, but why did GAFUR use so many blank lines between each sentence?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Wed Feb 27, 2008 8:50 pm
Reply with quote

Hi !

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

BASSM R14,R15

Regards, UmeySan
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Feb 27, 2008 8:52 pm
Reply with quote

Code:
CALL2    L    15,WSREG0                                                 
         LA   1,LPARM                                                   
         WTO  'CALL2'                                                   
         BASSM 14,15


the wto will clobber reg 1 content
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Wed Feb 27, 2008 8:56 pm
Reply with quote

Hi enrico,
...that's what i wrote.

Regards, UmeySan
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Feb 27, 2008 9:07 pm
Reply with quote

While I was looking at the thread,
and writing/assembling a three liner to check the registers used by wto

the thread itself was restructured and more answers just dropped in icon_biggrin.gif
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Wed Feb 27, 2008 9:34 pm
Reply with quote

Questo è destino !!!

Cari saluti, UmeySan
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Feb 27, 2008 9:39 pm
Reply with quote

enrico-sorichetti wrote:
the thread itself was restructured and more answers just dropped in icon_biggrin.gif
Blame me.... icon_cry.gif
Back to top
View user's profile Send private message
GAFUR

New User


Joined: 19 May 2005
Posts: 31

PostPosted: Thu Feb 28, 2008 7:25 pm
Reply with quote

Dear UmeySan,

Thanks a lot for your help. I am able to ran the prog successfully.

Now, i added few lines of code to finally display the contents of result.

CVD 4,WSDW
UNPK MSG+2(16),WSDW
OI MSG+17,X'F0'
WTO 'CALL'
LA 3,MSG
WTO TEXT=(3),ROUTCDE=(11)

LR 1,13
L 0,WKSIZE
L 13,4(0,1)
FREEMAIN R,LV=(0),A=(1)
RETURN (14,12),,RC=0


DS 0D
WKSIZE DC F'131072'
WKADR DS F
WS DSECT
SAVE DS 18F
MSG DC AL2(16)
DS CL(16)
WSDW DS D
LEN EQU *-WS
END


Spool messages.

07.23.07 JOB25369 IEF403I ASST - STARTED - TIME=07.23.07
07.23.07 JOB25369 +CALL
07.23.07 JOB25369 +CALL
07.23.07 JOB25369 -AISSDS01, ASST , STEP01 -01, TESTP03 , CC= 0000 , 07.23.07 08059

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 for the confusion....
Back to top
View user's profile Send private message
GAFUR

New User


Joined: 19 May 2005
Posts: 31

PostPosted: Thu Feb 28, 2008 7:36 pm
Reply with quote

For this do we need to use Execute form of WTO macro (just i got from IBM book)? Correct if i am wrong?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Mon Mar 03, 2008 3:59 pm
Reply with quote

Hi GAFUR !

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').

Regards, UmeySan
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts How to load to DB2 with column level ... DB2 6
No new posts REASON 00D70014 in load utility DB2 6
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts PRINTOUT macro PL/I & Assembler 0
Search our Forums:

Back to Top