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 are the paramater we cannot use in procedure?how many instream we can write in single jcl?can we call instream to catalog and ctalog to instream?

2 Answers   Satyam,


What is the difference between PIC 9.99 and 9v99?

7 Answers  


ID DIVISION. PROGRAM-ID. PLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 VAR1 PIC 9(2). 01 VAR2 PIC X(2). PROCEDURE DIVISION. ACCEPT VAR2. MOVE VAR2 TO VAR1. STOP RUN. if i give 'PI' in var2 then what will b output of progr. any abend?????

6 Answers   TCS,


Write a program to explain size error.

0 Answers  


whn do i get soc7 abend while moving alphanumeric to numeric or while moving numeric to aplhanumeric please reply ASAP?

9 Answers  






Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?

0 Answers  


How to read a record from bottom of a file which is indexed by 'A'.

4 Answers   Oracle,


What is the maximum data length for Numeric DataType ?

3 Answers   Cap Gemini,


WE HAVE 2 FILES IN COBOL. ONE IS FIXED LENGTH RECORDS ANOTHER ONE IS VARIABLE LENGTH. IF I DECLEAR LRECL OF FIXED ONE AS 80 AND 2ND RECORD AS 132. WHAT WE NEED TO DECLEAR LRECL FOR THOSE 2 FILES IN JCL?

4 Answers   iGate,


can we declare s9(9)v9(9) in cobol ? if yes how many bytes it will occupy ?(urgent plz answer it)

13 Answers   CTS,


what is rediffine clause?in what situation it can use?give me real time example?

1 Answers   IBM,


What are the different ways to run a COBOL DB2 program using JCL?

2 Answers  


Categories