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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Is it possible to write to 2 output file in a single program
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    Post subject: Post subject: output file in cobol
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    Post subject:
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    Post subject: Re: Is it possible to write to 2 output file in a single pro
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    Post subject:
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    Post subject: Re: Is it possible to write to 2 output file in a single pro
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    Post subject:
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    Post subject: Re: Is it possible to write to 2 output file in a single pro
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    Post subject: Re: Is it possible to write to 2 output file in a single pro
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    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 Match two files using multiple keys a... santoshks1987 SYNCSORT 10 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm


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