> In one pass of an input file is there a way to use SORT to both
> remove identified records from an input file AND write those removed
> records to a second output file?
Peter,
You don't need 2 passes of data, you can tag the records that match your
identification and then use that tag to filter the records on OUTFIL. Some
thing like this
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABC - DROP THIS RECORD
DEF - PICK THIS RECORD
EFG - PICK THIS RECORD
XYZ - DROP THIS RECORD
ZZZ - DROP THIS RECORD
//PICKREC DD SYSOUT=*
//DROPREC DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,3,SS,EQ,C'DEF,EFG'),
OVERLAY=(81:C'A'))
OUTFIL FNAMES=PICKREC,
INCLUDE=(81,1,CH,EQ,C'A'),
BUILD=(1,80)
OUTFIL FNAMES=DROPREC,SAVE,
BUILD=(1,80)
/*
The PICKREC file will have the following records
DEF - PICK THIS RECORD
EFG - PICK THIS RECORD
The DROPREC file will have the following records
ABC - DROP THIS RECORD
XYZ - DROP THIS RECORD
ZZZ - DROP THIS RECORD
For VB files, make sure that you have the Indicator right after the RDW so
that you retain the variable length records as is
Something like this
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,4, $ RDW
X, $ ID TAG
5)), $ DATA AS-IS
IFTHEN=(WHEN=(6,3,SS,EQ,C'DEF,EFG'),
OVERLAY=(05:C'A'))
OUTFIL FNAMES=PICKREC,
INCLUDE=(05,1,CH,EQ,C'A'),
BUILD=(1,04, $ RDW
6) $ DATA AS-IS
OUTFIL FNAMES=DROPREC,SAVE,
BUILD=(1,04, $ RDW
6) $ DATA AS-IS
/*
Fruther if you have any questions please let me know
Thanks,
Kolusu
DFSORT Development
IBM Corporation
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN