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

Any single step solution possible?


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Apr 22, 2019 6:18 am
Reply with quote

Input Data set:
Code:
Header..
Rec1...
Rec2...
Rec3...
.
.
.
.
Total Record : 1,500
ABC   : 1 5 455
ABC   : 2 6 1,234


out put expected is,
Code:
ABC   : 1 5 455      69.67% A1
ABC   : 2 6 1,234    17.74% A2


% calculated as 1- (455/1500) * 100
A1 calculated as if second column is <5
A2 calculated as if second column is >5 and <=6

I am thinking to,
1. Split the input dataset into two,
a. Separating single record into one dataset
Code:
Total Records : 1500 << (removing ',')

b. All ABC records only by removing ',' from last column
Code:
ABC : 2 6 1,234 1234

2. Use joinkeys to match a and b to make division possible for calculating %
part and also use IF WHEN condition to evaluated A1 or A2 in the same
step and build accordingly.

Is there a better way?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Mon Apr 22, 2019 12:45 pm
Reply with quote

Rohit, you are only processing the ABC records that are already in your Input dataset? I think the Total records can be pushed when found so you have all values at hand. Maybe you can shed some more light on the ABC lines for me?
With some logic build two additional columns for your selection criteria and SUM them. I think in the OUTREC or OUTFIL you could do later the required math.

Just some thoughts.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Apr 22, 2019 3:44 pm
Reply with quote

Joerg, That is right. I am only including ABC records ignoring the rest from the input data set in my final output.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Tue Apr 23, 2019 2:32 am
Reply with quote

Rohit Umarjikar wrote:

Code:

.
Total Record : 1,500
ABC   : 1 5 455
ABC   : 2 6 1,234


output expected is,
Code:
ABC   : 1 5 455      69.67% A1
ABC   : 2 6 1,234    17.74% A2


% calculated as 1- (455/1500) * 100
A1 calculated as if second column is <5
A2 calculated as if second column is >5 and <=6

Is there a better way?


1) When 'Total Record' is detected PUSH it into unused position (at the end of record?) to be used in further lines re-calculations.

2) In order to choose A1/A2 based on 5-6 range use IFTHEN=(WHEN=(condition),... with BUILD= or OVERLAY=

3) In order to ignore comma-separator in 1,234 use UFF or SFF format.

4) All those build/rebuild parameters can be split between INREC/OUTREC/OUTFIL statements if cannot be done within the same statement (to simulate three sequential steps! icon_biggrin.gif )

The rest of operations seems to be pretty standard, isn't it?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Tue Apr 23, 2019 8:02 am
Reply with quote

Thanks Sergeyken.
I was able to get following outcome using inrec so far, but when I am doing division part in OUTREC its not giving the right results since the division results go into many decimal places.
Code:
ABC   : 1 5 000000455  000001500
ABC   : 2 6 000001234  000001500


So 000000455/00001500 gives 0.00000000000 which is wrong, so need to fix that part and twist it to get it right then I guess I am done. icon_smile.gif
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Tue Apr 23, 2019 5:36 pm
Reply with quote

Rohit Umarjikar wrote:
So 000000455/00001500 gives 0.00000000000 which is wrong, so need to fix that part and twist it to get it right then I guess I am done. icon_smile.gif

Try to convert it not to ZD, but to either PD, or FI, or even FL/FD before trying to divide?
I may try it later if I have time for testing.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Tue Apr 23, 2019 5:50 pm
Reply with quote

I did a little trick to MUL by +10000000 to 000000455 and then adjusted the EDIT to get it right decimal (certainly I need to test it for all other possible values ) , now this value needs to be SUB from +1 and then MUL by 100 to get the correct % which I will give a try today. Thanks
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed May 01, 2019 10:05 pm
Reply with quote

I got this worked in two steps but it is fine having two step as it is easy to maintain and understand. Thanks.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Submit multiple jobs from a library t... JCL & VSAM 14
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
Search our Forums:

Back to Top