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
 

 

88 level range problem.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: 88 level range problem.
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: 7997
Location: Bellevue, IA

PostPosted: Mon Aug 11, 2008 5:27 pm    Post subject:
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: 686
Location: Earth

PostPosted: Mon Aug 11, 2008 5:32 pm    Post subject:
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: 686
Location: Earth

PostPosted: Mon Aug 11, 2008 5:38 pm    Post subject:
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    Post subject:
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    Post subject: 88 level range problem.
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: 686
Location: Earth

PostPosted: Mon Aug 11, 2008 5:59 pm    Post subject:
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: 7997
Location: Bellevue, IA

PostPosted: Mon Aug 11, 2008 6:00 pm    Post subject:
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    Post subject: 88 level range problem.
Reply with quote

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

Site Director


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

PostPosted: Mon Aug 11, 2008 9:00 pm    Post subject:
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    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 reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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