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 

file 1 & file 2 issue (file handling in COBOL)

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


Joined: 17 Jun 2005
Posts: 15
Topics: 5

PostPosted: Mon Aug 01, 2005 12:31 am    Post subject: file 1 & file 2 issue (file handling in COBOL) Reply with quote

Hi All,

I have 2 seq. files (PS) file 1 and file 2.

for every record in file 1 I have to scan file 2 for a match. I write the output to different files based on the match.

now, when i tried this, I get S0000 U4038 abend. I find from sysout that problem occurs when I am reading file 2 for the second record from file 1.
The file 2 has already reached 'at end' and I want to know how to reset this for every read.

Please help ( If possible, a sample code)
thanks,
vinu
Back to top
View user's profile Send private message
chandresha_t
Beginner


Joined: 20 Jul 2005
Posts: 2
Topics: 0

PostPosted: Mon Aug 01, 2005 2:16 am    Post subject: Reply with quote

vinush2000,

The easiest solution will be to close and open the file 2 for each record on file 1.

Hope this helps,

Chandresha T
Back to top
View user's profile Send private message Yahoo Messenger
vinush2000
Beginner


Joined: 17 Jun 2005
Posts: 15
Topics: 5

PostPosted: Mon Aug 01, 2005 2:20 am    Post subject: Reply with quote

thanks,

but, is that a coding standard to practice?
I am afraid, its not.

vinu
Back to top
View user's profile Send private message
hisabarish
Beginner


Joined: 21 Jun 2005
Posts: 38
Topics: 11

PostPosted: Mon Aug 01, 2005 2:29 am    Post subject: Reply with quote

Hi ,

How it will come to
_________________
Sabari
Madras
Back to top
View user's profile Send private message
vinush2000
Beginner


Joined: 17 Jun 2005
Posts: 15
Topics: 5

PostPosted: Mon Aug 01, 2005 3:20 am    Post subject: Reply with quote

Code:

PROCEDURE DIVISION.                                         
                                                           
     DISPLAY 'MAINLINE OF TRIALPRG'                         
    OPEN INPUT TB07-FILE                                   
               LN01-FILE                                   
         OUTPUT PAPER-FILE                                 
                TAPE-FILE                                   
                CARE-FILE                                   
                CNTL-FILE                                   
    SET NOT-END-OF-FILE TO TRUE                             
    MOVE SPACES TO HOLD-LN01-FORMAT-IND                     
    PERFORM READ-TB07-PARA                                 
    PERFORM UNTIL END-OF-FILE                               
                                                           
        DISPLAY 'AFTER READING TB07  '                     
        PERFORM READ-LN01-PARA                             
        PERFORM UNTIL END-OF-LN01-FILE                     
                                                           
           DISPLAY 'INSIDE PERFORM UNTIL'                   
                                                           
           SET NOT-END-OF-LN01-FILE TO TRUE                 
                                                           
              EVALUATE HOLD-LN01-FORMAT-IND                 
                 WHEN '01'                                 
                 MOVE TB07-LEC-NAME TO HOLD-LEC-NAME       
                 WRITE PAPER-FILE-REC FROM HOLD-REC         
                 WHEN '02'                                 
                 WHEN '03'                             
                 MOVE TB07-LEC-NAME TO HOLD-LEC-NAME   
                 WRITE TAPE-FILE-REC FROM HOLD-REC     
                 WHEN '04'                             
                 MOVE TB07-LEC-NAME TO HOLD-LEC-NAME   
                 WRITE CARE-FILE-REC FROM HOLD-REC     
                 WHEN OTHER                           
                 CONTINUE                             
              END-EVALUATE                             
                                                       
           PERFORM READ-LN01-PARA                     
      END-PERFORM                                     
      PERFORM READ-TB07-PARA                           
    END-PERFORM                                       
    WRITE CNTL-FILE-REC FROM CNTL-REC                 
                                                       
    CLOSE TB07-FILE                                   
          LN01-FILE                                   
           PAPER-FILE                                 
           TAPE-FILE                                   
           CARE-FILE                                   
           CNTL-FILE                                   
    STOP RUN.                                         
 READ-TB07-PARA.                                         
     IF NOT END-OF-FILE                                 
D     DISPLAY 'INSIDE TB07 READ PARA'                   
        READ TB07-FILE                                   
        AT END                                           
        SET END-OF-FILE TO TRUE                         
        END-READ                                         
     END-IF.                                             
/                                                       
 READ-LN01-PARA.                                         
D     DISPLAY 'NOW READING LNO1 FILE'                   
        READ LN01-FILE                                   
        AT END                                           
        SET END-OF-LN01-FILE TO TRUE                     
        NOT AT END                                       
        IF LN01-LEC-ID = HOLD-LEC-CODE                   
           MOVE LN01-FORMAT-IND TO HOLD-LN01-FORMAT-IND 
        END-IF                                           
        END-READ.                                 


Thanks all, Smile for your response. here is my code. the abend 4038 happens when the program reads the LN01 file ( thats after fetching the second record from TB07)

please help ![/code]
Back to top
View user's profile Send private message
hisabarish
Beginner


Joined: 21 Jun 2005
Posts: 38
Topics: 11

PostPosted: Mon Aug 01, 2005 4:44 am    Post subject: Reply with quote

Dear vinush2000,
Really I am not understand your code. What is your goal ie., what is your exact requirement. Pls. tell me clearly. why u r coding the evaluate statement.
_________________
Sabari
Madras
Back to top
View user's profile Send private message
vinush2000
Beginner


Joined: 17 Jun 2005
Posts: 15
Topics: 5

PostPosted: Mon Aug 01, 2005 4:48 am    Post subject: Reply with quote

hi, thanks for your interest

goal
------
to scan file 2 for every file 1 entry and write some o/p (blah..) based on the match found.

evaluate
---------
to write contents (blah...) into particular file based on the INDICATOR

hope its clear now,
vinu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Aug 01, 2005 7:40 am    Post subject: Reply with quote

vinush2000,

Check this link which explains in detail about matching files.

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

Fyi.. you need to sort both the files on the matching keys and use the logic posted in the above link

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
vinush2000
Beginner


Joined: 17 Jun 2005
Posts: 15
Topics: 5

PostPosted: Tue Aug 02, 2005 12:14 am    Post subject: thanks Reply with quote

thanks, kolusu.

what I wanted was the COBOL Soln. I got much more than that.

thanks a lot,
vinu
Back to top
View user's profile Send private message
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