Sort-card to split a file into multiple files (OUTFIL,FNAMES,SAVE)

Let’s say we have a file with first byte having 2 different values ‘A’ or ‘B’ or any other character.
We are going to create a file with all records starting with A (DD name SORTXXA), a second file with all records starting with B (DD name SORTXXB), a third file (DD name SORTXXX) with remaining records.

 SORT FIELDS=COPY
 OUTFIL FNAMES=SORTXXA,INCLUDE=(1,1,CH,EQ,C'A') 
 OUTFIL FNAMES=SORTXXB,INCLUDE=(1,1,CH,EQ,C'B')   
 OUTFIL FNAMES=SORTXXX,SAVE  
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.