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

I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......

4 Answers   Accenture,


What is SSRANGE, NOSSRANGE ?

5 Answers  


A paragraph PARA-X is to be executed when none of the data names A, B and C have value of 1. Which of the following will achieve this ? (a) IF A NOT = 1 OR B NOT = 1 OR C NOT = 1 PERFORM PARA-X (B) IF NOT A= 1 AND B= 1 AND C = 1 PERFORM PARA-X (C) IF A NOT =1 IF NOT B = 1 OR C= 1 PERFORM PARA-X (C) IF A NOT = 1 AND B NOT = 1 AND C NOT = 1 PERFORM PARA-X

3 Answers   TCS,


what are decleratives in cobol?

0 Answers   GGG, Satyam,


what is meant by binary search?

4 Answers  






Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.

0 Answers   iNautix,


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

4 Answers   UHG,


i have two file one is ksds another one is esds i want store matching records in flat file how to you matching.

2 Answers   Wipro,


how you will define variables length in cobol.

3 Answers   Temenos,


At the minimum, which division of COBOL is enough to be coded?

3 Answers   CTS,


Why IBM?

1 Answers   IBM,


What is Control Break processing ?

1 Answers   iGate,


Categories