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
 
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
This topic is locked: you cannot edit posts or make replies. Limit access to certain RACF group cvnlynn CLIST & REXX 5 Wed Aug 23, 2017 2:28 am

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