View previous topic :: View next topic
|
Author |
Message |
chan2004
New User
Joined: 28 Mar 2007 Posts: 16 Location: India
|
|
|
|
Hi,
I have a jcl like this:
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=t*****.SAMPLE.INPUT,DISP=SHR
//SORTOUT DD DSN=t*****.SAMPLE.OUTPUT,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(1,16,SS,EQ,C'chan') --stmnt 1
SORT FIELDS=COPY -- stmnt 2
SUM FIELDS=(1,3,BI) --stmnt 3
/*
stmnt 1 and stmnt 2 will retrieve two records like this:
100001CHAN
100002CHAN
I want to add the first 6 characters of the two records and display
But its displaying
ICE109A E SUM FIELD DISPLACEMENT OR LENGTH VALUE ERROR
SORT FIELDS=COPY
How to resolve it? |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
Quote: |
I want to add the first 6 characters of the two records |
Then why u gave
Code: |
SUM FIELDS=(1,3,BI) |
|
|
Back to top |
|
|
chan2004
New User
Joined: 28 Mar 2007 Posts: 16 Location: India
|
|
|
|
so that i can add 100 of first record and 100 of second record
isn't this correct
or am i missing something? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You're doing a couple of things wrong:
1) You can't use SUM with COPY. SUM adds values for duplicate keys. COPY doesn't use a key. You need SORT or MERGE with SUM.
2) The fields you want to SUM are ZD values, not BI values. (You can only SUM 2, 4 or 8 byte BI values, but since your values are actually ZD the length can be 1 to 31.)
If you're just trying to get an overall total for the value in positions 1-3, you can use this instead of SUM:
Code: |
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(TOT=(1,3,ZD,EDIT=(TTT)))
|
If you want to do something else, explain in detail what you want to do with an example of input and output. |
|
Back to top |
|
|
|