Page 1 of 1

TRAILER3 - TOTAL function formatting

PostPosted: Thu Sep 24, 2009 2:17 pm
by jimscholes
Hi,

I am using reporting function TOT to sum up column (offset 20-21) which is a 2-byte field defined as PIC S9(4) COMP in COBOL. In output record, I want to have the total field remains S9(4) COMP, I tried not to use edit mark Mxx but it gives me error. How do I preserve the original data type after the addition?

//CTL2CNTL DD *
SORT FIELDS=(1,19,CH,A)
OUTFIL FNAMES=MYOUTFL,REMOVECC,NODETAIL,
SECTIONS=(1,19,
TRAILER3=(1,19,TOT=(20,2,ZD,LENGTH=2)))

Regards,
Jim

Re: TRAILER3 - TOTAL function formatting

PostPosted: Thu Sep 24, 2009 5:53 pm
by skolusu
jimscholes,

S9(4) COMP is BInary format and not ZD format. Check this link for the equivalent DFSORT formats for various COBOL data types

http://publibz.boulder.ibm.com/cgi-bin/ ... E1CA20/C.3

if all your input data is having positive numbers then use BI , and if you have both positive and negative numbers use FI format

Use the following control cards
//CTL2CNTL DD *
  SORT FIELDS=(1,19,CH,A)
  OUTFIL FNAMES=MYOUTFL,REMOVECC,NODETAIL,
  SECTIONS=(1,19,
  TRAILER3=(1,19,TOT=(20,2,BI,TO=BI,LENGTH=2)))
//*