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

88 level range problem.


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

New User


Joined: 10 Apr 2006
Posts: 14

PostPosted: Mon Aug 11, 2008 5:16 pm
Reply with quote

Code:
01 VALID-SW             PIC X(02).         
   88 VALID             VALUE '1' THRU '30'.

MOVE '1*' TO VALID-SW.         
DISPLAY 'VALID-SW - ' VALID-SW.
IF VALID                       
   DISPLAY 'RITE'             
ELSE                           
   DISPLAY 'NOT RITE'         
END-IF.                       
                               
MOVE '2*' TO VALID-SW.         
DISPLAY 'VALID-SW - ' VALID-SW.
IF VALID                       
   DISPLAY 'RITE'             
ELSE                           
   DISPLAY 'NOT RITE'         
END-IF.                       
                               
MOVE '3*' TO VALID-SW.         
DISPLAY 'VALID-SW - ' VALID-SW.
IF VALID                       
   DISPLAY 'RITE'               
ELSE                           
   DISPLAY 'NOT RITE'           
END-IF.                         
                               
MOVE '*1' TO VALID-SW.         
DISPLAY 'VALID-SW - ' VALID-SW.
IF VALID                       
   DISPLAY 'RITE'               
ELSE                           
   DISPLAY 'NOT RITE'           
END-IF.                         
                               
MOVE '1' TO VALID-SW.           
DISPLAY 'VALID-SW - ' VALID-SW.
IF VALID                       
   DISPLAY 'RITE'               
ELSE                           
   DISPLAY 'NOT RITE'           
END-IF.



i have validation on one indicator in my module. its range is 1 to 30. any value other than this is not right. However when i give 1*, 2*, 3* it accepts that value as valid. [* is any special character].
Same if i extend the range to 40, it accepts 4*.

here is the output.

Code:
VALID-SW - 1*
RITE         
VALID-SW - 2*
RITE         
VALID-SW - 3*
RITE         
VALID-SW - *1
NOT RITE     
VALID-SW - 1 
RITE         


Quote:
why does it happen
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Aug 11, 2008 5:27 pm
Reply with quote

Code:
01 VALID-SW             PIC X(02).         
   88 VALID             VALUE '1' THRU '30'.
This is an alphanumeric field. Since you did not say '01' THRU '30' the system assumes you mean '1 ' (that's a blank after a 1) is the starting value. '1*' is perfectly valid in this case, as it's in the range you specified -- and so is '1Z'. Maybe if you say what you're trying to do?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Aug 11, 2008 5:32 pm
Reply with quote

Code:
01 VALID-SW             PIC X(02).         
01 VALID-SW-R          PIC 9(02).
   88 VALID             VALUE 1 THRU 30.

This should work. ( I havent tested it though.)
What you defined is
VALUE '1b' THRU '30'. where b is space.
So the whole range of values between x'F140' TO X'F340' will set the switch VALID. 1* = x'F15C' so the switch is set.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Aug 11, 2008 5:38 pm
Reply with quote

icon_redface.gif Forgot to add redefines in my last post-
Code:
01 VALID-SW             PIC X(02).         
01 VALID-SW-R  redefines VALID-SW        PIC 9(02).
   88 VALID             VALUE 1 THRU 30.

If this is not what you wanted, as Robert already asked, please let us know what exactly are you trying to achieve.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Aug 11, 2008 5:38 pm
Reply with quote

agkshirsagar wrote:
Code:
01 VALID-SW             PIC X(02).         
01 VALID-SW-R          PIC 9(02).
   88 VALID             VALUE 1 THRU 30.

This should work. ( I havent tested it though.)
What you defined is
VALUE '1b' THRU '30'. where b is space.
So the whole range of values between x'F140' TO X'F340' will set the switch VALID. 1* = x'F15C' so the switch is set.


This will allow values of 01 thru 30 and may cause an error for nonnumeric values.
Back to top
View user's profile Send private message
paritosh mathur

New User


Joined: 10 Apr 2006
Posts: 14

PostPosted: Mon Aug 11, 2008 5:40 pm
Reply with quote

agkshirsagar wrote:
Code:
01 VALID-SW             PIC X(02).         
01 VALID-SW-R          PIC 9(02).
   88 VALID             VALUE 1 THRU 30.

This should work. ( I havent tested it though.)
What you defined is
VALUE '1b' THRU '30'. where b is space.
So the whole range of values between x'F140' TO X'F340' will set the switch VALID. 1* = x'F15C' so the switch is set.


i accept the case of '1b'. but then what is the problem with 2* 3* .???
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Aug 11, 2008 5:59 pm
Reply with quote

Explanation remains the same-
2* = x'f25c' 3*= 'f35c' both fall in the range x'F140' TO X'F3F0'.
Did I mention F340 in last post? It was a typo. icon_redface.gif Sorry if that confused you. I am not good with the HEX values you see. icon_wink.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Aug 11, 2008 6:00 pm
Reply with quote

For the posted code, you either need a MOVE from VALID-SW to VALID-SW-R or a REDEFINES in VALID-SW-R on VALID-SW. The original code defines as valid all hex values from 'F140' to 'F3F0'; 'F15C' IS '1*' and 'F25C' is '2*' and both are definitely in the range specified.[/quote]
Back to top
View user's profile Send private message
paritosh mathur

New User


Joined: 10 Apr 2006
Posts: 14

PostPosted: Mon Aug 11, 2008 6:07 pm
Reply with quote

thanx guys.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 11, 2008 9:00 pm
Reply with quote

Hello,

You might try this. . .
Code:

       01  VALID-SW        PIC XX.                   
           88 VALID VALUES ARE '01' THRU '09'
                               '10' THRU '19'
                               '20' THRU '29'
                               '30'.         
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 To get the count of rows for every 1 ... DB2 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts How to load to DB2 with column level ... DB2 6
No new posts Generate random number from range of ... COBOL Programming 3
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
Search our Forums:

Back to Top