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

Answers were Sorted based on User's Feedback



How to delete a front spaces in a data-name/variable in cobol Example:- 01 data-name-1 PIC x(2..

Answer / 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

How to delete a front spaces in a data-name/variable in cobol Example:- 01 data-name-1 PIC x(2..

Answer / deepak dada

01 data-name-1 pic value " cobol language" justified
right.
01 data-nane-2 pic(20).
01 data-name-3 redifines data-name-2 pic x(14).
move data-name-1 to data-name-3.
display data-name-3.

Is This Answer Correct ?    1 Yes 2 No

How to delete a front spaces in a data-name/variable in cobol Example:- 01 data-name-1 PIC x(2..

Answer / anjibabu

Deepak is partially right.

01 name1 pic a(20) value ' cobol language'.
01 name2 pic a(20).
01 name3 redefines name2 pic a(14) justified right.
PD
move name1 to name3.
display name2.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More COBOL Interview Questions

What is the file organization clause ?

2 Answers  


Can we move SPACES to numeric field and ZEROES to alphabetic field? If yes what are the way doing this?

6 Answers   T systems,


I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSDS file in reverse order? In both the cases we donot know the total number of records.

2 Answers   L&T,


What are the differences between OS VS COBOL and VS COBOL II?

1 Answers   IBM,


What is perform what is varying?

0 Answers  


If we use GO BACK instead of STOP RUN in cobol?

1 Answers   Temenos,


If I want to increase the Limit in GDG. What should I do?

2 Answers   IBM,


IF I mention stop run in CICS what happens?

0 Answers   IBM,


The maximum number of dimensions that an array can have in COBOL-85 is ?

11 Answers  


can u plz expain me how to declare dynamic array? what is the meaning of depending on clause in dynamic array?

3 Answers   IBM, Satyam,


Why there is no questions in this column?

6 Answers  


What is the difference between CONTINUE & NEXT SENTENCE ?

2 Answers  


Categories