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 

co sequetial processing

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


Joined: 22 Sep 2005
Posts: 12
Topics: 8

PostPosted: Thu Sep 22, 2005 1:51 am    Post subject: co sequetial processing Reply with quote

hi every one
i got a master file and hundreds of transaction files , based on the transaction file information i need to update the master file and store the output in seperate file i have to do it through cobol..waiting for ur reply Question
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Sep 22, 2005 2:53 am    Post subject: Reply with quote

kavya,

This seems to be some hands on exercise given to you. In long run, it would not be good for you if we give you the answer right away. All we can do is to guide you. You have to try and design the code yourself.

Okay.. First of all, I believe your master file is a VSAM KSDS. Transaction file must be a flat file - PS.

Declare your file-section as shown below.
Code:

       FILE-CONTROL.

           SELECT I-TRAN      ASSIGN        TO  UT-S-ITRAN.

           SELECT I-MASTER  ASSIGN        TO  IMASTER
                              ORGANIZATION  IS  INDEXED
                              ACCESS        IS  RANDOM
                              RECORD KEY    IS  MASTER-KEY
                              FILE STATUS   IS  WS-MASTER-STAT.


Make sure you declare a 2 byte (X(02)) variable to capture the file-status of Master file (WS-MASTER-STAT). You need to declare this in Working-Storage section.

Then code your FD Section in Data Division. I have assumed that your master file and transaction file - both have an LRECL of 300.
Code:

       DATA  DIVISION.
       FILE  SECTION.
      *
       FD  I-TRAN
            LABEL RECORDS ARE STANDARD.
       01  I-TRAN-REC              PIC  X(300).
      *
       FD  I-MASTER
           LABEL RECORDS ARE STANDARD.

       01  WS-MASTER-RECORD       PIC  X(300)


You may have to define item-level variables under I-TRAN-REC Group variable to define the individual fields. You can define this either in working-storage section under a new 01 Group variable or have it defined in FD section itself.

Procedure Division:
Code:

       *-----  Open all files ----------*
         OPEN INPUT I-TRAN
                  I-O I-MASTER
 
       *-----  Read input Tran file -----*
          PERFORM 1000-READ-TRAN-FILE  THRU
                1000-EXIT  UNTIL  WS-TRAN-EOF
 
       *----- Close all Files -----*
         CLOSE I-TRAN
                I-MASTER
 
         STOP RUN.
 
        1000-READ-TRAN-FILE.
       * ---- Code your READ Statement here ---- *
       
       * ---- Check for End-of-File Condition.  If not EOF then go to  ---- *
       * ---- 2000-process-para  -----*
         1000-EXIT.
                EXIT.
 
         2000-PROCESS-PARA.
       *------ Move data from Transaction file to Key field of MASTER ---- *
 
       *------ READ Master file ------ *
                 READ I-MASTER
                 INVALID KEY
                         Display ' Key Not Found ....'
       *------     Insert New Record into Master - From Transaction file  ----*
       *------         Move all fields to corresponding Master file fields   ----- *

                         WRITE WS-MASTER-RECORD
       *------          Check if File-status = 0, Else Display Error Msg -------*
                 NOT INVALID KEY
       *-----          Update Master file contents if Key Matches   -----*
       *-----          Move/Update/Compute values in master file -----*

                         REWRITE  WS-MASTER-RECORD
       *------          Check if File-status = 0, Else Display Error Msg -------*
                 END-READ.
         2000-EXIT.
               EXIT.


Now, you have to build on this and complete the coding.

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
ANIL SARATHY
Beginner


Joined: 30 Aug 2005
Posts: 88
Topics: 3
Location: Syracuse,New york

PostPosted: Thu Sep 22, 2005 3:15 am    Post subject: Reply with quote

"hundreds of transaction files"........ is it files or records. Rolling Eyes

Phantom has given almost the code.

if flat files are used as master and transaction, sort both the files before you start and compare each record in one with other file.
_________________
Anil Sarathy
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Sep 22, 2005 4:57 am    Post subject: Reply with quote

kavya,

Please search for posting. check this link

http://mvsforums.com/helpboards/viewtopic.php?t=11

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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