MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Simple REXX for SQL select

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Himesh
CICS Forum Moderator
CICS Forum Moderator


Joined: 20 Dec 2002
Posts: 80
Topics: 21
Location: Chicago

PostPosted: Fri Dec 27, 2002 1:23 am    Post subject: Simple REXX for SQL select Reply with quote

Heres a simple REXX to view results of an SQL (select), "online".

Pls change the 'XXXX.RUNLIB.LOAD' (for DSNTEP2) and 'SUBS' accordingly.

[code:1:4249b097b1]
/* Rexx - SQL SELECT from a Rexx program */
/* #inp - dataset name for output */
/* #inp - SQL */
/* #out - output is stored in the DS */

Mainline:
call Initialize
call SQL_SELECT
call Determine_Results
if SResult = 'SUCCESS' then call Display_Success
else call Display_Errors
call Terminate
exit (0)

Initialize:
say ' ******** Online SQL browser********'
say 'Enter the DS name for output(fully qualified name!)'
pull dsname

"ALLOC da('"dsname"') f(file) TRACK LRECL(133) BLKSIZE(133)
space(50,20) MOD"
address TSO
msgs = msg(off)
"FREE F(SYSIN, SYSPRINT)"
msgs = msg(on)
"ALLOC F(SYSIN) SPACE(1,1) TRACK LRECL(80) RECFM(F) BLKSIZE(80) NEW"
"NEWSTACK"

i=0
choice='Y'

do until choice='N'
if choice = 'Y' then do
if i=0 then
say 'Please Enter SQL:'
else
say 'Enter additional clause(s):'
pull sql1
i=i+1
sql.i=sql1
end
say 'Do u want to continue?(y/n)'
Pull choice
upper choice
end
do j=1 to i
queue sql.j
end

"EXECIO * DISKW SYSIN ( FINIS"
"DELSTACK"
"ALLOC F(SYSPRINT) SPACE(1,1) TRACK LRECL(133) RECFM(F) BLKSIZE(133) NEW"
return

SQL_SELECT:
/* Create a new stack and run DSN */
address TSO
"NEWSTACK"

queue "RUN PROGRAM (DSNTEP2) PLAN(DSNTEP31) LIBRARY('XXXX.RUNLIB.LOAD')"
/* XXXX.RUNLIB.LOAD
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group