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 the advantage of using redefines instead of delaring the variables ?

5 Answers   HCL,


I have a occurs for 100 times but it has executed 101 time what could be the reason?

4 Answers  


What is mean by maxcc

7 Answers   Syntel,


I have dataset DS1 which has records say 1 2 3 4 5 ... ... etc And also I have second dataset DS2 whcih has records 1 3 4 5 6 8 .. ... Both the files are sorted and now I want to compare these files and write it into the third files if the records are matching.

4 Answers   FIS, Wipro,


I have a cobol program with a sub program. How ca i find that it is a dynamic call? or static call..?

3 Answers   HCL, IBM,






what is a zoned decimal data type and how it will be stored?

2 Answers   IBM,


How many types of sorts are there in cobol?

5 Answers   Cap Gemini,


How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length

2 Answers   IBM, Wipro,


How you can delete a record from a ps file in cobol?

1 Answers  


What care has to be taken to force program to execute above 16 Meg line?

1 Answers  


input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

0 Answers  


db2 variable decimal(15,2) what is the equalent size of cobol variable

2 Answers   Syntel,


Categories