Dynamic Allocation question for C or assembler experts. 
Author Message
 Dynamic Allocation question for C or assembler experts.

I'm having trouble allocating multiple files dynamically using C/370 on an MVS
system. I posting to the assembler group since an assembler guru might also
come up with an answer.

I'm trying to dynamically allocate 2 existing datasets. For each file I
call dyninit to initialize the __dyn_t structure, I specify the following in
the structure members:

__dsname        = (the dataset name to be allocated)
__ddname        = "????????";
__status        = __DISP_OLD;
__normdisp      = __DISP_KEEP;
__conddisp      = __DISP_KEEP;
__misc_flags    = __CLOSE;

For you assembly people this is a dsname allocation. The variables I've
specified are equivalent to the text unit keys DALDSNAME, DALDDNAM, DALSTATS,
DALNDISP, DALCDISP & DALCLOSE respectively.

After populating the structure I call dynalloc. The system assigns a
DD name to the file & returns the address in the __ddname structure member
(it's something like SYS00119). This is fine for the 1st allocation, works
great, I can open and read the file using the ddname with no problem.

But when dynamically allocating the 2nd file, the dynalloc function returns an
error code of X'410 (decimal 1040). This is the manual's interpretation:

Meaning:  Specified ddname unavailable. (dsname allocation, ddname allocation)
Application Programmer Action:  Change ddname.
Corresponding Message: IKJ56246I

An inspection of __ddname reveals that the the system assigned DD name is the
same as the 1st one assigned. It seems MVS won't assign a new DD name.

Note - I am attempting to allocate both files prior to opening either.

Any ideas?

--

"Man will always find a difficult means to perform a simple task"
                                                   - Rube Goldberg



Mon, 13 Sep 1999 03:00:00 GMT  
 Dynamic Allocation question for C or assembler experts.

Quote:

> After populating the structure I call dynalloc. The system assigns a
> DD name to the file & returns the address in the __ddname structure member
> (it's something like SYS00119). This is fine for the 1st allocation, works
> great, I can open and read the file using the ddname with no problem.

> An inspection of __ddname reveals that the the system assigned DD name is the
> same as the 1st one assigned. It seems MVS won't assign a new DD name.

I believe that the key you are using is for specifying a particular
DDname in an allocation, and that will fail if the DDname is already in
use.  There is another key that tells dynamic allocation to generate an
unused ddname and return it in the key text.  I'd guess that your
interface to dynamic allocation looks at the input DDname; if it's
???????? it uses the "return ddname to me" key and replaces the value
passed to it, and otherwise uses the DDname passed to it.  The first
time you call it, everything works fine, but the second time you forget
to reset the DDname passed to it with ???????? and your dynamic
allocation interface tries to allocate the DDname you just allocated and
of course fails.


Mon, 13 Sep 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. to CS: or not to CS: in F-PC assembler

2. Memory allocation (was: Re: Herman wants dynamic allocation)

3. Stack based allocation vs. Dynamic allocation

4. Changing static allocation to dynamic allocation.

5. Question: F77 - Dynamic Memory Allocation??

6. Dynamic Memory Allocation in FORTRAN, Question

7. OS X/Darwin dynamic loading expert question

8. CP97 Dynamic CS Workshop Programme

9. Dynamic Allocation

10. ?? Tape Unit Reserved for dynamic allocation - HELP!!

11. TeX, Pascal/VS, dynamic memory allocation, and so forth

12. Forth dynamic memory allocation - wanted

 

 
Powered by phpBB® Forum Software