View previous topic :: View next topic
|
Author |
Message |
amirthashankar
New User
Joined: 12 Jul 2007 Posts: 1 Location: Chennai
|
|
|
|
I have a report file of 200 bytes fixed length. The fields are as follows:
(We require these fileds (FLD 1 - 7) for sorting purpose)
Positions
FLD 1 1 - 4
FLD 2 5 - 9
FLD 3 10 17
FLD 4 18 - 22
FLD 5 23 - 27
FLD 6 28 - 32
FLD 7 33 - 37
FLD 8 38 - 41 (Line cnt in eacb page of the report)
I have shown two sample records from the file.
000500001BIGK 383104051440600031790086 TOTAL
000500002BIGK 383104051440600031790047 GRAND TOTAL
The first record is from Page 1 which has 86 lines and second record is from page 2 which has 47 lines.
(Note: All the records in the pages will have zeros in the line cnt field. Only the last record in each page will have the count value)
The requirement is I need to sum up these two line cnt values (86 + 47) and have it as below:
FLD FLD FLD FLD FLD FLD FLD FLD
1 2 3 4 5 6 7 8
000500001BIGK 383104051440600031790086 TOTAL
000500002BIGK 383104051440600031790047 GRAND TOTAL
END CNT 0133
We cannot use SUM FIELDS here because this will remove duplicate keys and will result in only 1 record. My sort keys will be fields 1 thru 7 respectively.
Please let me know if this can be achieved using any other option. My shop supports only SYNCSORT. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Do not think in terms of SUM, think in terms of TOTAL (like in a report trailer)......... |
|
Back to top |
|
|
raghunathns
Active User
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
this is any alternate solution. you can do it with the program which is creating this file.(i mean syncsort input file).
that program is writing 0086, 0047. so page wise toals are accumulated in the program. when ever there is a new page then add page total to grand total. at the end of the program wire another summary line in the file. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
Syncsort may be generating the report, not some Cobol program. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
amirthashankar
Here you go
Code: |
//*******************************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000500001BIGK 383104051440600031790086 TOTAL
000500002BIGK 383104051440600031790047 GRAND TOTAL
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
TRAILER1=(1:C'END CNT',10:TOT=(37,2,ZD,EDIT=(IIIIT)))
/*
|
SORTOUT
Code: |
----+----1----+----2----+----3----+----4----+----5----+----6
000500001BIGK 383104051440600031790086 TOTAL
000500002BIGK 383104051440600031790047 GRAND TOTAL
END CNT 133
|
|
|
Back to top |
|
|
sudhakar_mainframe Warnings : 1 New User
Joined: 29 Jun 2006 Posts: 25
|
|
|
|
Hi,
can u please elabroate the sort card
bye,
sudhakar |
|
Back to top |
|
|
|