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

Is it possible to write to 2 output file in a single program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
trgk03

New User


Joined: 20 Jan 2006
Posts: 12
Location: kochi

PostPosted: Wed Feb 22, 2006 11:21 am
Reply with quote

HI ALL

In a single cobol program is it possible to write to 2 or more output file if yes how do i tell cobol in which file to write.
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Wed Feb 22, 2006 1:12 pm
Reply with quote

declare
multiple select statements
multiple fd sections, under fd each one has one record.

when ever you write a perticular record it writes to perticular file.
Back to top
View user's profile Send private message
Pollyannaish

New User


Joined: 09 Jul 2005
Posts: 31
Location: Pune, India

PostPosted: Thu Feb 23, 2006 9:53 am
Reply with quote

Hi
I think raghunathns is right. You can write the records to as many files as you want.
Move the record to their corresponding RL's and write it as and when required.

Let me know if more information is needed.
Back to top
View user's profile Send private message
cevelavl

New User


Joined: 20 Feb 2006
Posts: 4

PostPosted: Thu Feb 23, 2006 3:11 pm
Reply with quote

hi,
perhaps this expample will be useful for you:
Code:

      file-control.
          select File-1 assign .. etc.
          select File-2 assign .. etc.

      file section.
      fd  File-1.
      1   Rec-1 pic x(80).
      fd  File-2.
      1   Rec-2 pic x(80).
      ..

      procedure division.
           open output File-1 File-2.   
           ..
     * writing of records
           move "something .. " to Rec-1 Rec-2.
           write Rec-1.
           write Rec-2.
           ..
           close File-1 File-2.

Back to top
View user's profile Send private message
sonu_winks

New User


Joined: 23 Nov 2005
Posts: 23

PostPosted: Thu Feb 23, 2006 4:05 pm
Reply with quote

u can write 3273 out put file since the maximum no of DD stmt has this restriction.hope my understanding is rite
Back to top
View user's profile Send private message
tksvv

New User


Joined: 17 Mar 2006
Posts: 6

PostPosted: Fri Mar 24, 2006 8:03 pm
Reply with quote

The Select Clause can occur 65535 times in a cobol program. Theoritically the answer to your question is that you can have 65535 files in a cobol program.

There might be other limits as the JCL limits which I am not sure about.
Back to top
View user's profile Send private message
shivani_tech
Warnings : 2

New User


Joined: 08 Jan 2006
Posts: 22
Location: UNITED KINGDOM

PostPosted: Fri Mar 24, 2006 8:29 pm
Reply with quote

ya sonu is right
coz limitation in jcl must be considered so as to submit the job
thanks
shivani
Back to top
View user's profile Send private message
gowtham_1982
Warnings : 1

Active User


Joined: 02 Dec 2005
Posts: 109

PostPosted: Sat Mar 25, 2006 2:04 pm
Reply with quote

tksvv wrote:
The Select Clause can occur 65535 times in a cobol program. Theoritically the answer to your question is that you can have 65535 files in a cobol program.

There might be other limits as the JCL limits which I am not sure about.


hi can you please clarify us how do you say we can have 65535 select clause in a program. for a particular pgm executed through an EXEC statement, we can have 3273 DD statements. this means we can have only 3273 files.

please clarify me.

kind regards,

gowtham
Back to top
View user's profile Send private message
tksvv

New User


Joined: 17 Mar 2006
Posts: 6

PostPosted: Sat Mar 25, 2006 2:09 pm
Reply with quote

Pls check the compiler Limits for COBOL. It will show that the number of Select clauses is 65535. So you can have that many files in a COBOL. (I checked in Quick reference which is a product of IBM).

I had already mentioned that I am not sure of JCL limits or any other limits which might make the above limit unrealistic.

Are all cobol programs executed thru JCL? What about Online programs.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top