View previous topic :: View next topic
|
Author |
Message |
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
I want to Read a query dataset containing number of queries and I want to find out number of tables impacted by query through a REXX program, I want to take backup of those table using unload job.
I have a skeleton (unload job) to take backup of table
//step1 exec pgm=dsniaul
//
----
//syspunch dd dummy
//sysrec00 dd dsn=a
//sysrec01 dd dsn =b
//sysrec02 dd dsn =c
//sysin dd *
select * from tablea
select * from tableb
select * from tablec
/*
//
This job will unload tablea in sysrec00 ,tableb in sysrec01 etc...
Now my question is ..If 5 tables are getting impacted then I need to add 5
sysrec's in this job . How can I add to this job and one thing I dont want to hardcode these sysrec's , I want to add them run time through REXX program or by any logic.
Please help me out.......... |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
ISPF file tailoring services - in the ISPF manuals. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
one thing I dont want to hardcode these sysrec's |
I think you still need to hardcode them somewhere.
It would be easier if you changed your naming convention, how about something like this:
Code: |
//syspunch dd dummy
//tablea dd dsn=mydsn.tablea
//tableb dd dsn=mydsn.tableb
//tablec dd dsn=mydsn.tablec
//sysin dd *
select * from tablea
select * from tableb
select * from tablec
/*
//
|
With like changes in your application programs. |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
But still is there any way we cad add dd stament at run time. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
You need to use the ISPF file tailoring to build a second job and then submit it to do the actual work. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
First create an ISPF table with 2 fields: SYSREC number and Table name .
Fill the table with the names you want to backup.
Use the ISPF file tailoring. The skeleton would contain )DOT around the SYSREC DD and another one around the SELECT.
Check the TBCREATE and TBADD commands in the ISPF Services Guide.
Check the )DOT in the Dialog Developer's Guide. |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
I tried to find out these commands ,but not abel to find ,
Can you please explain me with one e.g |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Click HERE to find the ISPF services manual.
All will be revealed. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Just to make easy things easy, here is more information
The skeleton:
Code: |
//syspunch dd dummy
)DOT BKUPTBL
//sysrec&RECNUM dd dsn=&RECDSN
)ENDDOT
//sysin dd *
)DOT BKUPTBL
select * from &RECTBN
)ENDDOT
/* |
It means: for each entry in ISPF table "BKUPTBL", create lines (the ones between )DOT and )ENDDOT).
In each line replace the variables with their values from the table.
For the skeleton to work, you now have to create the ISPF table (in the REXX program):
Code: |
Address ISPEXEC "TBCREATE BKUPTBL NAMES(RECNUM RECDSN RECTBN) NOWRITE" |
And of course load the table:
Code: |
RECNUM = Right(sysrecnum,2,'0') /* counter for SYSRECnn */
RECDSN = 'MYPREF.MYBACKUP.'tablename /* backupfile dsn */
RECTBN = tablename
Address ISPEXEC "TBADD BKUPTBL" |
|
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
thanks for help |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
The logic is woking but more than expected number of entries are getting inserted in the skel . Do i need initialize the table
? and how to display no of rows in table without panel , jsut display the rows through rexx program |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
You can SAY the variables each time after (or before) the TBADD.
You should add a TBEND to close the table without saving.
Use TRACE to see what the program does.
There are other commands that work with ISPF tables: TBQUERY, TBSKIP and TBGET, for example, can be used to check/display the table contents. |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
I have closed the table with TBCLOSE
thanks for your help |
|
Back to top |
|
|
|