In a file if a column account number conatain value 0001234.. how can we move the value to another variable without zero. value may contain any type such as 00123405. we need the value 1234 or 12305. how can we do that in cobol. Please help.



In a file if a column account number conatain value 0001234.. how can we move the value to another v..

Answer / mahesh satya

variable pic 9(08).
perform varying I from 1 by 1 until I < 8 or found
IF VARIABLE(I:1) not = 0 then
compute actual = 8 - I
move VARIABLE(I: actual) to NEW_VARIABLE
set found to true
end-if
end-perform

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

0 Answers  


what is the coding difference between COBOL and CICS.

8 Answers   Cap Gemini,


in the TIME parameter we r giving hours r minutes

4 Answers   IBM,


How to read records in reverse order in flat file? I know we can do it by reading all records into an array.... Then read records in reverse order by using subscript or index but can any body give me the exact code.

5 Answers   TCS,


What is amode(24)?

0 Answers  






What happens when we move a comp-3 field to an edited (say z (9). Zz-)?

0 Answers  


if one main program ,n -subprograms are then which call you follow ?why reasonuhg

4 Answers   UHG,


What are subroutines ? and how do we pass data to the sub routines?

2 Answers   Xansa,


which one is better among static call and dynamic call?

3 Answers  


hi dudes.....can any one help me..... what is SET TO TRUE all about,anyway?

1 Answers  


Can a REDEFINES clause be used along with an OCCURS clause? if yes, 01 WS-TABLE. 03 WS-TABLE-EL OCCURS 5 TIMES PIC X(1) VALUE 'A'. 03 WS-EX REDEFINES WS-TABLE-EL PIC X(5). What can you expect? if no,why?

6 Answers  


how do u link sub pgm to main pgm ?

2 Answers   TCS,


Categories