PDRLNSUB

PDRLNSUB removes record length bytes from the beginning of each record of a print stream. Use PDRLNSUB if you are uploading a print stream that contains these record length bytes to the host. Generally, Metacode and mixed-mode AFP print streams contain these bytes.

Syntax

PDRLNSUB 'indsn outdsn length format incl'

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

Example

PDRLNSUB 'TEST.META TEST.OUT 2 M I'

In this example, each record in the input (TEST.META) contains a two-byte length indicator. The length indicators include their own length and are coded with the most significant byte first. PDRLNSUB is to remove length indicators from the input records and store the result in TEST.OUT.

JCL

The following shows the JCL shipped with the PDRLNSUB 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 UT1 and UT2 DDs to be the datasets        ***
//**               for input and output respectively.               ***
//*********************************************************************
//** PDRLNSUB ** Remove prefixes and unblock records                ***
//*********************************************************************
//** PDRLNSUB Parameters:                                           ***
//**************  Parm1: Input file name/DD (or * to keep UT1)      ***
//**************  Parm2: Output file name/DD (or * to keep UT2)     ***
//**************  Parm3: Options:                                   ***
//**************    /H = help information                           ***
//**************      Example:  PARM='DD:IN DD:OUT /E=L/P=2'        ***
//*********************************************************************
//PDRLNSUB EXEC PGM=PDRLNSUB,
//    PARM=('/E=L /P=2 /F=1 /H DD:UT1 DD:UT2')
//STEPLIB  DD DSN=PDRC.R31.STREAMW.LOADCRUN,DISP=SHR
//         DD DSN=SYS3.CLIB22.SEDCBASE,DISP=SHR
//         DD DSN=SYS3.CLIB22.SEDCLINK,DISP=SHR
//SYSPRINT DD SYSOUT=*
//UT1   DD DSN=your.input,DISP=SHR
//UT2   DD DSN=your.output,DISP=SHR
//*

REXX Code

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

/* REXX ** Remove prefixes and unblock records. *********************/
/* Changes: -Created 24Apr97 DRBallard                              */
/*          -10Jun97 fix quote problem on the CALL loadmod          */
/* Customization: Change the loadmod variable to be the dataset     */
/*                where Enrichment is installed.                  */
/********************************************************************/
loadmod = "'PDR.STREAMW.LOAD(PDRLNSUB)'"
address TSO
arg in out switches
parse source . . execname .;  version = '1.1'
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 switches   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" '"switches" '"in"' '"out"' '"
/* "CALL "loadmod "'" switches in out "'"*/
   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: Remove prefixes and unblock records.'
   say
   say 'Syntax:   %'execname' indsn outdsn switches'
   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 '                 switches are 1 or more parameters from:  '
   say '                     /c /e /f /h /i /n /o /p '
   say '                 /c=EBCDIC|ASCII,   /e=Big|Little|Numeric'
   say '                 /f=1|M|S           /h (help) '
   say '                 /i                 /n '
   say '                 /o=1|2             /p=2|4'
   return