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

If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly

0 Answers  


What is Redefines clause?

8 Answers  


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

3 Answers   CTS,


How do get the result of your program directly on your pc?

0 Answers   UST,


I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?

0 Answers  


Discuss about changing dataset name in proc.

0 Answers  


ZEROES and SPACES are _______ constants (a) Figurative (b) Numeric (c) Non-numeric (d) Alphabete

4 Answers   TCS,


wht r the advantages of 77 level number ?

8 Answers   TCS,


What is the difference between working storage copybook and linkage section copybook?

5 Answers   TCS,


There is a variable with value 19446. Requirement is to convert it to 194.46. I tried it by doing divide by 100 and my receiving field data type is 9(03)v99. But the output is 194. I am not getting the decimal value. Could anyone pls let me know how to get this done?

2 Answers  


what is the minimum number of lines a Cobol program should have to successfully compile and run

11 Answers   ABC, Societe Generale,


How are the next sentence and continue different from each other?

0 Answers  


Categories