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

how can we code index in an array of cobol pgm?

1 Answers   Wipro,


what is the meaning of pic 9(09)v99-

4 Answers   HSBC,


Explain about Redefines cluse?

3 Answers   iGate,


What type of SDLC u followed? Why?

0 Answers   IBM,


Difference between ps, esds

3 Answers  






TYPES OF SORTINGS. which is more prefarable.

2 Answers   Syntel, TCS,


what is the difference between start and startbr?

2 Answers  


A s9(4). B v9(4) value 0.21 can i move this?

3 Answers  


How to use the same COBOL program in Batch and CICS on lines? explain with an example

0 Answers   IBM,


Size of a column has been changed in DB2 table (Suppose it was of 5 characters and later changed to 4 characters) and forgot to change the DCLGEN in COBOL program, what will happen during the execution of code? If the program Abends then what will be the error? If it doesn't abend then hpw the error can be catched?

5 Answers   IBM,


how to transfer the file from pc to mainframe??

2 Answers  


What is the LINKAGE SECTION used for?

4 Answers  


Categories