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

PL/I, VB Datasets and the RDW


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mxgdontmics

New User


Joined: 15 Jun 2020
Posts: 27
Location: usa

PostPosted: Sat Aug 06, 2022 10:11 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Sun Aug 07, 2022 12:33 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2140
Location: USA

PostPosted: Sun Aug 07, 2022 1:36 am
Reply with quote

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
View user's profile Send private message
mxgdontmics

New User


Joined: 15 Jun 2020
Posts: 27
Location: usa

PostPosted: Sun Aug 07, 2022 10:05 am
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1314
Location: Vilnius, Lithuania

PostPosted: Sun Aug 07, 2022 11:53 am
Reply with quote

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
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts JES datasets IO Error ABENDS & Debugging 3
No new posts Concatenate 2 input datasets and give... JCL & VSAM 2
No new posts Merging 2 datasets into one DFSORT/ICETOOL 1
No new posts how to get list of all VSAM/non-VSAM ... JCL & VSAM 13
No new posts define 1 DCB parms for multiple outpu... JCL & VSAM 9
Search our Forums:

Back to Top