How to delete a front spaces in a data-name/variable in
cobol
Example:-
01 data-name-1 PIC x(20) value " cobol language".
01 data-name-2 PIC x(20).
MOVE data-name-1 to data-name-2.
would like the value of data-name-2 is "cobol language".

Answer Posted / varun v

we can use "Inspect Tallying" also for the same. I guess
this one is more effective.

Working storage Variable:
01 data-name-1 PIC x(20) value " cobol language".
01 data-name-2 PIC x(20).
01 WS-TALLY1 PIC 9(02) VALUE ZERO.

Procedure Dvision:
Inspect data-name-1 Tallying WS-TALLY1 for leading
spaces
Move data-name-1(WS-TALLY1+1 : 20-WS-TALLY1) to
data-name-2.

Now data-name-2 should have
Value 'cobol language'.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which Search verb is equivalent to PERFORM…VARYING?

850


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

916


EXPLAIN MAIN FRAME TESTING PROCESS...HOW TO FIX THE MAINFRAME BUGS?

2282


What is the difference between comp and comp-3?

886


how do you reference the printer file formats from cobol programs

880


Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

860


)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?

1734


What is the utilization of copybook in cobol?

872


How to print 10 to 1 if the input have only 10 digit number?

1021


what is difference between cobol and cobol/400

22109


How do define dynamic array in cobol.

852


I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue

2224


Write down the divisions of cobol program?

836


What are the pertinent COBOL

2233


INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?

617