MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Comparision Logic help

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vallabhaneni
Beginner


Joined: 26 Dec 2002
Posts: 23
Topics: 7

PostPosted: Thu Jan 09, 2003 10:02 am    Post subject: Comparision Logic help Reply with quote

Code:

IF NDDIPROC-PROCEDURE-CODE EQUAL                             
                           HCPC-COMMON-PROCE-SYS-CODE       
    MOVE 'N' TO MATCH-FOUND                                 
    MOVE  +1 TO W-SUB                                       

    PERFORM VARYING W-SUB FROM +1 BY +1 UNTIL               
     MATCH-FOUND EQUAL 'Y' OR W-SUB GREATER +5               
    IF NDDIPROC-TY-SVCD EQUAL HCPCS-TYPE-SERVICE-CODE1(W-SUB)
        MOVE 'Y' TO MATCH-FOUND                               
    END-IF                                                   
    END-PERFORM               
                             
    IF MATCH-FOUND EQUAL 'Y'                                 
        PERFORM 2400-WRITE-MATCH-FILE THRU 2400-EXIT             
    ELSE                                                     
        PERFORM 2500-WRITE-NOT-MATCH-FILE THRU 2500-EXIT         
    END-IF
                                                   
 PERFORM 2100-READ-INPUT-FILE1 THRU 2100-EXIT               
 PERFORM 2200-READ-INPUT-FILE2 THRU 2200-EXIT 

In my above code comparison logic when I come to second comparison first record equal it has to be write and then it has to check second occurance it will do like that or not.

Thanks
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12368
Topics: 75
Location: San Jose

PostPosted: Thu Jan 09, 2003 11:04 am    Post subject: Reply with quote

Vallabhaneni,


If your intention is to write out every matching occurance for a given key then you need to move the IF MATCH-FOUND EQUAL 'Y' logic within the perform loop.

Code:


PERFORM VARYING W-SUB FROM +1 BY +1 UNTIL               
        MATCH-FOUND EQUAL 'Y' OR W-SUB GREATER +5               

    IF NDDIPROC-TY-SVCD EQUAL HCPCS-TYPE-SERVICE-CODE1(W-SUB)
        MOVE 'Y' TO MATCH-FOUND                               
    END-IF                                                   

    IF MATCH-FOUND EQUAL 'Y'                                 
        PERFORM 2400-WRITE-MATCH-FILE THRU 2400-EXIT             
    ELSE                                                     
        PERFORM 2500-WRITE-NOT-MATCH-FILE THRU 2500-EXIT         
    END-IF

END-PERFORM                 



Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vallabhaneni
Beginner


Joined: 26 Dec 2002
Posts: 23
Topics: 7

PostPosted: Thu Jan 09, 2003 11:53 am    Post subject: Reply with quote

Hi Kolusu

Thanks for the information.But If does not match in second field ,then also i have to write a record with first field match and second field does not match from occurs.

Thanks

Vallabhaneni
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12368
Topics: 75
Location: San Jose

PostPosted: Thu Jan 09, 2003 11:59 am    Post subject: Reply with quote

vallabhaneni,

Please post a sample input data and expected output data, so that it will be easy for other people to intrepret as to what you are trying to do.

Thanks

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vallabhaneni
Beginner


Joined: 26 Dec 2002
Posts: 23
Topics: 7

PostPosted: Thu Jan 09, 2003 12:55 pm    Post subject: Reply with quote

Thanks Kolusu,

Input file 1
record 1
procedure code 11111
type of service 1
record 2
11112
trpeof serive 2

input file 2
record 1
procedure code 11111
type of service first occurs value 1
second occurs value 2
third 3
fourth 4
fifth 5

record 2
procedure code 11112
type of service first occurs 1
second 2
third 3
fourth4
fifth 5

i need one out put like if matches in first filed and second field
out put file 1
first record
procedure type of service
11111 1
second record
11112 2

if first field match in both records and second field doesnot match
then

output file 2
first record
procedure code type of service
11111 2
11111 3
11111 4
11111 5

second record

11112 1
11112 3
11112 4
11112 5

Sorry for the inconvience.
Thanks for you help

Vallabhaneni
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12368
Topics: 75
Location: San Jose

PostPosted: Thu Jan 09, 2003 2:07 pm    Post subject: Reply with quote

vallabhaneni,

I had hard time reading your input data and finally after scratching a lil bit ,I was able to understand what you want to do.Try to post the input data as follows.

Input file: 1
Code:

Procedure-code      service-type
11111               1
11112               2


Input file:2
Code:

Procedure-code      service-type(occurs 5 times)
11111               12345
11112               12345


Output Match file:1
Code:

Procedure-code      service-type
11111               1
11112               2


Output Non-Match file:2
Code:

Procedure-code      service-type
11111               2
11111               3
11111               4
11111               5

11112               1
11112               3
11112               4
11112               5


For this type of output , the solution proposed by me earlier (moving the IF LOGIC) will give you the result.
Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vallabhaneni
Beginner


Joined: 26 Dec 2002
Posts: 23
Topics: 7

PostPosted: Thu Jan 09, 2003 5:00 pm    Post subject: Reply with quote

Hi Kolusu,

Thank you your prompt replies.But I am getting only one record in matched one means first file.I am keep on working on this .If you get a chance pls look into the code.

Thanks
Vallabhaneni
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12368
Topics: 75
Location: San Jose

PostPosted: Thu Jan 09, 2003 5:18 pm    Post subject: Reply with quote

Vallabhaneni,

You are setting the switch(MATCH-FOUND) to 'y' as soon as you find a match in any of the occurance. And you are checking for that switch to be 'y' in the perform varying statement.

So if the match is found the perform will end and come out of the loop. so make changes to
your perform statement to the following.I removed the switch totally.

Code:

PERFORM VARYING W-SUB FROM 1 BY 1 UNTIL W-SUB > 5
    IF NDDIPROC-TY-SVCD EQUAL HCPCS-TYPE-SERVICE-CODE1(W-SUB)
       PERFORM 2400-WRITE-MATCH-FILE THRU 2400-EXIT             
    ELSE                                                     
       PERFORM 2500-WRITE-NOT-MATCH-FILE THRU 2500-EXIT         
    END-IF   
END-PERFORM


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vallabhaneni
Beginner


Joined: 26 Dec 2002
Posts: 23
Topics: 7

PostPosted: Thu Jan 09, 2003 5:25 pm    Post subject: Reply with quote

Thank you very much Kolusu,

Thanks
Vallabhaneni
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group