Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

problem with checkig alphanumeric values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
lmuvalla

New User


Joined: 27 Nov 2009
Posts: 7
Location: chennai

PostPosted: Tue Apr 20, 2010 2:47 pm    Post subject: problem with checkig alphanumeric values
Reply with quote

Hi ...all

Iam facing some compiling problem while checking a varible for a alphanumeric value in it

IF ZW-KOOP-SCHL(4:1)= '/'
AND ZW-ALPHA1 IS ALPHANUMERIC
AND ZW-ALPHA2 IS ALPHANUMERIC
CONTINUE
ELSE
PERFORM U3000-WRITE-CAPLIST2
PERFORM U4000-WRITE-LIST
GO TO F05Z
END-IF


the above thing is my code...

iam getting compile time severe kind error

this is my error message
"ALPHANUMERIC" was found in a conditional expression. The "IF" statement was discarded.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Apr 20, 2010 2:56 pm    Post subject:
Reply with quote

You can test a variable for ALPHABETIC, or you can test the variable for NUMERIC. Since every variable is ALPHANUMERIC, there is no condition test in COBOL for this.

Perhaps if you explain just what it is you are wanting to do, we can provide assistance?
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Apr 20, 2010 3:05 pm    Post subject:
Reply with quote

Hi lmuvalla,

Please have a look into the manuals for Coding Conditional Expressions.

Hope this is what you were looking for ....
Back to top
View user's profile Send private message
lmuvalla

New User


Joined: 27 Nov 2009
Posts: 7
Location: chennai

PostPosted: Tue Apr 20, 2010 3:25 pm    Post subject:
Reply with quote

thanx for replies..

iam jus searching for a alphanumeric value in that iam expecting date there in the for mat of mmm/yyyyyyy...

alphanumeric check is working outside the IF condition..

and it is not working in IF condition

as of now i jus replaced my statement iam now checking that variable with numeric and alphabetic...values...
Back to top
View user's profile Send private message
lmuvalla

New User


Joined: 27 Nov 2009
Posts: 7
Location: chennai

PostPosted: Tue Apr 20, 2010 3:25 pm    Post subject:
Reply with quote

Thanx...Binop...n robert
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Apr 20, 2010 3:48 pm    Post subject:
Reply with quote

Hi lmuvalla,

As Robert has mentioned all variables are alphanumeric. Am a bit curious reading your replies...
Quote:
iam jus searching for a alphanumeric value in that iam expecting date there in the format of mmm/yyyyyyy...
Am a little concerned from this statement because it gives me a feeling you have misinterpreted the meaning of alphanumeric. And anyway if you want to verify the format, why do you want a "alphanumeric" check ? Could you please post how you are doing now ?
Back to top
View user's profile Send private message
lmuvalla

New User


Joined: 27 Nov 2009
Posts: 7
Location: chennai

PostPosted: Tue Apr 20, 2010 4:14 pm    Post subject:
Reply with quote

Hi binop

Na iam not misinterpreted...about alphanumeric values...

actually while defining we are using pix X alphanumeric for defining...

now i jus searching for a thing whether any check is there for alphanumeric...


now iam clear about using alphanumeric in conditional statements
Back to top
View user's profile Send private message
lmuvalla

New User


Joined: 27 Nov 2009
Posts: 7
Location: chennai

PostPosted: Tue Apr 20, 2010 4:18 pm    Post subject:
Reply with quote

yes its look like i misunderstood alphanumeric...

i have one more qn is all special charachters comes under alphanumeric category...
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Apr 20, 2010 4:32 pm    Post subject:
Reply with quote

Yes.

You can refer the link, if you need more information regarding the alphanumeric literals.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1218
Location: Israel

PostPosted: Tue Apr 20, 2010 5:02 pm    Post subject:
Reply with quote

Have you got this simple rule: in alphanumeric, "alpha" stands for alphabet (a-z, A-Z) and "numeric" stands for numeric (0-9)
So it doesn't fit for checking dates. That should answer your 2nd question too.

Additionally, the word ALPHANUMERIC cannot be used in conditions. Only in the INITIALIZE statement.

If you want to check a string against a set of characters of your choice, use the SPECIAL-NAMES paragraph.
Also search for SPECIAL-NAMES in the forum. There are lots of answers.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Apr 20, 2010 5:23 pm    Post subject:
Reply with quote

Alphanumeric means the character is any one of the 256 valid characters in the EBCDIC collating sequence -- which includes numbers, letters (both lower and upper case), punctuation symbols, and non-printing characters.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 20, 2010 5:27 pm    Post subject: Reply to: problem with checkig alphanumeric values
Reply with quote

Possibly, another method. Your COBOL version/release must be COBOL II or greater.

Code:

03  WS-ZW-KOOP-SCHL PIC  X(???).
03  WS-SUB PIC  9(08) COMP.
03  WS-SUB-X REDEFINES WS-SUB PIC  X(04).
03  WS-XLATE-FROM-TBL PIC  X(256).
03  WS-XLATE-TO-TBL PIC  X(256).

MOVE 1 TO TALLY.
MOVE ZERO TO WS-SUB.
MOVE ZW-KOOP-SCHL TO WS-ZW-KOOP-SCHL.
MOVE SPACES TO WS-XLATE-TO-TBL.

* BUILD THE 'FROM' TRANSLATE-TBL. WHEN COMPLETE, BYTES 001-256 WILL CONTAIN X'00' THROUGH X'FF'.

PERFORM UNTIL TALLY > LENGTH OF WS-XLATE-FROM-TBL
    MOVE WS-SUB-X (4:) TO WS-XLATE-FROM-TBL (TALLY:1)
    ADD 1 TO TALLY
    ADD 1 TO WS-SUB
END-PERFORM.

* NOW, BECAUSE THE 'TO-TBL' HAS BEEN CLEARED TO SPACES, MOVE ONLY THE DATA-BYTES FROM THE 'FROM'  TRANSLATE-TBL TO THE 'TO' TRANSLATE-TBL THAT YOU CONSIDER VALID. THEN CONVERT ALL BYTES IN WS-ZW-KOOP-SCHL USING AN 'INSPECT'. NOTE THAT WS-ZW-KOOP-SCHL AND ZW-KOOP-SCHL MUST BE THE SAME LENGTH AND IS A TEMPORARY WORK-AREA.

INSPECT WS-ZW-KOOP-SCHL CONVERTING WS-XLATE-FROM-TBL TO WS-XLATE-TO-TBL.

* SET TALLY TO ZERO AND USE IT TO DETERMINE WS-ZW-KOOP-SCHL IS VALID, BY TESTING TALLY AFTER THIS INSPECT FOR A VALUE GREATER THAN ZERO.

MOVE ZERO TO TALLY.

INSPECT WS-ZW-KOOP-SCHL TALLYING TALLY FOR ALL SPACE.

When you're done with the second INSPECT and TALLY exceeds ZERO then there are bytes in WS-ZW-KOOP-SCHL that you've determined (by virtue of the 'XLATE-TO-TBL' contents) to be invalid.

Bill
Back to top
View user's profile Send private message
lmuvalla

New User


Joined: 27 Nov 2009
Posts: 7
Location: chennai

PostPosted: Tue Apr 20, 2010 6:16 pm    Post subject:
Reply with quote

thank u all....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us