SORT help required.

IBM's Sort Product, ICETOOL, ICEMAN and ICEGENER.
Post Reply
Anil
Registered Member
Posts: 70
Joined: Sun Jun 16, 2013 12:41 am

SORT help required.

Post by Anil »

Hi,

I have a file like with

Code: Select all

A
A
B
C
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?
Thanks,
Anil
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: SORT help required.

Post 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).
Regards
Nic
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 837
Joined: Wed Sep 11, 2013 3:57 pm

Re: SORT help required.

Post 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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Sandy
Registered Member
Posts: 51
Joined: Sat Jun 15, 2013 1:07 pm

Re: SORT help required.

Post 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)
Anil
Registered Member
Posts: 70
Joined: Sun Jun 16, 2013 12:41 am

Re: SORT help required.

Post 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                
Thanks,
Anil
Anil
Registered Member
Posts: 70
Joined: Sun Jun 16, 2013 12:41 am

Re: SORT help required.

Post 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.
Thanks,
Anil
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: SORT help required.

Post 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.
Regards
Nic
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DFSort, ICETOOL, ICEMAN, ICEGENER.”