Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to compare

Status
Not open for further replies.

amarg

Programmer
Nov 19, 2002
106
IN
Hi,

I have one variable
44 SUBSCRIBER-NO PIC X(25)

with the value "91111111111111111 "

I want to know value in the variable is starting from '9' or not. I have some conditions based on this. I am very new in COBOL so help me.

Regards,
Amar
 
There are many ways to do this. The simplest is probably:

44 SUBSCRIBER-NO PIC X(25.
48 FIRST-DIGIT PIC X.
48 FILLER PIC X(24).

In the Procedure Division

IF FIRST-DIGIT = '9'
PERFORM WHATEVER
ELSE
PERFORM SOMETHING-ELSE
END-IF.

Good luck
Greg
 
You need to study the basics and make a reasonable
effort in struggling with the problem yourself.
This way, you will eventually be on the way to becoming
an expert in COBOL, and you will develop your problem
solving skills.

People can tell straight away if you haven't made a
reasonable effort, and usually will simply not help you.

I'm not "flaming" you - just suggesting you take the path
that I'm sure the rest of us have taken.
The longest journey starts with the first step.
People are not going to carry you all the way,
but they will help if they see you are trying.

Kindest Regards.





 
Hi,

Thanks for you reply. Problem is i can not change "Procedure Division", and also i don't want to define a new variable. I already tried this and it is working. I just want to know is there any other option ?

--Amar
 
I'm not sure I understand what you men when you say you can't change the Procedure Division and you don't want to add another variable. If we can't change either of these areas, I don't see how you can use a new technique.

Maybe let us know how it checks now and what you're willing to change to have a new method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top