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 with Multiple Value in WHERE Clause

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

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Nov 12, 2013 2:40 pm    Post subject: 88 Level with Multiple Value in WHERE Clause
Reply with quote

Hi All,

Can I use an 88 Level variable which can have multiple values in a WHERE clause.
For Ex: My 88 Level variable definition is as:

Code:
05  WS-STATUS                             PIC S9(2) COMP-3.   
    88  WS-VALID-STATUS                   VALUES +01, +02, +03,
                                                 +04, +05, +08,
                                                 +09, +10, +11
                                                 +12.         
    88  WS-INVALID-STATUS                 VALUES +06, +07.


I know, I can use WHERE VALUE IN, but I was just wondering if I can use it like this:
Code:
            SET WS-VALID-STATUS           TO TRUE.

And in SQL Query as:
Code:
            WHERE STATUS = :WS-STATUS.


I just can't test it now, that's why I'm posting here.

Thanks
Neeraj.
Back to top
View user's profile Send private message

GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Tue Nov 12, 2013 2:56 pm    Post subject:
Reply with quote

No
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Nov 12, 2013 3:39 pm    Post subject:
Reply with quote

Thanks GuyC
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Nov 12, 2013 6:55 pm    Post subject: Reply to: 88 Level variable with Multiple Value in WHERE Cla
Reply with quote

When you SET ... TO TRUE the data-name gets the first value from the 88, so that the 88 will be "true". The data-name can only have one value.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Nov 12, 2013 7:41 pm    Post subject:
Reply with quote

Thanks Bill.
But then how does this work in IF statements.

Code:
           MOVE +2                                TO WS-STATUS.

           IF WS-VALID-STATUS
           .......................
           .......................
           ELSE
           .......................
           .......................
           END-IF.


I used it like below and it's working.
Code:
            WHERE STATUS IN ( :WS-STATUS)


Thanks.
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: Tue Nov 12, 2013 8:04 pm    Post subject:
Reply with quote

Hello,

Quote:
I used it like below and it's working.

For which values of :ws-status?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Nov 12, 2013 10:56 pm    Post subject:
Reply with quote

You have made a fairly common mistake. WS-VALID-STATUS and WS-INVALID-STATUS are not variable in COBOL They are called conditionals and cannot be considered variables. Hence you cannot use one as a host variable. If you expand your IF statement by using the LIST option in your COBOL compile, you will see your IF WS-VALID-STATUS actually expands into a series of pseudo-assembler statements, each one comparing the value of WS-STATUS against one of the values the conditional references.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Nov 13, 2013 10:44 am    Post subject:
Reply with quote

Thanks everyone for your valuable suggestions.

I didn't get a chance to test properly. May be I have missed tsomething. We are having some problem with the Changeman. Yesterday they fixed the problem, but that was momentary. So currently I can't compile or bind, until the problem is resolved.

I will do a proper testing and update my results here.

Thanks again.
Neeraj.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Wed Nov 13, 2013 2:27 pm    Post subject:
Reply with quote

only thing that slightly looks like what you want is :

Code:
01  WS-VALID-STATUS-INLIST.
    05  WS-VS-01        PIC S9(4)  COMP value +04.
    05  WS-VS-02        PIC S9(4)  COMP value +05.
    05  WS-VS-03        PIC S9(4)  COMP value +08.
    05  WS-VS-04        PIC S9(4)  COMP value +09.
    05  WS-VS-05        PIC S9(4)  COMP value +10.
    05  WS-VS-06        PIC S9(4)  COMP value +11.
    05  WS-VS-07        PIC S9(4)  COMP value +12.
...
EXEC SQL
   ...
   WHERE STATUS IN (:WS-VALID-STATUS-INLIST)
END-EXEC
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Mon Nov 18, 2013 1:05 pm    Post subject:
Reply with quote

Hi All,
Quote:
I used it like below and it's working.
Code:
            WHERE STATUS IN ( :WS-STATUS)

Finally the Changeman problem was resolved and I tested my program. I was wrong. It was not giving me desired output.

I used the way GuyC has suggested and it's working fine.

Thank you all for your help and guidance.
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 Nov 18, 2013 7:37 pm    Post subject:
Reply with quote

Good to hear it is working - thank you for the testing and followup icon_smile.gif

d
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 Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
No new posts Execute multiple DB2 Load commands in... faizm DB2 4 Wed Aug 03, 2016 12:53 pm
This topic is locked: you cannot edit posts or make replies. JCL MULTIPLE STEP EXECUTION QUERY Susanta JCL & VSAM 18 Sat Jul 30, 2016 1:17 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Multiple parameters Csongor All Other Mainframe Topics 16 Thu Jun 09, 2016 7:54 pm


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