PDRLNADD

PDRLNADD adds record length bytes to the beginning of each record of a print stream. Use PDRLNADD prior to downloading a print stream from the host for use with Visual Engineer or EngageOne™ Enrichment. Metacode and mixed-mode AFP print streams are generally the only print stream types that require record length bytes to identify records.

Note: Refer to Visual Engineer or the <RECORD> tag discussion in the EngageOne™ Enrichment Language Reference Guide for information on the methods EngageOne™ Enrichment can use to identify records.

Syntax

PDRLNADD 'indsn outdsn length format incl startrec num'

Parameter Description Default
indsn The name of the input print stream.
outdsn The name of the output print stream.
length The length of the length indicator, as follows:
  • 2 — The first two bytes of each record comprise the length indicator.
  • 4 — The first four bytes of each record comprise the length indicator.
2
format The byte order in the length indicator, as follows:
  • M — Mainframe. The length indicator for each record is coded with the most significant byte first. This is commonly called Big Endian.
  • P — PC. The length indicator for each record is coded with the least significant byte first. This is commonly called Little Endian.
P
incl Specifies whether the length indicator includes its own length and the length of the record, as follows:
  • I — Inclusive. The record length specified in the indicator for each record includes the length value.
  • E — Exclusive. The record length specified in the indicator for each record does not include the length value.
E
startrec Specifies the number of the first record to copy from the input to the output. 1
num Specifies the number of lines to copy from the input to the output. 10

Example

PDRLNADD 'D96.INPUT(SAMPLE) D96.OUTPUT(SAMPLE) 2 M I'

In this example, PDRLNADD is to add a two-byte inclusive record length indicator to each record in D96.INPUT(SAMPLE). The record length indicators will be with the coded most significant byte first.

JCL

The following shows the JCL shipped with the PDRLNADD utility.

//*jobcard
//*********************************************************************
//**Customize:  1. Change STEPLIB to point to the datasets where   ***
//**               the following are installed at your site.        ***
//**                - Enrichment load module                       ***
//**                - C runtime library                             ***
//**            2. Change SYSUT1 and SYSUT2 DDs to be the datasets  ***
//**               for input and output respectively.               ***
//*********************************************************************
//** PDRLNADD ** Add record length indicators to metacode           ***
//*********************************************************************
//** PDRLNADD Parameters:                                           ***
//**************  Parm1: Input file name/DD (or * to keep IN)       ***
//**************  Parm2: Output file name/DD (or * to keep OUT)     ***
//**************  Parm3: Options (delimited by a space):            ***
//**************         len can be 2 or 4 to designate the length
//**************             of the length indicator. Default: 2
//**************         typ can be P for PC or M for mainframe.
//**************             Default: P
//**************         inc can be I (include) or E (exclude).
//**************             Default: E
//**************         start is the starting line. Default: 1
//**************         numl is the number of records. Default: 1000000
//**************      Example:  PARM='DD:IN DD:OUT'
//**************                PARM='DD:IN DD:OUT 2 M I 1 2000'
//**********************************************************************
//PDRLNADD EXEC PGM=PDRLNADD,PARM='DD:IN DD:OUT'
//STEPLIB  DD DSN=PDR.STREAMW.LOAD,DISP=SHR
//         DD DSN=SYS3.CLIB22.SCEERUN,DISP=SHR
//SYSPRINT DD SYSOUT=*
//IN       DD DSN=inputdsn,DISP=SHR
//OUT      DD DSN=outputdsn,DISP=SHR
//*

REXX Code

The following shows the REXX Code shipped with the PDRLNADD utility.

/* REXX ** Add length indicators to Metacode  ***********************/
/* Changes: -Created 03Jan96 DRBallard                              */
/* Customization: Change the loadmod variable to be the dataset     */
/*                where Enrichment is installed.                  */
/********************************************************************/
loadmod = "'PDR.STREAMW.LOAD(PDRLNADD)'"
address TSO
arg in out len sb incl start numlines .
parse source . . execname .;  version = '1.0'
if in = '' | out = '' then do
   Call EXPLAIN
   say 'Enter parameters in the order explained.'
   say 'Do not use quotes around dataset names.'
   pull in out len sb incl start numlines .
   if in = '' | out = '' then
      call ERROR 8, 'Required parameters indsn and outdsn are missing.'
End
In = "'"||in||"'"
Out = "'"||out||"'"

/* Allocate input and output files                                   */
   if sysdsn(in) <> 'OK'  then
      call ERROR 8, 'Input file' in 'not found:' sysdsn(in)
   say 'Allocating data sets.....'
   dummy = outtrap('tso_out.','*')
   'FREE DDNAME(IN)'
   'FREE DDNAME(OUT)'
   dummy = outtrap('OFF')
   'ALLOCATE DDNAME(IN) DSN('in') SHR'
   if rc <> 0 then
      call ERROR 9, 'Unable to allocate Input file' in
if sysdsn(out) = 'OK' then do
      say out 'already exists.  Do you want to replace it? (Y or N)'
      pull ans
      if left(ans,1) <> 'Y' then call ERROR 4, 'User requested exit'
      'ALLOCATE DDNAME(OUT) DSN('out') SHR'
   end
   else do
     if pos('(',out)>0 then
        'ALLOCATE DDNAME(OUT) DSN('out') SHR'
     else
        'ALLOCATE FILE(OUT) DSN('out') NEW SPACE(30,12) TRACKS ',
           'LRECL(155) BLKSIZE(27998) RECFM(V,B,M)'
   end
   if rc <> 0 then
      call ERROR 10, 'Unable to allocate Output file' out
   "CALL "loadmod" ''"in"' '"out"' "len sb incl start numlines"'"
   dummy = outtrap('tso_out.','*')
   'FREE DDNAME(IN)'
   'FREE DDNAME(OUT)'
   dummy = outtrap('OFF')
exit
/*********************************************************************/
/*********************************************************************/
/* ERROR - Error exit with message                                   */
/*********************************************************************/
ERROR:   if arg(2) <> '' then say arg(2)
   if arg(3) <> '' then say arg(3)
   exit arg(1)
/*********************************************************************/
/* EXPLAIN - Self documenting routine                                */
/*********************************************************************/
EXPLAIN:
   say '(c)Precisely'
   say '    'execname' Version' version ' All rights reserved.'
   Say
   say 'Function: Add length indicators to Metacode. '
   say
   say 'Syntax:   %'execname' indsn outdsn len type incl start numl'
   say '          where: indsn is the input dataset (required).'
   say '                     Do not include quotes.'
   say '                 outdsn is the output dataset (required).'
   say '                     Do not include quotes.'
   say '                 len can be 2 or 4 to designate the length'
   say '                     of the length indicator. Default: 2'
   say '                 type can be P for PC or M for mainframe.'
   say '                      Default: P'
   say '                  incl can be I (include) or E (exclude). Default:E'
   say '                  start is the starting line. Default: 1'
   say '                  numl is the number of records. Default: 1000000'
   return