Joined: 19 Mar 2009 Posts: 181 Location: Globe, India
I am trying to sum up in the case of overflow also. I referred manual but not getting exact usgae of INREC statement with X'00 etc. to handle overflow..! Please assist me in this to handle overflow....!
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DSN=xxx.DFSORT.OUTPUT,DISP=SHR
//SYSIN DD *
M11 adjusts the pattern according to the implicit length of the input field (2 in this case). Specifying LENGTH extends the pattern with blanks on the left. EDIT=(TTTT) would give leading zeros if that's what you want.
I assume you have a SORT and SUM statement but I don't know what they look like. Please show ALL of the control statements you're using. Once I know the statements you're using, I'll be able to explain why you got what you got.
p,2,ZD,M11 gives TT because the input length is 2. LENGTH=4 extends that with 2 blanks on the left to give bbTT.
Your SUM statement is summing on 5,2,ZD instead of 6,2,ZD so you're actually summing ' 1' instead of '12', etc. This gives 07 for ONE and 09 for TWO in positions 5-6, and the 7th position is taken from the first record with each key. So you end up with:
Not sure what you were trying to do but whatever it is, you didn't do it right.