IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To generate report header, sum trailer in every next page.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vaibhavjadhav

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Wed Dec 15, 2010 10:39 am
Reply with quote

Hi,

I am creating a report in ICETOOL where my requirement is as shown below:

input:

001 SE 50
001 TL 60
001 PM 70
002 SE 50
002 PM 30
003 DM 40
003 PM 90

output:

COMPANY DETAILS - 10:30 MONDAY, DECEMBER 13, 2010 (Page - 1)
EMP = 001
DES SAL
---- ----
SE 50
TL 60
PM 70
-----
EMP 180

COMPANY DETAILS - 10:30 MONDAY, DECEMBER 13, 2010 (Page - 2)
EMP = 002
DES SAL
---- ----
SE 50
PM 30
------
EMP 80

COMPANY DETAILS - 10:30 MONDAY, DECEMBER 13, 2010 (Page - 3)
EMP = 003
DES SAL
---- ----
DM 40
PM 90
-----
EMP 130
=====
TOTAL 390

Output Explanation:
The input file should be grouped based on the first field i.e. EMP 001,002...etc, and should written to the output report based on groups as EMP=001,EMP=002, EMP=003. Every group should have header, date and time(format as shown above) and Page no in incrementing order. In every group the sum should be done on SAL field which should have EMP as field name for it(as this has been used for grouping e.g EMP 180 for group 1st). Finally all the sum of groups should be totalled under TOTAL field.

Please help me in solving the above query.
Thanks in advance.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Dec 15, 2010 11:57 pm
Reply with quote

Code:

//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                     
001 SE 50                           
001 TL 60                           
001 PM 70                           
002 SE 50                           
002 PM 30                           
003 DM 40                           
003 PM 90                           
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:DATE1,81,8,Y4T,WEEKDAY=CHAR9)),
  IFTHEN=(WHEN=(85,2,ZD,EQ,01),OVERLAY=(99:C'JANUARY')),             
  IFTHEN=(WHEN=(85,2,ZD,EQ,02),OVERLAY=(99:C'FEBRUARY')),             
  IFTHEN=(WHEN=(85,2,ZD,EQ,03),OVERLAY=(99:C'MARCH')),               
  IFTHEN=(WHEN=(85,2,ZD,EQ,04),OVERLAY=(99:C'APRIL')),               
  IFTHEN=(WHEN=(85,2,ZD,EQ,05),OVERLAY=(99:C'MAY')),                 
  IFTHEN=(WHEN=(85,2,ZD,EQ,06),OVERLAY=(99:C'JUNE')),                 
  IFTHEN=(WHEN=(85,2,ZD,EQ,07),OVERLAY=(99:C'JULY')),                 
  IFTHEN=(WHEN=(85,2,ZD,EQ,08),OVERLAY=(99:C'AUGUST')),               
  IFTHEN=(WHEN=(85,2,ZD,EQ,09),OVERLAY=(99:C'SEPTEMBER')),           
  IFTHEN=(WHEN=(85,2,ZD,EQ,10),OVERLAY=(99:C'OCTOBER')),             
  IFTHEN=(WHEN=(85,2,ZD,EQ,11),OVERLAY=(99:C'NOVEMBER')),             
  IFTHEN=(WHEN=(85,2,ZD,EQ,12),OVERLAY=(99:C'DECEMBER'))             
                                                                     
  OUTREC IFTHEN=(WHEN=INIT,                                           
  BUILD=(1,10,81:TIME,89,9,C',',99,9,X,87,2,C',',81,4)),             
  IFTHEN=(WHEN=INIT,                                                 
  BUILD=(1,10,81:81,5,X,89,27,SQZ=(SHIFT=LEFT,MID=C' '))),           
  IFTHEN=(WHEN=INIT,                                                 
  FINDREP=(STARTPOS=87,ENDPOS=95,INOUT=(C' ',C'')))                   
                                                                     
  OUTFIL REMOVECC,BUILD=(1:5,3,6:8,3,80:X),                           
  SECTIONS=(1,3,SKIP=P,                                               
  HEADER3=('COMPANY DETAILS - ',81,33,X,'(PAGE - ',PAGE,')',/,       
           'EMP = ',1,3,/,                                           
           'DES  SAL',/,                                             
           '---  ---',/,80:X),                                       
  TRAILER3=('---------',/,'EMP ',TOT=(8,2,ZD,M10,LENGTH=4),/)),       
  TRAILER1=('=========',/,'TOTAL ',TOT=(8,2,ZD,M10,LENGTH=6),/)       

//*
Back to top
View user's profile Send private message
vaibhavjadhav

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Tue Dec 21, 2010 6:32 pm
Reply with quote

Hi Skolusu,

Thanks a ton ....i did executed the above code and its working fine. icon_biggrin.gif
Back to top
View user's profile Send private message
vaibhavjadhav

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Wed Dec 29, 2010 5:20 pm
Reply with quote

Hi Skolusu,

In the above requirement there is a small change wherein my input and output is as shown below.

input:
1st part
001 SE 50 AA P
001 TL 60 AA P
001 PM 70 AA Q
002 SE 50 BB R

2nd part
001 SE 50 AA P
001 TL 60 AA P
001 PM 70 AA Q
002 SE 50 BB R
002 SE 50 BB R
output:

The output below has different criterias
1.) when only system is changed then only the total will be printed as shown in 1st part below
2.) when last rec i.e for emp = 002 has more than one records then the output will be as shown in 2nd part.

A.) 1ST PART
COMPANY DETAILS - 10:30 MONDAY, DECEMBER 13, 2010 (Page - 1)
EMP = 001 SYSTEM = P
DES SAL CODE SYSTEM
---- ---- ------- --------
SE 50 AA P
TL 60 AA P
-----
EMP 110

COMPANY DETAILS - 10:30 MONDAY, DECEMBER 13, 2010 (Page - 1)
EMP = 001 SYSTEM = Q
DES SAL CODE SYSTEM
---- ---- ------- --------
PM 70 AA Q
-----
EMP 70

SYSTEM 180
EMP 180


COMPANY DETAILS - 10:30 MONDAY, DECEMBER 13, 2010 (Page - 2)
EMP = 002
DES SAL
---- ----
SE 50
PM 30
------
EMP 80
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Dec 29, 2010 7:46 pm
Reply with quote

Which is more likely to happen?

1) It will rain during monsoon season.

2) A Dfsort Topic Starter will change their requirement after a working
solution is provided.

Answer: It is a tie icon_smile.gif

This is a perfect opportunity to study what Skolusu has given and learn about Dfsort.

You can take what you have learned and make this small change yourself.

Which is more likely to happen?

1) You take this opportunity and make the changes yourself.

2) Wait for someone to do it for you.

Answer:
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Need help on formatting a report DFSORT/ICETOOL 14
No new posts Creating Report using SORT DFSORT/ICETOOL 7
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
Search our Forums:

Back to Top