Page 1 of 1
SORT help required.
Posted: Fri Jun 29, 2018 7:57 pm
by Anil
Hi,
I have a file like with
as records. I want B and C into new file. A should be written in to another file or discard as A is duplicate. Can we achieve this with SORT?
Re: SORT help required.
Posted: Sat Jun 30, 2018 4:15 pm
by nicc
As you posted in the sort section of the forum then sort help is inferred so your topic title is meaningless especially to people trying to find a solution.
I presume you mean 'DATA SET' and not 'file', the latter being, prinicipally a PC/Unix term and a file is not the same as a 'data set'.
You went around the houses just to say 'How can I copy a data set excluding certain records'. The answer to the question as you posed it is 'Yes'.
The answer you are looking for is in the way I posed it (the word beginning 'exclud' is a big clue).
Re: SORT help required.
Posted: Sat Jun 30, 2018 6:14 pm
by enrico-sorichetti
please , learn to use a meaningful title,
most often many people who might have the knowledge to answer
will skip over stupid topic titles
Re: SORT help required.
Posted: Tue Jul 03, 2018 8:03 pm
by Sandy
Try this:
Code: Select all
INREC FIELDS=(1,1,C'0001')
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(2,10,ZD)
INCLUDE COND=(2,10,CH,EQ,C'0001')
OUTREC FIELDS=(1,1)
Re: SORT help required.
Posted: Fri Jul 06, 2018 8:08 pm
by Anil
Hi Sandy,
Thanks. I got the below error with your card:
Code: Select all
WER237I OUTREC RECORD LENGTH = 1
WER110I SORTOUT : RECFM=FB ; LRECL= 1; BLKSIZE= 1
WER074I SORTOUT : DSNAME=NULLFILE
WER558I ZPSORT EXECUTED
WER216A SUM FIELD OUTSIDE RANGE
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Re: SORT help required.
Posted: Fri Jul 06, 2018 8:09 pm
by Anil
I understood the error and then I made the following changes in the card:
Code: Select all
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
A
A
B
C
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC FIELDS=(1,1,C'0001')
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(2,4,ZD)
INCLUDE COND=(2,4,CH,EQ,C'0001')
OUTREC FIELDS=(1,1)
//*
Job executes successfully, but I am not getting any records in the output. Could you advise.
Re: SORT help required.
Posted: Fri Jul 06, 2018 8:19 pm
by nicc
Basic really: your data is A, B, C, D in cc 1 but you are specifying 0001 in cc 1-4. There is no record with 0001 in cols 1 to 4 so no records are selected.