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
 

 

copying the five files into one file.

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

New User


Joined: 26 Feb 2007
Posts: 5
Location: Bangalore

PostPosted: Sat Mar 03, 2007 2:28 am    Post subject: copying the five files into one file.
Reply with quote

I want to take the data from five files and copy into a single file, using cobol program.

Regards
Shrikanth
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Mar 03, 2007 3:09 am    Post subject:
Reply with quote

Are the lrecl and recfm the same?
If they are, just concatenate them as a single input and READ/WRITE them. For that matter, use one of the many utilities available.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Mar 03, 2007 3:30 am    Post subject:
Reply with quote

Hello,

Is the only code in the program going to be copying the input files or is there some unique process needed for each file (i.e. record counts by file, reformatting fields, etc.)?
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Sun Mar 04, 2007 3:54 am    Post subject:
Reply with quote

Code:
ID DIVISION
PROGRAME-ID. TTT.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION
FILE-CONTROL.
SELECT FILE1 ASSIGN TO DD1
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS FS1.
SELECT FILE2 ASSIGN TO DD2
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS FS2.
SELECT FILE3 ASSIGN TO DD3
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS FS3.
SELECT FILE4 ASSIGN TO DD4
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS FS4.
SELECT FILE5 ASSIGN TO DD5
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS FS5.
SELECT FILE6 ASSIGN TO DD6
ORGANIZATION IS SEQUENTIAL
FILE STATUS IS FS6.
DATA DIVISION.
FILE-SECTION.
FD FILE1.
01 MASTER
   02 X PIC X(80). 
FD FILE2.
01 MASTER2.
   02  X PIC X(80).
FD FILE3.
01 MASTER3.
    02  X PIC X(80).
FD FILE4.
01 MASTER4.
    02  X PIC X(80).
FD FILE5.
01 MASTER5.
    02  X PIC X(80).
FD FILE6.
01 MASTER6.
    02  X PIC X(80).
WORKING-STORAGE SECTION.
77 FS1 PIC 99 VALUE "Y".
77 FS2 PIC 99.
77 FS3 PIC 99.
PROCEDURE DIVISION.
MAINPARA.
PERFORM OPEN-PARA.
PERFORM READ-PARA UNTIL EOF NOT = 'Y'
PERFORM CLOSE-PARA.
OPEN-PARA.
OPEN INPUT FILE1.
OPEN INPU FILE2.
OPEN INPU FILE3.
OPEN INPU FILE4.
OPEN INPU FILE5.
OPEN OUTPUT FILE6.
READ-PARA.
READ FILE1 AT END MOVE "Y" TO EOF
NOT AT END
READ FILE2
IF FS2=0
READ FILE3
IF FS3=0
READ FILE4
IF FS4 = 0
READ FILE5
IF FS5 =0
MOVE MASTER1 TO MASTER6.
MOVE MASTER2 TO MASTER6.
MOVE MASTER3 TO MASTER6.
MOVE MASTER4 TO MASTER6.
MOVE MASTER5 TO MASTER6.
WRITE MASTER6
DISPLAY MASTER6.
CLOSE-PARA.
CLOSE FILE1.
CLOSE FILE2.
CLOSE FILE3.
CLOSE FILE4.
CLOSE FILE5.
CLOSE FILE6.
STOP RUN.


I THINK THIS WILL HELP YOU
FROM-
SACHIN BORASE-PUNE
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Mar 04, 2007 4:14 am    Post subject:
Reply with quote

sachin_star3 wrote:
I THINK THIS WILL HELP YOU
Good try with the "code" this time but you still have to indent.
And again you answered a question that was not asked, why?
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Sun Mar 04, 2007 4:43 am    Post subject:
Reply with quote

ok
fine
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Mar 04, 2007 6:18 am    Post subject:
Reply with quote

And didn't answer the question that was asked. . .

Also, as presented, the pseudo code will not work. . . . icon_confused.gif

The first reply on this thread asked for dcb info for the 5 files - it has not yet been posted. In fact, we seem to have lost the TS.

Shrikanth - do you have a solution or might we help.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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