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

Dynamic allocataion of file in COBOL


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

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Tue Feb 09, 2010 4:12 pm
Reply with quote

I am trying to create a file dynamically from a COBOL program.

But the file is not getting allocated.

Could some one help me on this.

Code:

FILE-CONTROL.
 
   SELECT TEST-FILE ASSIGN TO DD1.



Code:

DATA DIVISION.
FILE SECTION.

FD  TEST-FILE
     LABEL RECORDS ARE STANDARD
     BLOCK CONTAINS 0 RECORDS.
01  TEST-REC           PIC X(80).

WORKING-STORAGE SECTION.

01 WS-DYNAMIC-OPEN-AREA.
   05 FILE-NAME.
       10 FILLER PIC X(35)  VALUE
          'DD1=DSN(TEST.PS.TESTFILE.OUT01) SHR'.
   05 FILE-PTR POINTER.
   05 RC PIC S9(9) BINARY VALUE ZERO.



Code:

PROCEDURE DIVISION.

SET FILE-PTR TO ADDRESS OF FILE-NAME
         CALL 'PUTENV' USING BY VALUE FILE-PTR RETURNING RC
IF RC NOT = 0
   DISPLAY 'FILE PROBLEM'
END-IF
STOP RUN.


Please let me know if you need further details.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Feb 09, 2010 4:19 pm
Reply with quote

Search this forum -- there have been several discussions of COBOL dynamic allocation of files in the last year, including complete examples of code to do dynamic allocation.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Feb 09, 2010 4:36 pm
Reply with quote

I always felt comfortable with BPXWDYN over PUTENV.

Though you will get examples of both if you search forum
Back to top
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Tue Feb 09, 2010 5:33 pm
Reply with quote

An article by ED WATSON on 'Dynamic File Allocation With COBOL' helped me to resolve the problem.

Thanks.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Tue Feb 09, 2010 5:50 pm
Reply with quote

Mathiv Anan wrote:
An article by ED WATSON on 'Dynamic File Allocation With COBOL' helped me to resolve the problem
And a pointer to that article is that hard to provide?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Feb 09, 2010 5:53 pm
Reply with quote

William Thompson wrote:
Mathiv Anan wrote:
An article by ED WATSON on 'Dynamic File Allocation With COBOL' helped me to resolve the problem
And a pointer to that article is that hard to provide?


It probably is.
So to make new friends i will do that :

www.schlabb.de/resources/04009.pdf
Back to top
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Tue Feb 09, 2010 6:53 pm
Reply with quote

oh no.. I am sorry.

Thanks Peter ;)
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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 Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top