Example 10
OPTION COPY
OUTFIL FNAMES=ALL,OUTREC=(C'US ',1,10,C' is in ',11,15,/,
C'WW ',1,10,C' is in ',26,20,2/)
OUTFIL FNAMES=(US,WW),SPLIT,
OUTREC=(1,10,C' is in ',11,15,/,
1,10,C' is in ',26,20)
Finance San Francisco Buenos Aires
Research New York Amsterdam
Marketing Los Angeles Mexico City
The first OUTFIL statement creates the data set associated with ddname ALL. This data set will have an LRECL of 40 (the length of the longest output record; the one that includes the 26,20 input field). Each input record will result in two data records followed by two blank records as follows:
US Finance is in San Francisco
WW Finance is in Buenos Aires
US Research is in New York
WW Research is in Amsterdam
US Marketing is in Los Angeles
WW Marketing is in Mexico City
The second OUTFIL statement creates the two data sets associated with ddnames US and WW. These data sets will have an LRECL of 37 (the length of the longest output record; the one that includes the 26,20 input field). Each input record will result in two data records. SPLIT will cause the first data record to be written to the US data set and the second data record to be written to the WW data set. Thus, each input record will create one record in each OUTFIL data set as follows:
Finance is in San Francisco
Research is in New York
Marketing is in Los Angeles
Finance is in Buenos Aires
Research is in Amsterdam
Marketing is in Mexico City