Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Setting 88 level for COMP variable

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

New User


Joined: 12 Jul 2006
Posts: 24

PostPosted: Tue Oct 06, 2009 9:38 am    Post subject: Setting 88 level for COMP variable
Reply with quote

Hi,

I'm trying to validate a SMALLINT variable from a DB2 table in my cobol program. I'm fetching it to a S9(04) COMP variable and have to validate against numeric values. If this is possible is the below code valid?

05 WS-NBR-FLG PIC S9(04) COMP.
88 WS-OLD-NBR VALUE 1,2,3.
88 WS-NEW-NBR VALUE 4,5,6,7.

Thanks & Regards,
Lalitha.
Back to top
View user's profile Send private message

Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Oct 06, 2009 10:24 am    Post subject:
Reply with quote

It depends on what the code is you are using. You've shown the field definitions but not the code.
Back to top
View user's profile Send private message
lalitha_gld

New User


Joined: 12 Jul 2006
Posts: 24

PostPosted: Tue Oct 06, 2009 11:31 am    Post subject:
Reply with quote

If I declare a table - 'TABLE' as

CL# Column name Data type

1 NBR SMALLINT

With the field definitions i had given earlier, this is how am planning to set my code :

EXEC SQL
DECLARE CRSR CURSOR FOR
SELECT NBR FROM TABLE
END-EXEC.

EXEC SQL
OPEN CRSR
END-EXEC.

EXEC SQL
FETCH CRSR
INTO :WS-NBR-FLG
END-EXEC.

EVALUATE TRUE

WHEN WS-OLD-NBR
<PROCESS ONE>

WHEN WS-NEW-NBR
<PROCESS TWO>
WHEN OTHER
PROCESS ERROR PARA TO WRITE ERROR RECORD
END-EVALUATE.


Would this be valid.Pls let me know.

Tx,
Lalitha.
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Tue Oct 06, 2009 12:33 pm    Post subject: Reply to: Setting 88 level for COMP variable
Reply with quote

Hi Lalitha

Try to use THRU clause in the 88 level.
Code:
05 WS-NBR-FLG PIC S9(04) COMP.
    88 WS-OLD-NBR VALUE 1 THRU 3.
    88 WS-NEW-NBR VALUE 4 THRU 7.


Regards
Raghunath
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Tue Oct 06, 2009 2:53 pm    Post subject:
Reply with quote

Using THRU is exactly the same as specifying the individual values to COBOL -- so there's no difference between the original posted code and your "revision", Raghunath. Specifying the values one way or the other is merely a personal preference.
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Tue Oct 06, 2009 3:47 pm    Post subject:
Reply with quote

Lalitha,
Thats valid. I believe you can easily test this.
Back to top
View user's profile Send private message
santy
Warnings : 1

New User


Joined: 19 Jul 2007
Posts: 22
Location: mumbai

PostPosted: Tue Oct 06, 2009 4:33 pm    Post subject:
Reply with quote

Lalitha,

The procedure you are using above is the correct one. It will work.
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 Setting Font Type for XMIT satish.ms10 All Other Mainframe Topics 3 Fri Sep 15, 2017 10:01 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Finding IMS resource blocker after se... Hooman24 IMS DB/DC 1 Wed Aug 16, 2017 9:17 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us