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

BY seeing a program how can we say that it is static call or dynamic call

5 Answers   CGI,


Why would you use find and get rather than to obtain?

0 Answers  


What is the difference between Global and External Variables?

0 Answers  


How may divisions are there in JCL-COBOL?

5 Answers   IBM,


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  






Read a flat file and write last but one (I have n records in a file I have to write n-1th) record in another flat file. Could you please provide me the code in COBOL?

1 Answers  


What is the difference between PIC 9.99 and 9v99 in COBOL?

0 Answers   SwanSoft Technologies,


where will u code file status ?

2 Answers   TCS,


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...........

4 Answers   Wipro,


Differentiate COBOL and COBOL-II?

0 Answers  


Name some of the examples of COBOl 11?

0 Answers   CSC,


Consider the following: 77 A PIC 9(10) 77 B PIC 9(10) 77 C PIC 9(19) MULTIPLY AB BY B GIVING C Which of the following is true ? (a) The execution of the above may result in size error. (b) The execution of the above will result in size error. (c) The definition of C is invalid resulting in compilation error. (d) No error will be thee and the program would proceed correctly.

4 Answers   TCS,


Categories