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

How to ALLOC a GDG DS for WRITE access within COBOL


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

PostPosted: Mon Jan 14, 2008 8:15 pm
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
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: 2358
Location: Israel

PostPosted: Mon Jan 14, 2008 8:26 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Jan 15, 2008 6:20 pm
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: 2358
Location: Israel

PostPosted: Tue Jan 15, 2008 10:07 pm
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
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: 2358
Location: Israel

PostPosted: Wed Jan 16, 2008 12:22 am
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top