Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Report generation using TRAILER3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Report generation using TRAILER3
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

New User


Joined: 15 Aug 2015
Posts: 35
Location: Germany

PostPosted: Sat Oct 05, 2019 6:49 pm    Post subject:
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

Active Member


Joined: 29 Apr 2008
Posts: 552
Location: Maryland

PostPosted: Thu Oct 10, 2019 11:29 pm    Post subject: Re: Report generation using TRAILER3
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SAS Webinar - PROC REPORT: Getting St... vasanthz All Other Mainframe Topics 0 Wed Jan 30, 2019 11:38 pm
No new posts Writing multiple records into a CSV r... hiravibk DFSORT/ICETOOL 2 Wed Nov 07, 2018 2:35 pm
No new posts TRAILER3 is creating blank record in ... kodeesm DFSORT/ICETOOL 3 Fri May 18, 2018 5:45 pm
No new posts Undefined Report Program socker_dad COBOL Programming 2 Fri Mar 30, 2018 1:45 am
No new posts PARSE GDG name to separate generation... Abid Hasan SYNCSORT 2 Sun Feb 11, 2018 3:40 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us