GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Mainframe  >  COBOL
Go To First  |  Previous Question  |  Next Question 
 COBOL  |  Question 158 of 162    Print  
Give example of Inspect TALLYING / BEFORE INTIAL / AFTER INITIAL. In which situation will use this in COBOL?
We have different type of Inspect verb
1.counting INSPECT.
2.replacing INSPECT.
3.combined INSPECT.
4.converting INSPECT.
Give example of any Inspect verb which you know.



  
Total Answers and Comments: 4 Last Update: November 17, 2009     Asked by: gilbat82 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 23, 2008 14:58:47   #1  
sarath_sawanth Member Since: July 2008   Contribution: 2    

RE: Give example of Inspect TALLYING / BEFORE INTIAL / AFTER INITIAL. In which situation will use this in COBOL?
Hi

var1 'abc sarath pqrs sawanth xyz'

INSPECT var1 TALLYING count1 FOR ALL 'S'
BEFORE INITIAL 'sarath' AFTER 'sawanth'
end-inspect.

sol: count1 1

This is used to tally the occurance of a character or group of characters in data field.

Regards
~SS~

 
Is this answer useful? Yes | No
July 23, 2008 15:29:46   #2  
sarath_sawanth Member Since: July 2008   Contribution: 2    

RE: Give example of Inspect TALLYING / BEFORE INTIAL / AFTER INITIAL. In which situation will use this in COBOL?
For Replacing:

var1 'abc pqrs xyz'

INSPECT var1 REPLACING CHARACTERS BY 'p' BEFORE INITIAL 'abc' AFTER INITIAL 'xyz'
end-inspect.

Sol: var1 'abc pppp xyz'

 
Is this answer useful? Yes | No
October 16, 2008 00:26:01   #3  
dsmanikandan Member Since: June 2008   Contribution: 1    

RE: Give example of Inspect TALLYING / BEFORE INTIAL / AFTER INITIAL. In which situation will use this in COBOL?
Manikandan D

hi sarath your answer was correct but u made one minor mistake

for counting inspect

ex:
var1 'abc tree pqrs leaf xyz'

count1 inspect var1 tallying count1 for all 's' before initial 'leaf' after initial 'tree'.

ans:
count1 1.


 
Is this answer useful? Yes | No
November 16, 2009 10:10:23   #4  
maddy5981 Member Since: November 2009   Contribution: 1    

RE: Give example of Inspect TALLYING / BEFORE INTIAL / AFTER INITIAL. In which situation will use this in COBOL?
INSPECT word TALLYING count FOR LEADING “L” BEFORE INITIAL “A” count-1 FOR
LEADING “A” BEFORE INITIAL “L”.
Where word LARGE count 1 and count-1 0.
Where word ANALYST count 0 and count-1 1.
INSPECT word TALLYING count FOR ALL “L” REPLACING LEADING “A” BY “E” AFTER
INITIAL “L”.
Nucleus
7830 7709–000 2–103
Where word CALLAR count 2 and word CALLER.
Where word SALAMI count 1 and word SALEMI.
Where word LATTER count 1 and word LETTER.
INSPECT word REPLACING ALL “A” BY “G” BEFORE INITIAL “X”.
Where word ARXAX word GRXAX.
Where word HANDAX word HGNDGX.
INSPECT word TALLYING count FOR CHARACTERS AFTER INITIAL “J” REPLACING ALL “A”
BY “B”.
Where word ADJECTIVE count 6 and word BDJECTIVE.
Where word JACK count 3 and word JBCK.
Where word JUJMAB count 5 and word JUJMBB.
INSPECT word REPLACING ALL “X” BY “Y” “B” BY “Z” “W” BY “Q” AFTER INITIAL
“R”.
Where word RXXBQWY word RYYZQQY.
Where word YZACDWBR word YZACDWZR.
Where word RAWRXEB word RAQRYEZ.
INSPECT word REPLACING CHARACTERS BY “B” BEFORE INITIAL “A”.
word before: 1 2 X Z A B C D
word after: B B B B B A B C D

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape