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 / prasanth
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 division
INITIALIZE WS-TALLY
MOVE ID-TBL-IMMS OF TBL TO WS-USERID-TEMP
INSPECT WS-USERID-TEMP TALLYING WS-TALLY
FOR LEADING SPACE
MOVE WS-TALLY TO WS-TEMP
IF WS-TALLY IS NOT ZERO
MOVE WS-USERID-TEMP(WS-TALLY + 1 : ) TO WS-LS-USERID
| Is This Answer Correct ? | 6 Yes | 10 No |
Post New Answer View All Answers
) how do u code after getting data?
What is report-item in COBOL?
Explain how to differentiate call by context by comparing it to other calls?
Describe the cobol database components?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.
if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need
Why did you choose to work with ibm mainframe cobol programming?
Write a program to explain size error.
What are various search techniques in cobol? Explain.
What are declaratives and what are their uses in cobol?
How to remove 2 duplicate records and copy only one using job control language?
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
What guidelines should be followed to write a structured cobol prgm?
How do you differentiate between cobol and cobol-ii?