IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Command to serach a String


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sowmya Ramachandra

New User


Joined: 11 May 2007
Posts: 20
Location: Canada

PostPosted: Wed Feb 18, 2009 4:05 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 18, 2009 4:36 am
Reply with quote

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
View user's profile Send private message
Sowmya Ramachandra

New User


Joined: 11 May 2007
Posts: 20
Location: Canada

PostPosted: Wed Feb 18, 2009 6:38 am
Reply with quote

It is will be in any one of these occurences of Descr1. If you provide some example it will be helpful ...
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Feb 18, 2009 7:02 am
Reply with quote

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
View user's profile Send private message
Sowmya Ramachandra

New User


Joined: 11 May 2007
Posts: 20
Location: Canada

PostPosted: Wed Feb 18, 2009 8:08 am
Reply with 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. My problem here is to identify the method to be used for searching.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 18, 2009 8:21 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Help with C character vs C string All Other Mainframe Topics 3
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top