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

Dynamically adding Loadlib for the session !!


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Mon Sep 19, 2011 4:13 pm
Reply with quote

Hi ,
Following is the code i have written trying to dynamically allocate SDSNLOAD for my session .. I cant find why it is not allowing me to do so. The same task I can do it by TSOLIB .. but I have seen LIBDEF also works but not in my case.
Here is code...

/*rexx */
parse arg db2sid
ds1 ="SYS1.DSN"db2sid".SDSNLOAD"
db2loadlib ="'"ds1"'"
address tso
"alloc fi(trgllib) ds("db2loadlib") shr reuse "
address ispexec
"control errors "
address ispexec
"libdef ispllib library id(trgllib) uncond stack

address tso "SUBCOM DSNREXX"
if rc<>0 then ,
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
address dsnrexx "CONNECT" db2sid
If rc <> 0 Then Do
Say 'Cannot connect to ' DB2_subsys ' RC=' rc
RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
Exit(23)
End
return rc

when it is run it gives me this output (with trace )

9 *-* address tso
10 *-* "alloc fi(trgllib) ds("db2loadlib") shr reuse "
>L> "alloc fi(trgllib) ds("
>V> "'SYS1.DSNDB2V.SDSNLOAD'"
>O> "alloc fi(trgllib) ds('SYS1.DSNDB2V.SDSNLOAD'"
>L> ") shr reuse "
>O> "alloc fi(trgllib) ds('SYS1.DSNDB2V.SDSNLOAD') shr reuse "
11 *-* address ispexec
12 *-* "control errors "
>L> "control errors "
13 *-* address ispexec
14 *-* "libdef ispllib library id(trgllib) uncond stack" /*8"db2loadlib") "
*/
>L> "libdef ispllib library id(trgllib) uncond stack"
16 *-* address tso "SUBCOM DSNREXX"
>L> "SUBCOM DSNREXX"
+++ RC(1) +++
17 *-* if rc<>0
>V> "1"
>L> "0"
>O> "1"
*-* then ,
18 *-* S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
>L> "ADD"
>L> "DSNREXX"
>L> "DSNREXX"
CSV003I REQUESTED MODULE DSNTZANB NOT FOUND
CSV028I ABEND806-04 JOBNAME=D05922E STEPNAME=IKJACCNT
IRX0250E System abend code 806, reason code 00000004.
IRX0253E Abend in external function RXSUBCOM.

What can be the problem. Load module is there in the dataset .

Pedro replied "Libdef doesnot work for rexx process " .. but the other day i have seen libdef working with CLIST ...

what can be the alternative for TSOLIB .. I want to add this load dataset dynamically . Linklist addition of DB2 load lib is not allowed at my site.


Please Help . !!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Sep 19, 2011 4:30 pm
Reply with quote

for the umpteen time... LIBDEF works for ISPF <controlled> <loads>

ISPF uses <directed loads> , it means that whn doing the bldl mumbo-jumbo
for something it check the LIBDEF chain/stack to determine the DDNAME to use

Address TSO uses only the standard library search so it knows nothing about the libdefs

if You want more flexibility than TSOLIB provides, <You> should install one of the many flavors of dynamic steplib available free
at Use [URL] BBCode for External Links or for a charge
remeber installing software requires proper management agreement/permission
it' s a pity that installing free software is quite often frowned upon !
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Sep 19, 2011 8:21 pm
Reply with quote

Hello,

Please keep in mind that posting the same question multiple times is the easiest way to lose posting privileges. . .

d
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Mon Sep 19, 2011 11:14 pm
Reply with quote

Hi Dick,

I apologize for multiple postings, I thought that one is old post so chances of getting a reply on that one is very less.

Will not repeat that in future. I myself a regular visitor of this this site and losing a posting right here is just like getting being banned from facebook and I am sure nobody can think of that.

I will stop posting here and will continue with my old post .

Thanks.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Mon Sep 19, 2011 11:26 pm
Reply with quote

I am not sure this will work, but try a two exec approach:

1. first exec does the LIBDEF
2. first exec does Address ISPEXEC "SELECT CMD(%second_exec parms) PASSLIB"
3. second exec does the work you want to do.

In ISPF Services Guide", see the description for LIBDEF, which includes a section titled 'User link libraries'. It mentions:
Quote:
If the SELECT program service is invoked using ISPEXEC SELECT CMD(MYCMD), MYCMD is considered a member of the load libraries specified with LIBDEF ISPLLIB. The command processor (a program coded to support a unique argument list format) can then use MVS contents supervision macros such as ATTACH, LINK, LOAD, or XCTL. This is because ISPF attaches MYCMD as a subtask to ISPF. The load library, defined using LIBDEF ISPLLIB, is passed as a task library to the subtask.


Note: it mentions TSO command processors... but I still have doubts that your rexx processes will work. They are not command processors and I doubt they are called through ATTACH, LINK or LOAD.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Sep 19, 2011 11:44 pm
Reply with quote

And you have not checked the return codes from your ALLOCs
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Tue Sep 20, 2011 12:00 am
Reply with quote

Hi Nic,

I just verified my return codes from the alloc .. they all are fine rc =0 even I checked the allocation of sdsnload to my ispf session with the ddname of trgllib .

I even tried Pedro suggestion "select pgm(dsnrexx) " still it says 806-04 .

How can libdef work for clist and loadlibs can be dynamically allocated and not for rexx ? icon_question.gif

Will try to explore more .
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Sep 20, 2011 12:22 am
Reply with quote

Quote:
How can libdef work for clist and loadlibs can be dynamically allocated and not for rexx ?


I already gave the reply,
no reason for anybody to waste time explaining if You do not care to read the answers icon_evil.gif

Quote:
but the other day i have seen libdef working with CLIST .

most probably You have seen an ALTLIB, not a LIBDEF
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Tue Sep 20, 2011 1:26 am
Reply with quote

Quote:
I even tried Pedro suggestion "select pgm(dsnrexx) " still it says 806-04 .


No, that was not my suggestion. Please read again. And please read the section of the manual cited.
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Tue Sep 20, 2011 1:29 am
Reply with quote

Just tried this sample code.. and according to dynamic allocation of libdef works

ds1 ="SYS1.DSNDB2V.SDSNLOAD"
db2loadlib="'"ds1"'"
address tso
"alloc fi(trgllib) ds("db2loadlib") shr reuse"
address ispexec
"libdef ispllib library id(trgllib) uncond stack"
address ispexec "select cmd(dsn) "

now jst to think how to bring rxsubcom and dsnrexx accordingly icon_smile.gif
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Tue Sep 20, 2011 1:36 am
Reply with quote

Thanks Pedro .. in a rush I wrote pgm... cmd works... icon_smile.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Sep 20, 2011 10:26 am
Reply with quote

As the DB2 libraries need to use DB2 via Rexx should already be available to you why are you doing this? Read the Rexx section of the DB2 Application Programming and SQL Guide.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Adding first / last acct numerber to ... DFSORT/ICETOOL 7
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Adding 'ODD' and 'EVEN' indicator at ... DFSORT/ICETOOL 6
Search our Forums:

Back to Top