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


Converting numeric fields to different formats

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

Suppose you want the summed binary values in Table 2 be readable so you can print or display them. You can use the following statements to convert the BI values to readable ZD values:
  OPTION COPY
  OUTREC FIELDS=(1,4,X,
                 5,4,BI,TO=ZD,LENGTH=6,X,
                 9,4,BI,TO=ZD,LENGTH=6)

p,m,BI,TO=ZD converts the BI values to ZD values. By default, a 4-byte BI value produces a 10-byte ZD value, but LENGTH=6 overrides the default length to produce a 6-byte ZD value.

Table 1 shows the output, which is readable:
Table 1. Converting from BI to ZD
Publisher Number In Stock Number Sold

1  4

6    11

13    18

COR
FERN
VALD
WETH

000103
000019
000042
000062

000161
000087
000097
000079

Alternatively, you can use the following OUTREC statement to convert the BI values to readable FS values:
  OUTREC FIELDS=(1,4,X,
                 5,4,BI,TO=FS,LENGTH=6,X,
                 9,4,BI,TO=FS,LENGTH=6)

p,m,BI,TO=FS converts the BI values to FS values. By default, a 4-byte BI value produces an 11-byte FS value, but LENGTH=6 overrides the default length to produce a 6-byte FS value.

Table 2 shows the output, which is readable:
Table 2. Converting from BI to FS
Publisher Number In Stock Number Sold

1  4

6    11

13    18

COR
FERN
VALD
WETH

    103
     19
     42
     62

     161
      87
      97
      79

You can use p,m,f,TO=f or p,m,f,f to convert from various numeric formats to various other numeric formats. You can use LENGTH=n to override the default output length.

For detailed information on DFSORT's numeric conversion parameters, see z/OS DFSORT Application Programming Guide.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014