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.

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How to use the same COBOL program in Batch and CICS on lines? explain with an example

1912


Can a Search can be done on a table with or without Index?

800


Write some characteristics of cobol as means of business language.

614


how do you reference the variable block file formats from cobol programs

680


Discuss about changing dataset name in proc.

757






In COBOL programming, what is PERFORM? What is VARYING?

668


Name the divisions, which are available in a cobol program?

681


How you can characterize tables in cobol?

710


What is amode(31)

716


How to remove the spaces at the end of each record in the output file of variable length, via cobol program?

670


What is the default value(s) for an initialize? What keyword will allow for an override of the default?

654


Have you used comp and comp-3 in your project? And how?

2006


What type of SDLC u followed? Why?

1516


i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com

1766


How can we find that module can be called – whether DYNAMICALLY or STATICALLY?

708