Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Does C/LE open of DD:ddname(member) use SVC 99 or FIND?

198 views
Skip to first unread message

Charles Mills

unread,
Apr 30, 2012, 12:48:47 PM4/30/12
to
Does anyone *know* whether a C/C++ Language Environment fopen() of a
filename of the form DD:ddname(member) use an OPEN of ddname followed by a
BLDL or FIND for member (the way any reasonable programmer would) or does it
do a whole new DYNALLOC for dsname(member)? (Seems like a dumb question, but
FTP does it that way, so stranger things have happened.)

My *interpretation* of the allocation messages - I don't see allocate and
de-allocate messages for a SYSnnnnn that appears to be for member - leads me
to believe that C/C++ LE does it right. But I could be reading it wrong.
Does anyone *know*?

Thanks,
Charles

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to list...@bama.ua.edu with the message: INFO IBM-MAIN

Kirk Wolf

unread,
Apr 30, 2012, 2:13:10 PM4/30/12
to
Charles,

I'm nearly certain that it doesn't do a SVC99 when you are using fopen with
a DDNAME

But it does seem to do a OPEN/BLDL/POINT....STOW/CLOSE for each fopen()
/ fclose() using //DD:MYDD(MEM)

IMO, there are a couple of important missing things:

1) There isn't a way to update (or get) the PDS directory user data when
processing the member with fopen()/fclose().

2) You would really like to be able to do this:

