How to delete leading spaces/blank in COBOL ?
Example:- 01 data-name-1 pic x(220) " English is a
language".
I would like to delete leading spaces.
Answer Posted / varun v
Yes, we can use "Inspect Tallying" for the same.
Wroking storage Variable:
01 WS-VAR PIC X(15) VALUE ' COBOL'.
01 WS-VAR-FINAL PIC X(15).
01 WS-TALLY1 PIC 9(02) VALUE ZERO.
Procedure Dvision:
Inspect WS-VAR Tallying WS-TALLY1 for leading spaces
Move WS-VAR(WS-TALLY1+1 : 15-WS-TALLY1) to
WS-VAR-FINAL.
Now WS-INSPECT-FINAL should have
Value 'COBOL'.
| Is This Answer Correct ? | 50 Yes | 12 No |
Post New Answer View All Answers
How are the next sentence and continue different from each other?
Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc
Describe the cobol database components?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
Have you used comp and comp-3 in your project? And how?
State the various causes of s0c1, s0c5 and s0c7.
What are various search techniques in cobol? Explain.
What is the problem of ordered sequential files access?
What is report-item in COBOL?
Which mode is used to operate the sequential file?
how do you reference the printer file formats from cobol programs
what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.
what is amode(24), amode(31), rmode(24) and rmode(any)?
What guidelines should be followed to write a structured cobol prgm?
Write a cobol program making use of the redefine clause.