View previous topic :: View next topic
|
Author |
Message |
Sowmya Ramachandra
New User
Joined: 11 May 2007 Posts: 20 Location: Canada
|
|
|
|
Hi,
I have a an group varible which is as indicated below.
01 DESCRIPTION
05 DESCR1 OCCURS 4 TIMES PIC X(30).
I need to search for a string in the above feild and pick the next 10 bytes from the position. In order to this I thought of using the Inspect command. But this check will happen for each and every record present in the Database I feel this will impact the performance. Can anyone suggest me if there is any alternative ?
Is the Search comman better option. Please Advice. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Text searching by nature requires large amounts of cpu.
I suspect that SEARCH will not do what you want. . .
Can the string "overlap" descr1 entries or will the string completely be within an individual entry?
You could write your own code using reference modification, but INSPECT will probably use less cpu. |
|
Back to top |
|
|
Sowmya Ramachandra
New User
Joined: 11 May 2007 Posts: 20 Location: Canada
|
|
|
|
It is will be in any one of these occurences of Descr1. If you provide some example it will be helpful ... |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Regardless as to the method used to search for a particular value in each occurrence of the 30-Byte DESCR1 field, if the last byte of the value found ends in position 21 or less, then extracting the next 10-Bytes will work. Otherwise, this would be an error.
Regards, |
|
Back to top |
|
|
Sowmya Ramachandra
New User
Joined: 11 May 2007 Posts: 20 Location: Canada
|
|
|
|
The string will either occur in the beginning or in the middle of string so we will not have any error by extracting the next 10 bytes. My problem here is to identify the method to be used for searching. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
In order to this I thought of using the Inspect command. |
As you mentioned, INSPECT will do what you need.
Quote: |
The string will either occur in the beginning or in the middle of string so we will not have any error by extracting the next 10 bytes. |
Suggest you include code to verify there actually are 10 "safe" bytes to move so that there is no surprise a later time. |
|
Back to top |
|
|
|