View previous topic :: View next topic |
Author |
Message |
sinduja Beginner

Joined: 20 Jun 2005 Posts: 29 Topics: 14
|
Posted: Thu May 11, 2006 9:54 am Post subject: Problem using search all even when table sorted |
|
|
Hi all,
I am using a SEARCH ALL in my program. There are 2 ascending keys in the table being searched. The working storage table is loaded from a DB2 table. I have selected the fields from the DB2 table giving an order by clause and then loaded it to the working storage table. But when I do a search, the when condition fails for some fields (even though the searched field is present in the table).
Can some one please tell me where i am going wrong?
Code: |
01 WS-TEMP-TABLE.
05 WS-FIELD-DESC-TBL OCCURS 500 TIMES
ASCENDING WS-TBL-GENESYS-FIELD-ID
WS-TBL-FIELD-TYPE
INDEXED BY WS-FIELD-DES-TBL-IND.
10 WS-TBL-GENESYS-FIELD-ID PIC X(04) VALUE SPACES.
10 WS-TBL-FIELD-DESC PIC X(48) VALUE SPACES.
10 WS-TBL-FIELD-TYPE PIC X(01) VALUE SPACES.
* table loaded from the cursor below
EXEC SQL
DECLARE FIELD_DESC_CSR CURSOR FOR
SELECT
DISTINCT F.GENESYS_FIELD_ID
,F.FIELD_DESC
,F.FIELD_TYPE
FROM BK_FIELD_DESC F
WHERE F.GENESYS_FIELD_ID > ' '
AND F.INC_CLIAUD_REPORT = 'A'
ORDER BY F.GENESYS_FIELD_ID, F.FIELD_TYPE
END-EXEC
SEARCH ALL WS-FIELD-DESC-TBL AT END
CONTINUE
WHEN WS-TBL-GENESYS-FIELD-ID(WS-FIELD-DES-TBL-IND) =
DCL-CHGHST-PRT-FIELD-ID
AND WS-TBL-FIELD-TYPE(WS-FIELD-DES-TBL-IND) = 'P'
MOVE DCL-CHGHST-PRT-CTRN-GRP-NUMBER
TO CLNT-MAINT-GROUP
MOVE DCL-CHGHST-PRT-FIELD-ID
TO CLNT-MAINT-MNEMONIC
MOVE DCL-CHGHST-PRT-TRAN-KEY
TO CLNT-MAINT-TRAN-KEY
MOVE WS-TBL-FIELD-DESC(WS-FIELD-DES-TBL-IND)
TO CLNT-MAINT-DESCRIPTION
MOVE DCL-CHGHST-PRT-CHANGE-FROM-TXT
TO CLNT-MAINT-OLD-VALUE
END-SEARCH
|
FIELD_TYPE may have values 'P' or 'N'
some values like ZAT1, ZAT2, ZAT3 in the DCL-CHGHST-PRT-FIELD-ID cause the when condition to fail.
regards,
sinduja |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu May 11, 2006 10:01 am Post subject: |
|
|
sinduja
You are selecting distinct values from your DB2 table on 3 fields and your internal table is having just 2 fields and you are checking only 1 field in your search criteria. You need to have equal no: of key fields.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Mervyn Moderator

Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Thu May 11, 2006 2:26 pm Post subject: |
|
|
You also need to initialise any unused table entries to HIGH-VALUES. _________________ The day you stop learning the dinosaur becomes extinct |
|
Back to top |
|
 |
|
|