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

Study the DATA DIVISION entries and the three PROCEDURE DIVISION entries given below: 01 END-OF-FILE-SWITCH PIC XXX. 88 NO-MORE-RECS VALUE "YES". 88 MORE-RECS VALUE "NO". (i) READ SAMPLE-FILE AT END MOVE "YES" TO NO-MORE-RECS. (ii) IF NO-MORE-RECS = "YES" GO TO LAST-PARA. (iii) IF NO-MORE-RECS GO TO LAST-PARA. Which are wrong? (a) (i) and (ii) (b) (ii) and (iii) (c) (i) and (iii) (d) all

5 Answers   TCS,


how do you reference the variable block file formats from cobol programs

0 Answers  


SSRange is used to do a range check on which of the Following. SUBSCRIPT,INDEX,REFERENCE MODIFICATION,Run-time option.

3 Answers   Lehman Brothers,


What is the use of EVALUATE statement?

4 Answers   Tesco,


Can anyone please give the example of Inline Perform.

6 Answers   TCS,






How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?

0 Answers  


Define static linking and dynamic linking.

0 Answers  


How do u debug a S0C7 abend? (aswered till we get the field which caused that) After knowing the field which caused that how do u know the record which caused that if it is in production env? (dumb) Ok let us assume that we got to know that 100th record caused that and I wanted to skip only 100th record from the file and process from 101th. How to do that in JCL using SORT? (tried with STOPAFT but ended up dumb when he said smthing else is ther)

3 Answers   IBM,


77 I pic 99 value 5 Perorm para-A I times. Para -A. move 10 to I. How many times the para-A will be executed.?

9 Answers   TCS,


How is sign stored in Packed Decimal fields and Zoned Decimal fields?

6 Answers   ABC, HCL, TCS,


how can u pass the values into db2 values from cobol ?

3 Answers   CTS,


What is sqlca and why is it needed in any cobol-db2 program?

1 Answers  


Categories