IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Moving numeirc to alphanumeirc for comparition with zero


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mflax

New User


Joined: 01 Sep 2006
Posts: 17
Location: Delhi

PostPosted: Sat Oct 21, 2006 11:44 am
Reply with quote

I have a alphanum field as x(4) and
i have a numeric field as 9(2) which have value as zero

if suppose, I moved numeirc to alphanumeirc then I compared alphanumeric like below
if alpha-numeirc = 0 then perform first else perform second.

where it'll go ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Oct 21, 2006 6:51 pm
Reply with quote

It will not compile. you need to change your code from:
Code:
If alpha-numeirc = 0 then perform first else perform second.


to:

Code:
If alpha-numeirc = '0000' then perform first else perform second.


after coding properly, first will be performed.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Oct 21, 2006 6:57 pm
Reply with quote

Correction:

after the move of numeirc to alpha-numeirc, alpha-numeirc will contain '00bb' where b = space.

Unless you compare alpha-numeirc to '00' (or '00bb') second will be performed.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sun Oct 22, 2006 2:10 am
Reply with quote

Quote:
It will not compile. you need to change your code from:

I am not sure, if it throws a compilation error, Does it?... but expected execution wouldn't be achieved until compare that alphanum variable with a value with quotes.

So in your current coding situation, It'll always execute second until you modify it to '00bb' as suggested by Mr. Dick.
Back to top
View user's profile Send private message
kutty.r

New User


Joined: 22 Jun 2006
Posts: 24

PostPosted: Thu Oct 26, 2006 11:58 am
Reply with quote

hi,

you cant test the class of an field like is alpha-numeric.
the class test can be done only as follows

is numeric
is alphabetic
is alphabetic-higher
is alphabetic-lower
icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts Moving a COMP-3 Variable to a Numeric... COBOL Programming 2
No new posts Moving a PS file as body of a mail! JCL & VSAM 4
No new posts Moving UDB database to Db2 on z/OS DB2 4
No new posts Moving values to a variable of copybo... COBOL Programming 6
Search our Forums:

Back to Top