View previous topic :: View next topic
|
Author |
Message |
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
hello,
I am learning how to develop ISPF dialog and want to create my first ISPF table,the following are the steps I made,I am not sure if I am right or wrong,could any one have a look for me and if I am wrong please give me some advices(Bold is the REXX code):
1) /* REXX */
"ISPEXEC LIBDEF ISPTLIB DATASET ID('GDC108.TABLELIB')"
To set my own library for ISPF table,but I can not find the table in this library after running my REXX program.
2) "ISPEXEC TBCREATE TABLE1 KEYS(EMPSER) NAMES(LNAME FNAME I PHA PHNUM) WRITE"
Following the example in the reference to create the table.
3)
EMPSER = 598304
LNAME = ROBERTSON
FNAME = RICHARD
I = P
PHA = 301
PHNUM = 840-1224
"ISPEXEC TBADD TABLE1"
EMPSER = 172397
LNAME = SMITH
FNAME = SUSAN
I = A
PHA = 301
PHNUM = 547-8465
"ISPEXEC TBADD TABLE1"
Add data of rows to table
4) "ISPEXEC TBCLOSE TABLE1"
Following the example in the reference,because it is said that the table does not become permanent until it is stored on direct storage by either the TBSAVE or TBCLOSE service.
5) "ISPEXEC LIBDEF ISPTLIB"
at last I can not find the desired table TABLE1 in my private lib called 'GDC108.TABLELIB',could someone give me some advices or show me some codes that can create a ISPF table?
Thanks a lot
Henry |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
looks pretty good. But show us the trace. |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
thanks for reply,Pedro,
my key point is that I can not find TABLE1 in my own lib 'GDC108.TABLELIB'.
actually I did not have such experience of dealing table,but I rearched some posted topic in this forum and I noticed this passage:
Quote: |
"ISPTLIB is the Table Input Library and is required.
ISPTABL is the Table Output Library and is optional. You must allocate it only if an application uses table services.
The table output library must be a partitioned data set. The ISPTABL ddname that defines the table output library can specify the same data set as the table input library, ddname ISPTLIB. The first data set in the ISPTLIB concatenation should be the same as the data set used for ISPTABL. This ensures predictable behavior of dialogs that use table services without specifying the LIBRARY keyword. The output and input data sets must be the same if the updated version of a table is to be reprocessed by the same dialog that updated it.
You must allocate the table output library to ddname ISPTABL before using table services. " |
so my problem has the relation with ISPTABL and ISPTLIB?or something else is wrong?you can see my rexx code in bold format... |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Now read your own post... (wait 5 minutes while you read). Is your table in your ISPTABL dataset?
You may wish to change from TBCLOSE to TBSAVE which has a library parameter. |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
hi Pedro,thanks for your reminder,now it is working,the code is like this:
Code: |
/* REXX */
/* set the table output dataset ISPTABL */
"ISPEXEC LIBDEF ISPTABL DATASET ID('GDC108.ISPTABL')"
/* create a table */
"ISPEXEC TBCREATE TABLE1 KEYS(EMPSER) NAMES(LNAME FNAME I PHA PHNUM)
WRITE "
/* add two rows to the table */
EMPSER = 598304
LNAME = ROBERTSON
FNAME = RICHARD
I = P
PHA = 301
PHNUM = 840-1224
"ISPEXEC TBADD TABLE1"
EMPSER = 172397
LNAME = SMITH
FNAME = SUSAN
I = A
PHA = 301
PHNUM = 547-8465
"ISPEXEC TBADD TABLE1"
/* save the data to the output dataset */
"ISPEXEC TBSAVE TABLE1"
/* close the table */
"ISPEXEC TBCLOSE TABLE1"
/* set ISPTABL to default */
"ISPEXEC LIBDEF ISPTABL"
|
the key point is that ISPTABL is for table ouput and ISPTLIB is for table input,so if you want to invoke the table and show the rows in panel,you should set like this:
Code: |
"ISPEXEC LIBDEF ISPTLIB DATASET ID('GDC108.ISPTABL')" |
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
I do not think your code is working as it should.
Always creating the table then saving it is not a real world situation. I think you should try TBOPEN to see if exists and use the existing table. Only if it does not exist should you create a new one. |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
Hi Pedro,you are right...thanks |
|
Back to top |
|
|
|