|
View previous topic :: View next topic
|
| Author |
Message |
Krishnadeva Reddy
New User

Joined: 14 Nov 2007 Posts: 40 Location: Chennai
|
|
|
|
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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1429 Location: Bamberg, Germany
|
|
|
|
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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2264 Location: USA
|
|
|
|
| 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.
 |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|