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

Report generation using TRAILER3


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

New User


Joined: 14 Nov 2007
Posts: 37
Location: Chennai

PostPosted: Sat Oct 05, 2019 2:24 am
Reply with quote

Hello,

Can someone please help me out on the below query.

I have a input file
Code:

99 1 100.00 55.00 20.00
97 1 200.00 30.00 40.00
97 1   10.00 15.00 20.00
99 1   20.00   5.00 10.00


I can generate a report from the above input summing up the totals by SNO.
Code:

SNO   PAGE   CUS-NAME DOL$1  DOL$2 DOL$3
----- -----  --------  -------   ------ -----
99    1               120.00  60.00  30.00
97    1                 210      45.00  60.00


In the above report I need to populate CUS-NAME based on the SNO value (If SNO = 99, CUS-NAME should be 'ABC', If SNO = 97 CUS-NAME should be 'XYZ').

I tried with below SORT JCL but it is not working and giving syntax error.

Code:

SORT FIELDS=(1,5,A),FORMAT=CH
OUTFIL REMOVECC,NODETAIL,OUTREC=(1,5,6:80X),
HEADER2=(1:'SNO',5:'PAGE',9:'CUS-NAME ', 20:'DOL$1', 32:'DOL$2',44:'DOL$3'),
SECTIONS=(1,5,
IFTHEN=(WHEN=(1,2,CH,EQ,C'99'),BUILD=(9:'ABC')),
IFTHEN=(WHEN=(1,2,CH,EQ,C'97'),BUILD=(9:'XYZ')),
TRAILER3=(1:1,5,20:TOT=(8,12,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-)),
32:TOT=(21,12,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-)),
44:TOT=(34,12,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-))))


The SORT is working fine before I added IFTHEN statements. Please advise how can I populate the CUS-NAME based on the SNO value.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Sat Oct 05, 2019 6:49 pm
Reply with quote

1) What error messages were given?
2) IFTHEN are not allowed within SECTIONS
3) Move IFTHEN to INREC or OUTREC and do the logic there
4) Always consider a NOMATCH condition when assigning values
5) Read for CHANGE rather then having many IFTHENs

You could also work with SORT FIELDS and SUM instead of SECTIONS
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Oct 10, 2019 11:29 pm
Reply with quote

Krishnadeva Reddy wrote:
Code:

SORT FIELDS=(1,5,A),FORMAT=CH
OUTFIL REMOVECC,NODETAIL,OUTREC=(1,5,6:80X),
HEADER2=(1:'SNO',5:'PAGE',9:'CUS-NAME ', 20:'DOL$1', 32:'DOL$2',44:'DOL$3'),
SECTIONS=(1,5,
IFTHEN=(WHEN=(1,2,CH,EQ,C'99'),BUILD=(9:'ABC')),
IFTHEN=(WHEN=(1,2,CH,EQ,C'97'),BUILD=(9:'XYZ')),
TRAILER3=(1:1,5,20:TOT=(8,12,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-)),
32:TOT=(21,12,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-)),
44:TOT=(34,12,SFF,EDIT=(SIIIIIIIT.TT),SIGNS=(,-))))


The SORT is working fine before I added IFTHEN statements. Please advise how can I populate the CUS-NAME based on the SNO value.


1) Please, align your sample(s) of code, for other people (and you, too) would be able at least to read it!!!!


2) RTFM!

SECTIONS=(…) cannot include any IFTHEN= sub-parameter!
It is as clear as the sunny sky.

Nothing to discuss so far.
icon_kidra.gif
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 DFHPI1008 JSON generation failed COBOL Programming 0
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 Started task using a generation dataset JCL & VSAM 7
No new posts Ca7 long running jobs report All Other Mainframe Topics 1
Search our Forums:

Back to Top