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 rmode(any) ?

0 Answers  


if a>b continue display x. dispaly y. end-if display 1 display 2. display 3. what should be my output ?

3 Answers  


subscript and index r not coded in u r application program what will happen?

2 Answers  


01 a pic x(6) value is abcdef 01 b pic x(3) move a to b wht will be the value in b ?

3 Answers   Patni,


What is the Importance of GLOBAL clause According to new standards of COBOL?

2 Answers   Infosys,






How is sign stored in a comp-3 field?

7 Answers  


Difference between file status codes 02 and 22.... since both are for duplicate key detection.

1 Answers  


What is the difference between binary search and sequential search?

0 Answers  


What will happen if we generate GDG +2 version instead of +1 version?

2 Answers   T systems,


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

0 Answers  


Are you comfortable in cobol or jcl?

0 Answers  


How can we know that cobol program is using report file or simple file....?

4 Answers  


Categories