View previous topic :: View next topic
|
Author |
Message |
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
Hi,
I'm new to ISPF tables.
I have a requirement to load the entries read from a file in to an existing ISPF table.
If a duplicate entry found, i need to update certain fields in the table and not to abend the loading process.
Could anyone please tell me how to handle this scenario using REXX?
Please let me know if you need anyother information.
Regards,
ursvmg |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
If the table is keyed, then when you read the next record to load, do a TBSCAN to see if the key value already exists in the table.
Of course, you could always SORT the input file first. |
|
Back to top |
|
|
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
Hi,
TBSCAN is returning a RC of 8.
I tried to read the table with a TBSCAN statement like below.
Code: |
/* REXX */
ADDRESS ISPEXEC
"LIBDEF ISPTABL DATASET ID('XXXX.ISPTLIB')"
"LIBDEF ISPTLIB DATASET ID('XXXX.ISPTLIB')"
"TBOPEN EMP1 WRITE SHARE"
EMP_ID = 1
"TBSCAN EMP1 ARGLIST(EMP_ID)"
SAY RC
"TBCLOSE EMP1"
EXIT |
There is an entry present in the table with key '1'
I need to update another field called NAME if the key is already present.
Please help.
Regards,
Ursvmg |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
After a little play time I would say that the key you are testing for does not match the key format that you are using in the search.
Does the table key have leading zeros. You will need to look at how the key has been loaded into the table and then use the same format to search for duplicates.
I loaded my table with keys 001, 002, 003, 004 and 005, but when searching for key 1 it gave RC8, but using 001 it gave RC0. |
|
Back to top |
|
|
anjali_tcs
New User
Joined: 09 Jun 2008 Posts: 10 Location: GGN
|
|
|
|
As per the ISPF manual :
Quote: |
Comparisons between the row values and the argument list are always done on a
character basis. That is, the values are considered character data, even if they
represent numbers. |
Also, out of curiosity can you check on RC for your TBOPEN [/quote] |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
anjali_tcs wrote: |
As per the ISPF manual :Also, out of curiosity can you check on RC for your TBOPEN |
As per the ISPF manual
Quote: |
12
Table is not open. |
If the TBOPEN had failed the return code would have been 12, and not 8 as specified by the OP.
Please think about your replies before posting. The idea of a help forum is to help people, not to mislead them |
|
Back to top |
|
|
anjali_tcs
New User
Joined: 09 Jun 2008 Posts: 10 Location: GGN
|
|
|
|
Apologies for confusion....i was mistaken... |
|
Back to top |
|
|
|