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
 

 

REXX and DB2 DSN

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Fri Oct 22, 2010 7:24 pm    Post subject: REXX and DB2 DSN
Reply with quote

Hi
Can REXX be used to call DSN utilities like DCLGEN, SPUFI etc.
manual states
Quote:
Invoke DCLGEN by performing one of the following actions:
To start DCLGEN from ISPF through DB2I: Select the DCLGEN option on the DB2I Primary Option Menu panel. Then follow the detailed instructions for generating table and view declarations by using DCLGEN from DB2I.
To start DCLGEN directly from TSO: Sign on to TSO, issue the TSO command DSN, and then issue the subcommand DCLGEN.
To start DCLGEN directly from a CLIST: From a CLIST, running in TSO foreground or background, issue DSN and then DCLGEN.
To start DCLGEN with JCL: Supply the required information in JCL and run DCLGEN in batch. Use the sample jobs DSNTEJ2C and DSNTEJ2P in the prefix.SDSNSAMP library as models.

However when I try to call the DSN from REXX under TSO address, it does not work.

rexx code

Code:
/*REXX*/                                   
ADDRESS TSO                               
DSN SYSTEM(DD)                             
DCLGEN TABLE(TAB1) +                 
LIBRARY('USERID.PDS.DCL(TEST2)') +   
ACTION (REPLACE)                           
END                                       
EXIT     


same commands when I run thru TSO works.
Is it the case that calling DSN thru REXX is not allowed ? My understanding was when the 'address tso' is mentioned , next commands will run under TSO.

regards
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Oct 22, 2010 7:30 pm    Post subject:
Reply with quote

tomehta,

there are many threads about db2 and REXX in this website,
in the REXX forum.

suggest you search.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Oct 22, 2010 7:32 pm    Post subject:
Reply with quote

How I do it and it works for me is shown below.

I have not doe it with a DCLGEN, but I have with other commands.


Code:
/*REXX*/             
DROPBUF                     
                     
QUEUE 'DCLGEN TABLE(TAB1) +'                 
QUEUE 'LIBRARY('USERID.PDS.DCL(TEST2)') +'   
QUEUE 'ACTION (REPLACE)'                           
QUEUE 'END'
ADDRESS TSO                               
DSN SYSTEM(DD)
DROPBUF                                       
EXIT     



coded..Anuj
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Oct 22, 2010 8:26 pm    Post subject:
Reply with quote

As Mr. Porcelan implies with his example, DSN is not a simple command like, say, ALLOCATE, but one that accepts its own subcommands in the input stream (SYSIN or the terminal keyboard). The commands after DSN will indeed be directed to TSO...but should be directed to DSN. The simplest way of doing so is, as he shows, to queue them in memory before executing DSN.
Back to top
View user's profile Send private message
feng hao

New User


Joined: 26 Mar 2008
Posts: 44
Location: China

PostPosted: Thu Oct 28, 2010 11:35 am    Post subject:
Reply with quote

I think it is possible by all means.

I just tried it below IKJEFT01 without using either REXX nor CLIST and it is ok.

Code:
//STEP1       EXEC PGM=IKJEFT01
//STEPLIB    DD DSN=Your DB2 LOAD LIBLARY 's name
//SYSTSPRT DD SYSOUT=*
//SYSTSIN   DD *                                                         
  DSN SYSTEM(Your DB2 subsystem)                                                       
  DCLGEN TABLE(Table name) +                                       
  LIBRARY('Data set name') +                                           
  ACTION(REPLACE) +                * Not only REPLACE                                 
  LANGUAGE(PLI)                        * Not only PLI                                 
  END                                                                   
/*
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Oct 28, 2010 1:53 pm    Post subject:
Reply with quote

Hi Feng,
it works for JCl, CLIST,, but does not work for REXX.
You can try it.

regards
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Oct 28, 2010 7:36 pm    Post subject:
Reply with quote

Guys,
I ran the following script

Code:
/*REXX*/                                           
DROPBUF                                             
QUEUE 'DCLGEN TABLE(TAB1)'                   
QUEUE 'LIBRARY('"'ID.PDS.DCL(TEST2)'"')'   
QUEUE 'ACTION (REPLACE)'                           
QUEUE 'END'                                         
ADDRESS TSO                                         
DSN SYSTEM(DD)                                     
DROPBUF                                             
 EXIT                                               


its not working , gave me the error

Code:
COMMAND DCLGEN NOT FOUND                                       
A command entered or contained in a CLIST has invalid syntax.   


