z/OS DFSORT: Getting Started
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Converting FB to VB

z/OS DFSORT: Getting Started
SC23-6880-00

You can convert an FB data set to a VB data set with OUTFIL's FTOV parameter. Each VB output record has a 4-byte RDW followed by the corresponding data from the FB input record, and the length in the RDW is the length of the FB record plus 4.

The following JCL and DFSORT control statements convert the bookstore data set records from FB to VB.
//FBVB   JOB   A92,PROGRAMMER
//S1     EXEC  PGM=SORT
//SYSOUT DD    SYSOUT=*
//SORTIN DD    DSN=A123456.SORT.SAMPIN,DISP=SHR
//VBOUT  DD    DSN=A123456.SORT.VSAMP,DISP=(NEW,CATLG,DELETE),
//  UNIT=3390,SPACE=(CYL,(5,5))
//SYSIN  DD    *
  OPTION COPY
  OUTFIL FNAMES=VBOUT,FTOV
/*

Because the LRECL of SORT.SAMPIN is 173 bytes, each VB record in SORT.VSAMP is 177 bytes (the FB record length of 173 plus 4 for the RDW) and SORT.VSAMP is given an LRECL of 177.

You can also use PARSE, BUILD, OUTREC, OVERLAY, FINDREP, or IFTHEN parameters with FTOV on the OUTFIL statement. All of the reformatting features are available (input fields, strings, editing, and so on). With FTOV, you specify the input positions, and output columns as you would for an FB record (without the RDW). DFSORT adds the RDW after the FB record is reformatted.

Here is an example of using FTOV with BUILD:
  OUTFIL FTOV,BUILD=(1:120,25,32:C'in ',110,5)
The VB output records look like this:
Positions 1-2:      Length (in RDW) =  hex 002B  =  43
Positions 3-4:      Zeros (in RDW)  =  hex 0000  =   0
Positions 5-29:     Input positions 120-144
Positions 30-35:    Blanks
Positions 36-38:    'in '
Positions 39-43:    Input positions 110-114

Each VB output record is 43 bytes long and the output data set is given an LRECL of 43.

For the previous examples, the VB output records are all the same length. You can use OUTFIL'S VLTRIM parameter to create VB output records of different lengths from FB input records. Suppose you have an FB input data set with LRECL=20 and 20-byte records like this:
ABC
ABCDEF
AC
ABCDEFGHI
These statements change each 20-byte FB input record to a 24-byte VB output record and set LRECL=24 for the VB output data set:
  OPTION COPY
  OUTFIL FTOV
The VB output records look like this:
Length     X'0000'    Data
---------------------------------------------
1    2     3     4    5                   24
---------------------------------------------
    24           0    ABC
    24           0    ABCDEF
    24           0    AC
    24           0    ABCDEFGHI
---------------------------------------------
To remove the trailing blanks from the end of each VB output record, use VLTRIM=C' ' (or VLTRIM=X'40') like this:
  OUTFIL FTOV,VLTRIM=C' '
LRECL=24 is still set for the resulting VB output data set, indicating that the maximum record length is 24, but the VB output records are not padded on the right with blanks; they now have different record lengths like this.
Length     X'0000'    Data
---------------------------------------------
1    2     3     4    5                   24
---------------------------------------------
     7           0    ABC
    10           0    ABCDEF
     6           0    AC
    13           0    ABCDEFGHI
---------------------------------------------

You can use any character or hexadecimal byte value for VLTRIM. For example, VLTRIM=C'*' removes trailing asterisks, and VLTRIM=X'00' removes trailing binary zeros.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014