fopen(//DD:MYDD(MEM1), ...)
freopen(//DD:MYDD(MEM2), ....)

so that the freopen() caused a STOW (if opened update) and a BLDL/POINT,
and avoided the cost of a complete OPEN/CLOSE path. I don't think that
it does that.

So, for my money, better BPAM support would be nice.

Kirk Wolf
Dovetailed Technologies
http://dovetail.com

Charles Mills

unread,
Apr 30, 2012, 4:23:38 PM4/30/12
to
Thanks!

At least too many OPEN's is better than too many DYNALLOC's *and* too many
OPEN's.

> There isn't a way to update (or get) the PDS directory user data

Not a huge deal to write your own BPAM library, but I agree. When I first
came to z/OS C/C++ about two years ago I was surprised that there were not
more z/OS-specific library routines (or z/OS-specific enhancements to the
inherited-from-UNIX library routines).

Charles

Bernd Oppolzer

unread,
Apr 30, 2012, 5:46:57 PM4/30/12
to
Don't know what it's worth, but I'm quite sure that you can read a directory
of a PDS simply by issuing fopen on it as a binary file - like this

directory = fopen ("dd:pdsfile", "rb");

that is, if you don't specify member names in parantheses, you get the
directory of the PDS.

And, yes, if you specify dd:dsname on fopen, there will be no DYNALLOC
etc. and no
SYSxxxxx ddnames, because there is already a ddname. I understand that
those "synthetic"
ddnames like SYS00001 etc. are only needed, if you specify dsnames on
fopen. Or,
another case, if you do output to stdout by printf, for example, but
SYSPRINT is already
blocked (used, opened) by PL/1 (for example).

Kind regards

Bernd

Paul Gilmartin

unread,
May 1, 2012, 2:14:17 AM5/1/12
to
On Mon, 30 Apr 2012 13:20:48 -0700, Charles Mills wrote:
>
>At least too many OPEN's is better than too many DYNALLOC's *and* too many
>OPEN's.
>
Ummm. No. A few years ago, I had an APAR created because
the z/OS UNIX (USS) command e.g.:

$ cp -P'SPACE=(5000,5000)' homelog //temp.test.space3
cp: FSUM6260 write error on file "//temp.test.space3": EDC5092I An I/O abend was trapped.
$ ls -l homelog
-rw-r--r-- 1 user group 346153 Jan 12 14:05 homelog

was failing with a Sx37, regardless of how large an extent I requested.
IBM's explanation:

o If the programmer specified SPACE, the C/LE RTL assumed a RLSE
subparameter.

(This seems precisely backward to me. If the RTL supplies a generous
default, RLSE may be appropriate. If the programmer specified SPACE
explicitly, give him what he asks for.)

o The command internally caused the data set to be opened and closed
_four_ times (!?!?!?!). After the first close, most of the space was
released. The attempt to write the actual data was bound to fail
writing to a minimal extent.

IBM's reactions were:

o Specify a secondary extent.

o FIN.

o For compatibility, we'll retain the current behavior, but provide
the programmer a NORLSE option.

The problem persists at z/OS 1.12:

D37-04,IFG0554P,user,STEP1,SYS00017,41CA,TSO026,user.TEMP.TEST.SPACE3

There seems to be no NORLSE option. If I supply a secondary
extent, I get an 8 block (1 track?) primary extent and a 4008 block
second extent.

<SIGH/> I can't respect this. Does any IBM representative dare to
comment on it?

-- gil

Paul Gilmartin

unread,
May 1, 2012, 4:52:03 PM5/1/12
to
On Mon, 30 Apr 2012 23:43:24 +0200, Bernd Oppolzer wrote:

>Don't know what it's worth, but I'm quite sure that you can read a directory
>of a PDS simply by issuing fopen on it as a binary file - like this
>
>directory = fopen ("dd:pdsfile", "rb");
>
>that is, if you don't specify member names in parantheses, you get the
>directory of the PDS.
>
Rexx, for example, doesn't work quite that way. The open fails unless
the programmer specifies DSORG(PS) at allocation.

>And, yes, if you specify dd:dsname on fopen, there will be no DYNALLOC
>etc. and no SYSxxxxx ddnames, because there is already a ddname.
>
FTP, for another example, doesn't work quite that way. Overriding
attributes at allocation will sometimes be ignored and attributes
from the DSCB used regardless.

TSO TRANSMIT, for YA example doesn't work that way. If I allocate
DATA.SET.NAME(MEMBER), which is a sequential allocation, and pass
the ddname as INDD to TRANSMIT, it is transmitted as an IEBCOPY
unloaded PDS member.

I don't know for any of these cases whether the utility uses the
argument DDNAME after tweaking the JFCB, or performs a DYNALLOC.

John Gilmore

unread,
May 1, 2012, 5:55:20 PM5/1/12
to
The point here is not what some particular routine oor utility may do
or permit. It is what can be done ab initio by an programmer who
wants to do it using the HLASM or some particular SLPL .

z/OS MVS does permit one to open a PDS as a PS data set in a routine
written in assembly language or PL/I, and what one then gets with
successive reads are its successive directory blocks.

I have done this many times without incident, but I do not of course
recommend it to novices.

I have not myself done it in C; but Bernd Oppolzer is a careful,
highly reliable reporter of his experience; and I am thus sure that it
can be done in C too.

John Gilmore, Ashland, MA 01721 - USA

Bernd Oppolzer

unread,
May 1, 2012, 9:09:52 PM5/1/12
to
Thank you!

Here is an excerpt of a C program which reads a directory of a PDS
and inserts the member names into an AVL tree (the insert is not shown,
it is done by a function call - see below).

Kind regards

Bernd



static int lese_memberliste (char *parm_infile,
baumMEMknoten **pres)

/************************************************/
/* Funktion zum Lesen einer Memberliste */
/* einer PO-Datei; die Membernamen werden */
/* in einen AVL-Baum eingetragen */
/************************************************/

{
FILE *direct;
char buf [256];
int x;
char *cp;
int laenge;
unsigned long ttrc;
int ttr;
int anz_bytes;
int eof;
int rc = 0;

char mem_high [8];

baumMEMknoten *proot = NULL;
baumMEMknoten *pneu;
int hchanged;
membname m;

eof = 0;

memset (mem_high, 0xff, 8);

/************************************************/
/* raus, wenn Directory nicht aufgeht */
/************************************************/

direct = fopen (parm_infile, "rb");
if (direct == NULL)
RETURN_VALUE 8;

for (;;)
{
/************************************************/
/* naechsten Directory-Block einlesen */
/************************************************/

memset (buf, 0x00, 256);
x = fread (buf, 1, 256, direct);
if (x == 0)
break;

#ifdef TEST

printf ("[cp2970] \n");
printf ("[cp2970] Rueckgabe von fread = %d\n", x);
printf ("[cp2970] \n");

dump (buf, buf + x - 1, stdout);

#endif

cp = buf + 2;
laenge = *((short *) buf) - 2;

while (laenge > 0)
{
/************************************************/
/* naehere Info hierzu in den IBM-Brosch. */
/* zum Aufbau der PO-Directories. */
/************************************************/

if (memcmp (cp, mem_high, 8) == 0)
{
eof = 1;
break;
}

/************************************************/
/* Laenge des Eintrags in Halbworten steht */
/* in den Bits 3 bis 7 des TTRC-Wortes */
/************************************************/

ttrc = *((unsigned long *) (cp + 8));
ttr = ttrc >> 8;
anz_bytes = (ttrc & 0x1f) * 2;

#ifdef TEST

printf ("[cp2970] Member %-8.8s TTR %06X Laenge/Bytes %d\n",
cp, ttr, anz_bytes);

#endif

if (memcmp (cp, "ED", 2) == 0)
{
memcpy (m.name, cp, 8);

hchanged = 0;
pneu = baumMEMsuche (&m, &proot, &hchanged, 1);
pneu -> obj = atoi (cp + 2);
}

cp += (anz_bytes + 12);
laenge -= (anz_bytes + 12);
}

if (eof)
break;
}

fclose (direct);

*pres = proot;

RETURN_VALUE rc;

Charles Mills

unread,
May 1, 2012, 9:59:34 PM5/1/12
to
Thanks!

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-...@bama.ua.edu] On Behalf
Of Bernd Oppolzer
Sent: Tuesday, May 01, 2012 6:09 PM
To: IBM-...@bama.ua.edu
Subject: Re: Does C/LE open of DD:ddname(member) use SVC 99 or FIND?

David Crayford

unread,
May 1, 2012, 11:21:57 PM5/1/12
to
The book also has examples and you will find full samples in the
SCBCSAMP data set.

http://publib.boulder.ibm.com/infocenter/zvm/v5r4/index.jsp?topic=/com.ibm.zos.r9.cbcpx01/cbcpg18096.htm
> anz_bytes = (ttrc& 0x1f) * 2;
>
> #ifdef TEST
>
> printf ("[cp2970] Member %-8.8s TTR %06X Laenge/Bytes %d\n",
> cp, ttr, anz_bytes);
>
> #endif
>
> if (memcmp (cp, "ED", 2) == 0)
> {
> memcpy (m.name, cp, 8);
>
> hchanged = 0;
> pneu = baumMEMsuche (&m,&proot,&hchanged, 1);

Charles Mills

unread,
May 2, 2012, 1:10:17 PM5/2/12
to
Full samples of deblocking BPAM directory blocks with code? Which program?

I don't see any examples in the P/G you linked to either. What am I missing?

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-...@bama.ua.edu] On Behalf
Of David Crayford
Sent: Tuesday, May 01, 2012 8:20 PM
To: IBM-...@bama.ua.edu
Subject: Re: Does C/LE open of DD:ddname(member) use SVC 99 or FIND?

The book also has examples and you will find full samples in the SCBCSAMP
data set.

http://publib.boulder.ibm.com/infocenter/zvm/v5r4/index.jsp?topic=/com.ibm.z
os.r9.cbcpx01/cbcpg18096.htm

On 2/05/2012 9:58 AM, Charles Mills wrote:
> Thanks!
>
> Charles
>
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:IBM-...@bama.ua.edu] On
> Behalf Of Bernd Oppolzer
> Sent: Tuesday, May 01, 2012 6:09 PM
> To: IBM-...@bama.ua.edu
> Subject: Re: Does C/LE open of DD:ddname(member) use SVC 99 or FIND?
>
> Thank you!
>
> Here is an excerpt of a C program which reads a directory of a PDS and
> inserts the member names into an AVL tree (the insert is not shown, it
> is done by a function call - see below).

David Crayford

unread,
May 2, 2012, 10:37:50 PM5/2/12
to
My link was bad! Seems I didn't quite understand how to copy a link in
Infocenter!

http://publib.boulder.ibm.com/infocenter/zvm/v5r4/topic/com.ibm.zos.r9.cbcpx01/cbcpg180781.htm#wq1935

Charles Mills

unread,
May 3, 2012, 12:17:58 AM5/3/12
to
Aha! Muchas gracias!

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-...@bama.ua.edu] On Behalf
Of David Crayford
Sent: Wednesday, May 02, 2012 7:37 PM
To: IBM-...@bama.ua.edu
Subject: Re: Does C/LE open of DD:ddname(member) use SVC 99 or FIND?

My link was bad! Seems I didn't quite understand how to copy a link in
Infocenter!

http://publib.boulder.ibm.com/infocenter/zvm/v5r4/topic/com.ibm.zos.r9.cbcpx
01/cbcpg180781.htm#wq1935

On 3/05/2012 1:09 AM, Charles Mills wrote:
> Full samples of deblocking BPAM directory blocks with code? Which program?
>
> I don't see any examples in the P/G you linked to either. What am I
missing?

0 new messages