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

How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?

0 Answers   HeadStrong,


Under which scenario you would go for a static call as opposed to dynamic call?

5 Answers   TCS,


how to access vsam files in cobol and how to differentiate that this is ESDS file

1 Answers   EDS,


how will u find out 3rd week's 2nd day using occurs ?

3 Answers   L&T,


The following entries appear in the WORKING-STORAGE SECTION: 01 DATE-TODAY. 05 YY PIC XX VALUE "90". 05 MM PIC XX VALUE "12". 05 DD PIC XX VALUE :31". 01 DATE-EDIT PIC XX/XX/XX. MOVE DATE-TODAY TO DATE-EDIT. (a) 901231 (b) 90/12/31 (c) 31/12/90 (d) 311290

4 Answers   TCS,






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

2 Answers  


if a dataset is already created with fixed length but after that i want to change fixed length to variable length then how is it possible

3 Answers   IBM,


In an EVALUATE statement, can I give a complex condition on a when clause?

2 Answers  


1) can we display the index?

3 Answers   ADP, IBM,


How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.

0 Answers   Infosys,


What guidelines should be followed to write a structured cobol prgm?

0 Answers  


Wat is the difference between NEXT and CONTINUE statement in cobol,can any one explain with example.

11 Answers   Deloitte,


Categories