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


Please Help Members By Posting Answers For Below Questions

What is report-item in COBOL?

702


How to remove the spaces at the end of each record in the output file of variable length, via cobol program?

662


what are decleratives in cobol?

1816


What is rmode(any) ?

676


What is the difference between comp and comp-3?

688






what is s000 u4087 error? please give the all error codes in cobol,jcl.

17010


here is my requirement A1 is alphanumeric with value 'A1B2C3D4' as defined below 05 A1 PIC X(8) VALUE IS 'A1B2C3D4' but i need to have A2,A3 as ABCD & 1234 repectively...... A2 = ABCD A3 = 1234 Can you please explain me what are the different ways to do it?

6781


What is the difference between comp and comp-3 usage?

669


How do define dynamic array in cobol.

659


What is the utilization of copybook in cobol?

646


What are the different rules of SORT operation?

689


how to access the file from prodution from changeman tool and to submit a file to production

6660


how do you reference the variable unblock file formats from cobol programs

732


What are the different rules to perform a Search?

610


How many sections are there in data division in COBOL?

668