|
View previous topic :: View next topic
|
| Author |
Message |
mxgdontmics
New User
Joined: 15 Jun 2020 Posts: 27 Location: usa
|
|
|
|
A customer needs the field layout for a VB log file. The best I could do was a PL/I layout for a downstream, filtered, column-shifted and VTOF'd version of the same file. I'm not a PL/I programmer but it was easy enough to decipher and reverse engineer the DCL to align with the VB raw file.
However, since the raw file is RECFM=VB, do I need to include a definition for the RDW for the input DCL? The programming guide seems to have hidden the answer somewhere I could not find.
I've seen other PL/I programs account for the RDW in output DCLs using FIXED BIN(15), which looks too short for a 4 byte RDW. I'm confused.
How does PL/I deal with the RDW for input and output? |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2275 Location: USA
|
|
|
|
RDW consists of two parts:
| Code: |
DCL 1 REC_VB,
2 RDW,
5 REC_LEN BIN FIXED(15),
5 FLAGS BIT(15),
2 REC_BODY,
… everything else …
; |
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2275 Location: USA
|
|
|
|
Correction:
RDW consists of two parts:
| Code: |
DCL 1 REC_VB,
2 RDW,
5 REC_LEN BIN FIXED(15),
5 FLAGS BIT(16),
2 REC_BODY,
… everything else …
; |
|
|
| Back to top |
|
 |
mxgdontmics
New User
Joined: 15 Jun 2020 Posts: 27 Location: usa
|
|
|
|
| sergeyken wrote: |
Correction:
RDW consists of two parts:
| Code: |
DCL 1 REC_VB,
2 RDW,
5 REC_LEN BIN FIXED(15),
5 FLAGS BIT(16),
2 REC_BODY,
… everything else …
; |
|
The question is when is it necessary to define them? The following example suggests it's not needed.
teampli.net/mirrors/robinv/pli-n4.htm
The DCL in PL/S defines the RDW. But the DCL in the PL/I version does not because it's handled automatically by populating SMF0LEN and SMF0SEG. However, he doesn't elaborate on how that happens or how the SMF-specific variable names get defined.
Meanwhile, where I've seen it accounted for at my shop, only 2 bytes are defined, presumably the least significant half-word which is zero for unspanned records. Where did the other 2 bytes go? |
|
| Back to top |
|
 |
prino
Senior Member

Joined: 07 Feb 2009 Posts: 1323 Location: Vilnius, Lithuania
|
|
|
|
Some dcl's in a program that deal with VB records:
| Code: |
dcl liftin file record input env(vb recsize(1028) total);
1 /*--------------------------------------------------------------+
| Initialised pointers |
| |
| - total_ptr Address of trip_total record |
| - liftrec_ptr Input record |
| - line_ptr Print line |
| - static_ptr Address of static storage |
+--------------------------------------------------------------*/
2 filler char (16) init ('INIT POINTERS '),
2 total_ptr ptr init (addr(trip_total)),
2 liftrec_ptr ptr init (addr(liftrec)),
2 line_ptr ptr init (addr(line)),
2 static_ptr ptr init (addr(lift_static)),
1/**********************************************************************
* Input record *
**********************************************************************/
dcl sliftrec char (1024) var based(liftrec_ptr);
dcl 1 liftrec,
2 filler char (2),
2 trip pic 'zz9',
2 filler char (3),
2 ride pic 'zz9',
read file(liftin) into(sliftrec); |
The first filler in liftrec (which I could also have declared as "fixed bin (15)" contains the length of the VB record. The flag bytes are never returned to PL/I for VB files, but, never tried this, you might be able to read them by declaring the file as "env(u..."
And yes there are two visible "filler" fields in liftrec, I've got a macro that translates them to either "*" (for Enterprise PL/I), or "znnnnn" (for OS PL/I):
| Code: |
%dcl filler entry;
%filler: proc returns(char);
dcl str char;
dcl compiletime builtin;
dcl counter builtin;
if substr(compiletime, 3, 1) = ' ' then
str = 'Z' || counter;
else
if sysparm = 'TEST' then
str = 'z' || counter;
else
str = '* ';
return(str);
%end filler; |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|