View previous topic :: View next topic
|
Author |
Message |
pritanshu
New User
Joined: 31 Jan 2008 Posts: 15 Location: gurgaon
|
|
|
|
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 |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
What problem you have faced? |
|
Back to top |
|
|
pritanshu
New User
Joined: 31 Jan 2008 Posts: 15 Location: gurgaon
|
|
|
|
i want to know can i use inspect directly on flat file if yes then let me knw |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
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 |
|
|
gupta vishal
New User
Joined: 25 Sep 2007 Posts: 15 Location: Gurgaon
|
|
|
|
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 |
|
|
pritanshu
New User
Joined: 31 Jan 2008 Posts: 15 Location: gurgaon
|
|
|
|
i dont need to write the string found, i need to write lines after that string |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Requirement is not clear.
Please tell us what you have tried and what is your problem... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|