View previous topic :: View next topic
|
Author |
Message |
iqbal.mallick
New User
Joined: 13 Dec 2012 Posts: 14 Location: India
|
|
|
|
Hi,
I am new to ISPF tables and got struck with below problem.
I have designed a REXX tool which will take 3 char key from user and will search the key in ispf table(Master table) and and capture all the records which is getting satisfy with the particular key in another ISPF table(temporary) and display the temporary ispf table on the Panel
Rexx tool
Code: |
Enter the 3 char key(AREA CODE):___ |
ISPF Table(Master table) in Readable format
Code: |
KEY NAME ADDRESS
011 Genifer1 Home address 1
011 Genifer2 Home address 2
011 Genifer3 Home address 3
011 Genifer4 Home address 4
012 James1 Home address 1
012 James2 Home address 2
012 James3 Home address 3
013 Stacy1 Home address 1
013 Stacy2 Home address 2
013 Stacy3 Home address 3 |
Master table-KEYLIST(KEY NAME) NAMELIST(ADDRESS)
The issue is when the user is giving the area code 012 for the first time it is able to fetch all the data with 012 key in temporary table
Rexx tool --1st call
Code: |
Enter the 3 char key(AREA CODE):012 |
1st call
Tempory ispf table-KEYLIST(KEY NAME) NAMELIST(ADDRESS)
Code: |
012 James1 Home address 1
012 James2 Home address 2
012 James3 Home address 3 |
On doing F3 it is returing me to the rexx screen where the Key is being saved and again pressing enter is giving me below result
Code: |
Enter the 3 char key(AREA CODE):012 |
2nd call
Tempory ispf table-KEYLIST(KEY NAME) NAMELIST(ADDRESS)
Code: |
012 James3 Home address 3 |
|
|
Back to top |
|
|
iqbal.mallick
New User
Joined: 13 Dec 2012 Posts: 14 Location: India
|
|
|
|
Sorry forget to post the code.
REXX tool variable name:KEYVAR (3 char)
Code: |
/* REXX */
PNLLIB='XXXXXX.REXXPANL'
TABLIB='XXXXXX.TABLES'
MSGLIB='XXXXXX.MSGLIB'
topscreen:
address ispexec "libdef ispplib dataset id('"PNLLIB"')"
address ispexec "libdef isptabl dataset id('"TABLIB"')"
address ispexec "libdef isptlib dataset id('"TABLIB"')"
address ispexec "libdef ispmlib dataset id('"MSGLIB"')"
address ispexec "display panel(rexxtool)"
if KEYVAR<>''
then call processing
exit
processing:
KEY = KEYVAR
Main_KEY = KEY
return_code = 0
$tn$='MAINSPF'
tblds = 'XXXXXX.ISPF.TABLES'
"TBSTATS" $tn$ "STATUS1(s1) STATUS2(s2) ROWCURR(rowct)"
if s1 > 1 then do
say "Table" $tn$ "not available."
exit
end; else,
if s2 = 1 then,
"TBOPEN " $tn$ "NOWRITE"
else do
address ispexec "TBEND" $tn$
address ispexec "TBOPEN " $tn$ "NOWRITE"
end
"LIBDEF ISPTLIB"
"TBQUERY" $tn$ "KEYS(keylist)",
"NAMES(nmlist)"
parse var keylist "(" keylist ")"
parse var nmlist "(" nmlist ")"
if rc=0 then do
createTEMPISPF:
"TBCREATE TEMPISPF KEYS("keylist") NAMES("nmlist") NOWRITE SHARE"
if rc > 0
then do
"TBSTATS TEMPISPF STATUS1(s1) STATUS2(s2) ROWCURR (rowct)"
if s2 > 1 then "TBCLOSE TEMPISPF"
signal createTEMPISPF;
end
"TBTOP "$tn$
do while(return_code=0)
"TBSARG MAINSPF NEXT NAMECOND(KEY,EQ)"
"TBSCAN MAINSPF"
"TBGET MAINSPF"
if KEY=Main_KEY
then do
address ispexec "TBADD TEMPISPF "
end
else return_code=8
address ispexec "TBSKIP MAINSPF"
end
"TBBOTTOM MAINSPF"
"TBEND MAINSPF"
"TBTOP TEMPISPF"
"TBDISPL TEMPISPF PANEL(TBLPANEL)"
if PFKEY='PF03' then do
"TBEND TEMPISPF"
signal topscreen; /* Goes back to the rexx tool */
end
"TBEND TEMPISPF"
end
return |
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Show us a trace.
fyi. I think you are using SIGNAL where it should be a DO loop process. For example:
Code: |
rc= 0
Do while (rc=0)
address ispexec "display panel(rexxtool)"
If (rc=) & (KEYVAR<>'') Then
call processing
End
|
|
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Here are you duties for the upcoming week-end:- Learn about VER in )PROC section of panel.
- Learn about )MODEL ROWS(SCAN) in panel.
- Learn about TBSARG.
- Rewrite your program without checking KEYVAR, without using SIGNAL and without duplicating the ISPF table.
I'll come back in a few days and check your work... |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Personally, my favorite loop is:
Code: |
Do Forever
"DISPLAY PANEL(rexxtool)"
If RC ¬= 0 Then Leave
Call Processing
End
Exit |
|
|
Back to top |
|
|
iqbal.mallick
New User
Joined: 13 Dec 2012 Posts: 14 Location: India
|
|
|
|
Hi,
The problem got resolved when I am using different columns names in both MAINSPF and TEMPISPF, instead of using same column names in both the tables as in the current scenario. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
I am new to ISPF tables |
It is not clear if you followed Marso's advice. You should. |
|
Back to top |
|
|
iqbal.mallick
New User
Joined: 13 Dec 2012 Posts: 14 Location: India
|
|
|
|
I will definately try the same as adviced by Marso |
|
Back to top |
|
|
|