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
 

 

How to ALLOC a GDG DS for WRITE access within COBOL

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

New User


Joined: 05 Oct 2006
Posts: 4
Location: Europe- Cologne

PostPosted: Mon Jan 14, 2008 7:33 pm    Post subject: How to ALLOC a GDG DS for WRITE access within COBOL
Reply with quote

Hi all!

I am trying to allocate an GDG dataset within a COBOL stored procedure, without using JCL. The GDG base is already defined.
The new allocated dataset is supposed to be used for WRITE access in the same stored procedure.
Does anyone have experience with stored procs which use BPXWDYN, or any similar pgm?

A sample of a valid stored proc, which defines and uses a new GDG dataset woul be very much appreciated.

I tried without success to use the samples I found in the forum, as they are refferring to existing datasets.


Thanks,
Klaus
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Jan 14, 2008 8:15 pm    Post subject:
Reply with quote

If you run under TSO, you can use the ALLOCATE command from within COBOL.

O.
Back to top
View user's profile Send private message
Klaus

New User


Joined: 05 Oct 2006
Posts: 4
Location: Europe- Cologne

PostPosted: Mon Jan 14, 2008 8:22 pm    Post subject:
Reply with quote

Sorry, I forgot to mention, that I need to allocate the file dynamically. I do not know whether in this cas I can use the ALLOCATE command.

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

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Jan 14, 2008 8:26 pm    Post subject:
Reply with quote

Why not?

O.
Back to top
View user's profile Send private message
Klaus

New User


Joined: 05 Oct 2006
Posts: 4
Location: Europe- Cologne

PostPosted: Tue Jan 15, 2008 6:17 pm    Post subject:
Reply with quote

Sory, but I am not aware of any ALLOCATE command within COBOL.

Klaus
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Jan 15, 2008 6:20 pm    Post subject: Reply to: How to ALLOC a GDG DS for WRITE access within COBO
Reply with quote

Quote:
COBOL stored procedure


would You be so kind to explain what You mean by the quoted sentence ??
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Tue Jan 15, 2008 10:07 pm    Post subject:
Reply with quote

enrico -

He probably means DB2 stored procedure.

O.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue Jan 15, 2008 11:33 pm    Post subject:
Reply with quote

I found on this forum how to call a rexx or clist from cobol to dynamically allocate datasets.
First CALL IKJTSOEV to setup the TSO environment then CALL IKJEFTSR to run your REXX or clist. Search this forum to get the details and code.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Jan 16, 2008 12:22 am    Post subject:
Reply with quote

Douglas - Using these services, one can issue the ALLOCATE command (or any TSO comand) directly from within COBOL.

O.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Wed Jan 16, 2008 12:44 am    Post subject:
Reply with quote

Yes, It is true you can execute an ALLOCATE or any other TSO command from COBOL this way. In my case it simplified the COBOL program to execute a REXX that could execute multiple TSO commands and choose subparameter values instead of coding them each into the COBOL program.
Back to top
View user's profile Send private message
Klaus

New User


Joined: 05 Oct 2006
Posts: 4
Location: Europe- Cologne

PostPosted: Fri Jan 18, 2008 5:16 pm    Post subject:
Reply with quote

Hello everyone,

thank you for your hints, I'l try to use ALLOCATE.

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

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Jan 18, 2008 7:41 pm    Post subject:
Reply with quote

Hi Klause,

I've not used ALLOC for creating GDGs, but it looks like you must provide the full DSN (w/the G/V extension).

That could be a problem unless you use LISTCAT, but even there it's possible someone can create a new generation in the time between the LISTCAT and the ALLOC.
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 Write R1 and R2 to OP1 and R1 to OP2 bhaskar_kanteti DFSORT/ICETOOL 10 Fri Mar 03, 2017 11:18 am
No new posts Can you write 2 recs on SORTOUT when ... Sysaron DFSORT/ICETOOL 6 Thu Feb 23, 2017 12:07 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm


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