Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Search a string in a Flat file by using inspect

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Search a string in a Flat file by using inspect
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: 788
Location: Chennai, India

PostPosted: Wed Mar 26, 2008 3:07 pm    Post subject:
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    Post subject:
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: 788
Location: Chennai, India

PostPosted: Wed Mar 26, 2008 3:30 pm    Post subject:
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    Post subject: Reply to: inspect problem
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    Post subject:
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: 788
Location: Chennai, India

PostPosted: Wed Mar 26, 2008 4:14 pm    Post subject:
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

Site Director


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

PostPosted: Wed Mar 26, 2008 8:54 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us