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

Search a string in a Flat file by using inspect


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

New User


Joined: 31 Jan 2008
Posts: 15
Location: gurgaon

PostPosted: Wed Mar 26, 2008 2:48 pm
Reply with quote

hi all,
I wants to search a string in a flat file by using inspect and after searching i need to pass data into output file after that string
how can i do this plz help me out....

regards,
pritanshu rai
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Wed Mar 26, 2008 3:07 pm
Reply with quote

What problem you have faced?
Back to top
View user's profile Send private message
pritanshu

New User


Joined: 31 Jan 2008
Posts: 15
Location: gurgaon

PostPosted: Wed Mar 26, 2008 3:18 pm
Reply with quote

i want to know can i use inspect directly on flat file if yes then let me knw
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Wed Mar 26, 2008 3:30 pm
Reply with quote

If you want to search a string on PS, you can use Search-For or Search-ForE, ie, Option 3.14, 3.15 in foreground.

If inspect means, Read a line...
Apply INSPECT...
Do whatever you want with your own logic...
Back to top
View user's profile Send private message
gupta vishal

New User


Joined: 25 Sep 2007
Posts: 15
Location: Gurgaon

PostPosted: Wed Mar 26, 2008 3:31 pm
Reply with quote

Hi,
I am trying to give a solution, just have a look :-)

PROCEDURE DIVISION.
Begin.
OPEN INPUT TextFile
READ TextFile
AT END SET EndOfFile TO TRUE
END-READ
PERFORM UNTIL EndOfFile
INSPECT TextLine
.
.
If string found
write to file
End-if
READ TextFile
AT END SET EndOfFile TO TRUE
END-READ
END-PERFORM

CLOSE TextFile
STOP RUN.

You will have to think of your variable where you are reading the file.
Regards,
Vishal K Gupta
Back to top
View user's profile Send private message
pritanshu

New User


Joined: 31 Jan 2008
Posts: 15
Location: gurgaon

PostPosted: Wed Mar 26, 2008 3:39 pm
Reply with quote

i dont need to write the string found, i need to write lines after that string
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Wed Mar 26, 2008 4:14 pm
Reply with quote

Requirement is not clear.
Please tell us what you have tried and what is your problem...
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 Mar 26, 2008 8:54 pm
Reply with quote

Hello,

INSPECT has nothing to do with a "flat file". . . Once a record has been read, it is merely data within the program. INSPECT may be used on data within the program - regardless of where it came from.

Quote:
i dont need to write the string found, i need to write lines after that string
You need to post some sample input data and what you want as output when that input data is processed thru your requirement.

If you cannot clearly define what you want, it will be nearly imposible for us to provide useful suggestions. Keep in imnd that what you posted was coimpletely clear to you, but it is not to others.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top