Splitting an input file into multiple output files based on record data
This example shows how to split an input file into one or more output files based on the contents of each input record.
Example
For example, suppose there is never a WRITE to the file ERROR and that ERROR is allocated NEW in the DD card, with BLKSIZE=0 for DFSMS to determine. After DSC executes with the control cards shown below, ERROR will not have been opened, so the BLKSIZE will not have been set acceptably by DFSMS and so it will still be zero. All attempts to read ERROR will generate errors. Therefore, before running this utility you should create empty secondary output data sets. You can use File Manager Data Set Generate (DSG) with NLRECS=0.
This discussion only applies to secondary (WRITE) output data sets. File Manager always opens the primary DSC output data set.
$$FILEM DSG OUTPUT=ERROR,NLRECS=0
$$FILEM DSG OUTPUT=OV100,NLRECS=0
$$FILEM DSG OUTPUT=LT10,NLRECS=0
$$FILEM DSG OUTPUT=MIDDLE,NLRECS=0
$$FILEM DSC PROC=*
If \ FLD_TYPE(1,4,"P") Then WRITE( ERROR )
Else If FLD(1,4,"P") > 100 Then WRITE( OV100 )
Else If FLD(1,4,"P") < 10 Then WRITE( LT10 )
Else WRITE( MIDDLE )
RETURN DROP
REXX:
(Same as FASTREXX)