Re: Class Notes for a PL/I Course.

"Bernd Oppolzer berndoppolzer-/[email protected] [H390-MVS]" <[email protected]> Sat, 5 Oct 2019 18:31:59 +0200
Newsgroups gmane.comp.emulators.hercules390.mvs
Message-ID <[email protected]>
Hi Peppe,

when I recall your PL/1 coding right, you are not storing RDWs in your 
FB80 file,
but instead you are storing the net record length returned by the PL/1 
runtime system
(the varchar length). This is IMO always RDW minus 4.

On the other side (when writing), you use this length again to write VS 
records;
PL/1 translates the length to RDWs etc. (that is, it adds 4 again).

I guess, RDWs are always positive, so the value returned by PL/1 will 
always be
in the range 0 to 32763 (0x7fff minus 4), maybe the upper bound is even 
lower
.... BTW: you should take special care for the zero case (don't do the 
PUT EDIT
and GET EDIT for the buffer in this case, but - on output -
write the zero length VS record).

But: because real lengths will always be between between 0 and 32763,
it is IMO safe for you to store a "fake length" of minus one (0xffff) as 
an EOF mark.

Kind regards

Bernd



Am 05.10.2019 um 11:46 schrieb Giuseppe Vitillaro giuseppe-yuD/ahkh7LvrZ44/[email protected] 
[H390-MVS]:
>
>
> Paul, I do not have access to RDW in PL/I.
>
> What I've is:
>
> READ FILE(VBDS) INTO(BUF);
> L = LENGTH(BUF);
>
> and if L may be zero, I can't use 0x0000
> as a logical EOF when packing into an
> FB[80] dataset the record.
>
> When I read back the VS records from the FB
> dataset what I can do is (remember SP is
> actually reading record length back in L):
>
> GET FILE(FBDS) EDIT ( SP ) ( A(2) );
> GET FILE(FBDS) EDIT ( BUF ) ( A(L) );
>
> and, again. if L can be zero, I'm in trouble.
>
> Now, the question is, may L be zero in PL/I
> when reading a variable record length dataset
> under MVS?
>
> If I got it correctly, L can't be greater than 32760,
> so 32767 can be a correct a choice?
>
> Peppe.
>