PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 12/12/2014 10:39 AM by  Woozy
Can I leverage relations in COBOL query?
 7 Replies
Sort:
You are not authorized to post a reply.
Page 1 of 212 > >>
Author Messages
Woozy
Private
Private
Veteran Member
(3490 points)
Veteran Member
Posts:708


Send Message:

--
12/10/2014 5:06 PM

    Is table relationship data available after performing a COBOL find?  

    For example, if I do an 840-FIND-EMPSET1, is there a way to retrieve data from a related table (i.e PAEMPLOYEE) without having to do an 840-FIND-PAESET1?  Something like EMP-PAEMPLOYEE-PEM-LOCAT-CODE

    I don't think this is possible, but I'd be very happy to be wrong.

    Thanks!

    Kelly

    Kelly Meade
    J. R. Simplot Company
    Boise, ID
    jaherb
    Independent
    Independent
    Veteran Member
    (472 points)
    Veteran Member
    Posts:164


    Send Message:

    --
    12/11/2014 9:56 AM
    Hey Kelly.... you will need to do another find for the PAEMPLOYEE table using the example you describe above. In that example, I usually set my code up to find the PAEMPLOYEE entry right after the EMPLOYEE table... especially since you are using the same key values.

    Jim
    Woozy
    Private
    Private
    Veteran Member
    (3490 points)
    Veteran Member
    Posts:708


    Send Message:

    --
    12/11/2014 10:14 AM
    Thanks Jim. That's what I did, but I thought I'd check to see if there was a shortcut.

    I used the PAEMPLOYEE for simplicity in asking the question, but in this case I'm actually doing a FIND-NEXT loop with PRTIME and need to query PAYMASTR for each PRTIME record to get the Deduction Cycle. I just added the 840-FIND-PYMSET1 within the PERFORM loop. As long as I reset the PYM DB-x values from the PRT with each loop it should work just fine, right?

     
    MOVE ZZVACA-COMPANY         TO DB-COMPANY                
    MOVE ZZVACA-EMPLOYEE        TO DB-EMPLOYEE               
    MOVE ZZVACA-FR-DATE         TO DB-PER-END-DATE           
                                                             
    INITIALIZE ZZVACA-LAST-PPE-PROC-DATE                     
    PERFORM 850-FIND-NLT-PRTSET3                             
                                                             
    IF (PRTIME-FOUND)                                        
        PERFORM                                              
        UNTIL (PRTIME-NOTFOUND)                              
        OR (PRT-COMPANY NOT = ZZVACA-COMPANY)                
        OR (PRT-EMPLOYEE NOT = ZZVACA-EMPLOYEE)              
        OR ((ZZVACA-TO-DATE-NBR NOT = ZEROES)                
        AND (PRT-PER-END-DATE > ZZVACA-TO-DATE-NBR))         
            RFC 1025329 - 12/11/2014 - Kelly Meade           
            Get the deduction cycle and skip if > 7          
            in order to skip special payments                
            MOVE PRT-COMPANY             TO DB-COMPANY       
            MOVE PRT-EMPLOYEE            TO DB-EMPLOYEE      
            MOVE PRT-CHECK-ID            TO DB-CHECK-ID      
            PERFORM 840-FIND-PYMSET1                         
                                                             
            IF (PRT-PER-END-DATE > ZZVACA-LAST-PPE-PROC-DATE)
            AND (PYM-DED-CYCLE-NBR < 7)                      
                MOVE PRT-PER-END-DATE                        
                               TO ZZVACA-LAST-PPE-PROC-DATE  
            END-IF                                           
            PERFORM 860-FIND-NEXT-PRTSET3                    
        END-PERFORM                                          
    END-IF                                                       
    
    Kelly Meade
    J. R. Simplot Company
    Boise, ID
    jaherb
    Independent
    Independent
    Veteran Member
    (472 points)
    Veteran Member
    Posts:164


    Send Message:

    --
    12/11/2014 12:55 PM
    OK... Figured it was just and example...

    I don't really like using the -NLT- and avoid them when I can. When you go after your PAYMASTER, why don't you use index filtering instead. Would be a lot faster as well.
    John Henley
    Private
    Private
    Senior Member
    (9692 points)
    Senior Member
    Posts:3248


    Send Message:

    --
    12/11/2014 1:30 PM
    @jaherb: Assuming he's using period end date on his input form, he's going about it in the correct way; if he drove it from PAYMASTR there is not an index that includes PER-END-DATE.
    Thanks for using the LawsonGuru.com forums!
    John
    You are not authorized to post a reply.
    Page 1 of 212 > >>