Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
avaneendra_linga

New User

Joined: 13 Dec 2006
Posts: 73

Posted: Mon Apr 30, 2007 7:39 pm    Post subject: ERROR in SORT: SUM FIELD OVERLAPS CONTROL FIELD

HI IN MY INPUT FILES I HAVE TWO VALUES STATING FROM 1 LEGTH IS 10.
I AM GETTING THE FOLLOWING ERROR WHILE DOING SUM ..CAN ANYBODY HELP ON THIS....

ICE112I EQUALS NOT USED WITH SUM
ICE119A SUM FIELD OVERLAPS CONTROL FIELD

 Code: INPUT: //TOTI      DD  *    0000000006          0000000002          /*                  CARD: //TOOLIN   DD   *                                    SORT FROM(TOTI) TO(TOTO) USING(CTL2)    /*                                        //CTL2CNTL  DD   *                  SORT FIELDS=(1,10,CH,A),EQUALS      SUM FIELDS=(1,10,ZD)              /*

William Thompson

Global Moderator

Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

 Posted: Mon Apr 30, 2007 8:44 pm    Post subject: For DFSORT: "Summary fields must not be control fields. They must not overlap control fields, or each other, and must not overlap the RDW." The simplest thing to do would inrec duplicate the one field into two and sort on one and sum on the other. You do realize that your input: 0000000006 0000000002 would become: 00000000060000000006 00000000020000000002 and your output would be: 00000000060000000006 00000000020000000002 because if the key is different, they won't sum together.
Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

Posted: Mon Apr 30, 2007 9:06 pm    Post subject:

avaneendra_linga,

As William pointed out, you can't overlap sort and sum fields, but it usually doesn't make any sense to do that. SUM is used to sum fields with the same key. In your case, you just show two numeric fields with no key, so I suspect what you really want to do is just get an overall total for your numeric fields. You wouldn't do that with SUM. Instead, you'd do it like this:

 Code: //S1 EXEC PGM=ICETOOL //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //TOTI      DD  *    0000000006          0000000002          /*                  //TOTO DD DSN=...  output file //TOOLIN   DD   *                                  COPY FROM(TOTI) USING(CTL2)    /*                                        //CTL2CNTL  DD   *                  OUTFIL FNAMES=TOTO,REMOVECC,NODETAIL,      TRAILER1=(TOT=(1,10,ZD,TO=ZD,LENGTH=10))    /*

If that's not what you want to do, then please explain exactly what it is you're trying to do.
avaneendra_linga

New User

Joined: 13 Dec 2006
Posts: 73