how can count the number of character in feild ?? suppose
for instance i have a feild with value ' rajesh sarkar'
then how can v count the number of characters whitout
spaces...........

Answers were Sorted based on User's Feedback



how can count the number of character in feild ?? suppose for instance i have a feild with value ..

Answer / vikas pujar

We can use Inspect to accomplish this.

1) Inspect ws-var tallying ws-count for all spaces.

Here number of spaces will come and sit in ws-count, by deducting it with length of variable will get number of characters.

Is This Answer Correct ?    13 Yes 1 No

how can count the number of character in feild ?? suppose for instance i have a feild with value ..

Answer / akviswa

1. Count the length of the string
2. Move the value of WS-IND to 1
2. perform until the length of the string=0
a. If string(ws-ind:1) <> spaces
Increment the counter for count
end-if
b. Decrement the length of string and increment WS-IND
end-perform

Is This Answer Correct ?    4 Yes 1 No

how can count the number of character in feild ?? suppose for instance i have a feild with value ..

Answer / pradeep

INSPECT VARIABLE1 TALLYING WS-COUNT FOR CHARACTERS

Is This Answer Correct ?    2 Yes 0 No

how can count the number of character in feild ?? suppose for instance i have a feild with value ..

Answer / dk

Declare an array with PIC X.
check for every subscript whether it is not SPACES.
Count the occurrences for non space values.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

What is the difference between CALL BY VALUE and CALL BY CONTENT?

7 Answers  


01 text-data pic x(100). move 'xyzdbfrjjg u' to text-data. how to find the value of last index of text-data?

3 Answers   Mind Tree,


how many bytes does s9(7)COMP-3 field occupies?

6 Answers   ADP,


What are differences between Static Call and Dynamic Call?

10 Answers   IBM, KBC, Keane India Ltd, Verizon,


i am a btech cs 2009 passout. i am opting for mainframe course. is it good to do this course? pls. anyone suggest me

4 Answers  


how many bytes does a s9(12)COMP-4 field occupy?? a.2 b.4 c.8 d.1 ans with reason please

2 Answers  


What is difference between com and com3? Eg. s9(4) so what is the memory it will occupy com and com3.

2 Answers  


How to retain the Duplicates in the one records?

3 Answers   CS,


What is 77 level used for ?

12 Answers   IBM, iGate,


COMPUTE X = A * B - C * D and COMPUTE X = (A * B) - (C * D) (a) Are not the same (b) Are same (c) Syntactically wrong (d) Will yield a run time error

1 Answers   TCS,


What is Alternate Index ? How is it different from regular index ?

2 Answers  


A paragraph PARA-X is to be executed when none of the data names A, B and C have value of 1. Which of the following will achieve this ? (a) IF A NOT = 1 OR B NOT = 1 OR C NOT = 1 PERFORM PARA-X (B) IF NOT A= 1 AND B= 1 AND C = 1 PERFORM PARA-X (C) IF A NOT =1 IF NOT B = 1 OR C= 1 PERFORM PARA-X (C) IF A NOT = 1 AND B NOT = 1 AND C NOT = 1 PERFORM PARA-X

3 Answers   TCS,


Categories