IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

copying the five files into one file.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 3156
Location: Tucson AZ

PostPosted: Sat Mar 03, 2007 3:09 am
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

Moderator Emeritus


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

PostPosted: Sat Mar 03, 2007 3:30 am
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
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: 3156
Location: Tucson AZ

PostPosted: Sun Mar 04, 2007 4:14 am
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
Reply with quote

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

Moderator Emeritus


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

PostPosted: Sun Mar 04, 2007 6:18 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top