thanks
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Thu Oct 28, 2010 7:44 pm    Post subject:
Reply with quote

Try running this with TRACE(A).

I would guess the DSN command issues a bad rc (-3).

The DSN command is failing, and the queued commands are trying to be processed by TSO.
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Oct 28, 2010 8:26 pm    Post subject:
Reply with quote

may be you are correct...i ddint understand 'command action not found'..

Code:
      5 *-* QUEUE 'LIBRARY('"'ID.PDS.DCL(TEST2)'"')'       
      6 *-* QUEUE 'ACTION (REPLACE)'                                 
      7 *-* QUEUE 'END'                                             
      8 *-* ADDRESS TSO                                             
      9 *-* DSN SYSTEM(DD)                                           
      9 +++ DSN SYSTEM(DD)                                           
 Error running CLISTDC, line 9: Routine not found                   
 COMMAND ACTION NOT FOUND                                           
 COMMAND DCLGEN NOT FOUND                                           
 A command entered or contained in a CLIST has invalid syntax.       
 ***                                                                 

I ran the same set of commands thru JCL (IKJEFT01), it ran well..

Code:
DSN SYSTEM(DD)                                   
  DCLGEN TABLE (tab) -           
  LIBRARY ('ID.PDS.DCL(TEST2)')  -       
  LANGUAGE (IBMCOB) -                             
  ACTION (REPLACE)                               
END                                               
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Oct 28, 2010 10:45 pm    Post subject:
Reply with quote

Try enclosing the command "DSN SYSTEM(DD)" in quotes, single or double, to ensure that it is passed to TSO.
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Fri Oct 29, 2010 3:20 pm    Post subject:
Reply with quote

Tried that as well not working... may be I am missing some thing here..

Code:
/*REXX*/                                           
TRACE A                                             
DROPBUF                                             
QUEUE 'DCLGEN TABLE(TAB) '                   
QUEUE 'LIBRARY ('"ID.PDS.DCL(TEST2)"')'   
QUEUE 'ACTION (REPLACE)'                           
QUEUE 'END'                                         
ADDRESS TSO                                         
'DSN SYSTEM(DD) '                                   
DO QUEUED()                                         
PULL LINE                                           
END                                                 
EXIT                                               


it gives me the following output--

Code:
     6 *-* QUEUE 'ACTION (REPLACE)'                             
     7 *-* QUEUE 'END'                                         
     8 *-* ADDRESS TSO                                         
     9 *-* 'DSN SYSTEM(DD) '                                   
       >>>   "DSN SYSTEM(DD) "                                 
MISSING NAME OF TARGET LIBRARY FOR DECLARE++                   
DSNECP24 FURTHER DCLGEN PROCESSING WILL NOT BE ATTEMPTED       
LIBRARY NOT VALID COMMAND                                       
ACTION NOT VALID COMMAND                                       
       +++ RC(12) +++                                           
    10 *-* DO QUEUED()                                         
    13 *-* EXIT                                                 
***                                                             
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Oct 29, 2010 6:47 pm    Post subject:
Reply with quote

Based on the message, it is clearly an issue of the quote setup on your QUEUE LIBRARY statement.

I would change to TRACE(I) and see how that statement is resolved.

Several trials may be required.

You will gain much satisfaction working through this on your own.

Or you can wait for someone to figure it out for you.
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Fri Oct 29, 2010 8:37 pm    Post subject:
Reply with quote

I am able to run it,, however not very convincingly ..icon_smile.gif

I queued the subcommands in a single line and then pulled it.

However when I queue same lines one by one and pull it does not work.


Code:
TRACE A                                                             
DROPBUF                                                             
QUEUE 'DCLGEN TABLE(TAB) LIBRARY(''UID.COBOL(TEST3)'')'   
ADDRESS TSO                                                         
'DSN SYSTEM(DD)'                                                     
DO QUEUED()                                                         
PULL LINE                                                           
END                                                                 
DROPBUF                                                             
EXIT                                                                 


above rexx will generate the DCLGEN,
I will let u know if I am able to find the reason ..

thanks for your help.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Fri Nov 05, 2010 9:52 am    Post subject: Reply to: REXX and DB2 DSN
Reply with quote

I think DSN will pull from the stack, one line at a time, and execute that line. Then it will pull the next line and execute it.

If you QUEUE a long command with multiple QUEUE instructions, DSN does not know that you wanted them concatenated.

The posts that say they work include a continuation character, whereas the posts that say they do not work do not have the continuation character.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm


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