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
 

 

Comp & file access doubts

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

New User


Joined: 06 Jan 2006
Posts: 21

PostPosted: Mon Apr 24, 2006 10:42 am    Post subject: Comp & file access doubts
Reply with quote

1. how to view comp values in cobol
2. I have two sequential files (transaction & master), both have a common field called emp-no.

my requirement - Read transaction file and search whether trans-emp-no is available in master file. if available then update master file with transaction data else write a new record in the master file.


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

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Mon Apr 24, 2006 6:36 pm    Post subject: Re: Comp & file access doubts
Reply with quote

Quote:
1. how to view comp values in cobol

Move them to corresponding Normal Variables and DISPLAY accordingly.

Quote:
2. I have two sequential files (transaction & master), both have a common field called emp-no.

my requirement - Read transaction file and search whether trans-emp-no is available in master file. if available then update master file with transaction data else write a new record in the master file.

So what is the problem...

Regards,
Priyesh.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Apr 27, 2006 1:02 am    Post subject: Re: Comp & file access doubts
Reply with quote

kalaignar_S,

This is a very simple two file compare.

Step 1. Both master and transaction file must be sorted in Emp-No order.

Step 2. Two file compare. (pseudo code)

Code:


    OPEN INPUT  MASTER-FILE
                TRANSACTION-FILE
         OUTPUT MEW-MASTER-FILE

    READ MASTER-FILE AT END MOVE HIGH-VALUES TO MASTER-EMP-NO
    READ TRANSACTION-FILE AT END MOVE HIGHT-VALUES TO TRANS-EMP-NO.

    PERFORM
      UNTIL MASTER-FILE-EOF
      AND   TRANSACTION-FILE-EOF
        IF MASTER-EMP-NO = TRANS-EMP-NO
            UPDATE MASTER-RECORD FROM TRANSACTION-RERCORD
            WRITE NEW-MASTER-RECORD FROM MASTER-RECORD
            READ MASTER-FILE AT END MOVE HIGH-VALUES TO MASTER-EMP-NO
            READ TRANSACTION-FILE AT END MOVE HIGHT-VALUES TO TRANS-EMP-NO
        ELSE
            IF MASTER-EMP-NO > TRANS-EMP-NO
                WRITE NEW-MASTER-RECORD FROM TRANSACTION-RECORD
                READ TRANSACTION-FILE AT END MOVE HIGHT-VALUES TO TRANS-EMP-NO
            ELSE
                WRITE NEW-MASTER-RECORD FROM MASTER-RECORD
                READ MASTER-FILE AT END MOVE HIGH-VALUES TO MASTER-EMP-NO
            END-IF
        END-IF
    END-PERFORM

    CLOSE MASTER-FILE
          TRANSACTION-FILE
          NEW-TRANSACTION-FILE



Dave,
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts IMS DC screen Access sivasaras IMS DB/DC 3 Fri Nov 18, 2016 6:38 pm


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