Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to run two select querry in a rexx prog

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

New User


Joined: 28 Nov 2007
Posts: 64
Location: Chennai

PostPosted: Wed Aug 20, 2008 10:44 am    Post subject: How to run two select querry in a rexx prog
Reply with quote

Hi all,

I am doing a rexx prog where if u will give the table name as input it will display all the properties like column names, col numbers, index names etc.

the prob is i need to give more than one sql querries, like below,


SQLSTMT="SELECT NAME, TYPENAME",
"FROM SYSIBM.SYSCOLUMNS",
"WHERE TBNAME = '"TABNAM"'",
"AND TBCREATOR = '"TABCRE"'"



SQLSTMT="SELECT COUNT(NAME)",
"FROM SYSIBM.SYSCOLUMNS"
"WHERE TBNAME = '"TABNAM"'",
"AND TBCREATOR = '"TABCRE"'"



I dont know how to give two querries in a rexx prog. My DBpart of the rexx prog is like below,

------------------------------------------------------------------------------------
DO S=1 TO NUM.0
/*TRACE I */
PARSE VAR NUM.S TABNAM TABCRE JUNK
ADDRESS TSO "SUBCOM DSNREXX"
IF RC THEN
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
ADDRESS DSNREXX "CONNECT DSN "
SQLSTMT="select CAST(NAME AS CHAR(20)),",
"CAST(COLTYPE AS CHAR(10))",
"FROM SYSIBM.SYSCOLUMNS",
"WHERE TBNAME = '"TABNAM"'",
"AND TBCREATOR = '"TABCRE"'"
ADDRESS DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT"
ADDRESS DSNREXX "EXECSQL DECLARE C1 CURSOR FOR S1"
ADDRESS DSNREXX "EXECSQL PREPARE S1 INTO :OUTSQLDA FROM :SQLSTMT"
ADDRESS DSNREXX "EXECSQL OPEN C1"
DO UNTIL(SQLCODE ¬= 0)
------------------------------------------------------------------------------

So anyone can please tell me how to give more than one querry in this prog.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Aug 20, 2008 12:14 pm    Post subject:
Reply with quote

Do you really need to know the count from the second SQL, could you just not get that information from the original SQL from DSNREXX ?
Back to top
View user's profile Send private message
siva102

New User


Joined: 28 Nov 2007
Posts: 64
Location: Chennai

PostPosted: Wed Aug 20, 2008 12:30 pm    Post subject: Reply to: How to run two select querry in a rexx prog
Reply with quote

Hi Expat,

Thanks for replying.

That count Querry was just an example. I need to run more than 4 querries in that program.

More over i just able to get the values But in an unformatted manner. like below,

CUST_ID INTEGER
CUST_NUM INTEGER
EMPE_ID_TYP_CD CHAR
END_DT DATE
INTK_MTHD_CD CHAR
MET_ID INTEGER
RSRCH_CD CHAR
UPDT_OPER_ID CHAR
UPDT_TS TIMESTMP
WRKFLW_IND CHAR
13
XUD1CUST
XUD2CUST
XUDCCUST
XUDCCUST F3696DBA CUST_ID 1 1 A N
XUD1CUST F3696DBA CUST_NUM 2 1 A N
XUDCCUST F3696DBC CUST_ID 1 1 A N
XUD1CUST F3696DBC CUST_NUM 2 1 A N
XUDCCUST F3696DBD CUST_ID 1 1 A N

could you please telll me how to do fomatting to this data means giving the heading to each and every coloumn sao that i ll get the output like below,

Columns Data_type col_no Index

CUST_ID INTEGER 13 XUD1CUST
CUST_NUM INTEGER XUD2CUST
EMPE_ID_TYP_CD CHAR XUDCCUST
END_DT DATE
INTK_MTHD_CD CHAR
MET_ID INTEGER
RSRCH_CD CHAR
UPDT_OPER_ID CHAR
UPDT_TS TIMESTMP
WRKFLW_IND CHAR
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 ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Creating ISPF Screens with Scrname vi... Albireo20 TSO/ISPF 9 Tue Sep 05, 2017 4:24 pm
No new posts How to Run Rexx Macro? Kalaivignesh CLIST & REXX 5 Fri Sep 01, 2017 9:08 pm
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us