Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort - eliminating the spaces between columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Ragav86

New User


Joined: 27 Jan 2010
Posts: 37
Location: chennai

PostPosted: Tue Jun 26, 2012 11:52 pm    Post subject: Sort - eliminating the spaces between columns
Reply with quote

Hi,

I have a below sort step in my JCL where we roll up the quantity and eliminating the spaces between each columns. Rolling up the quantity was working good until i added the line OUTFIL FINDREP=(IN=C' ',OUT=C''). After I added the above line, the space was eliminated but the adding quantity value was wrong. Is anybody is having any ideas? Here I am sending sample input values and expected output.

INREC OVERLAY=(73:73,13,SFF,TO=ZD,LENGTH=13)
SORT FIELDS=(4,4,ZD,A,93,4,CH,A,98,2,CH,A,101,15,CH,A)
SUM FIELDS=(73,13,ZD)
OUTREC OVERLAY=(01:01,02,
03:03,01,
04:04,04,
08:08,01,
09:101,15,
24:24,01,
25:25,15,
40:40,01,
41:41,15,
56:56,01,
57:57,15,
72:72,01,
73:73,13,ZD,EDIT=(SIIIIIIIIT.TT),SIGNS=(+,-),
86:86,01,
87:87,01,
88:88,01,
89:89,01,
90:90,01,
91:91,01,
92:92,01,
93:93,04,
97:97,01,
98:98,02)
OUTFIL FINDREP=(IN=C' ',OUT=C'')

Input Values :

0019,103731 ,L2-008257 ,L3-002223 , +00000004.28,2012
0019,103731 ,L2-008257 ,L3-002223 ,+00000003.12,2012
0019,15251 ,L2-008257 ,L3-002223 ,+00000002.11,2012
0019,15251 ,L2-008257 ,L3-002223 ,+00000022.32,2012

Expected Output:

0019,103731,L2-00825,L3-002223,+7.40,2012
0019,15251,L2-008257,L3-002223,+24.43,2012
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Jun 26, 2012 11:57 pm    Post subject: Reply to: Sort - eliminating the spaces between columns
Reply with quote

What output are you getting?

EDIT: You are making things tougher by including stuff in the OVERLAY which does not need to be there.

The OVERLAY only needs fields which are going to change. Other values are unchanged. There is no point in 001:1,1,002,2,1 etc.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Jun 27, 2012 12:10 am    Post subject: Reply to: Sort - eliminating the spaces between columns
Reply with quote

The SUM has already happened before the OUTFIL, so the OUTFIL is not affecting the SUM in any way (there will be no spaces in the SUMmed field, so nothing to change).

Putting your stuff in the Code tags, it seems your input records are not in fixed positions. Is that an error in posting, or is your file like that? If like that, maybe (we can't see the entire record) what you think is going to SUM is not matching on the key?
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jun 27, 2012 12:15 am    Post subject:
Reply with quote

Easiest way to avoid too many confusions why not have FINDREP in INREC

Then Sum the data and fix the the decimals

There might be better option too
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Jun 27, 2012 12:55 am    Post subject: Reply to: Sort - eliminating the spaces between columns
Reply with quote

Pandora-Box, how would you sort and sum the file?
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jun 27, 2012 1:21 am    Post subject:
Reply with quote

By using the new modified INREC?

Isnt that possible???

I ment something like when=init use Findrep
When=init use overlay by placing fields to be added at 81
Sort the file for 1,80
Sum 81,13

Then edit and use outrec ofcourse this is untested not sure if I understood things in different way
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jun 27, 2012 1:35 am    Post subject:
Reply with quote

Sorry the above 80 and 81 should be 100 & 101
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Jun 27, 2012 1:50 pm    Post subject: Reply to: Sort - eliminating the spaces between columns
Reply with quote

Seems like TS might just have had bad data going in.

Remember that every byte added in INREC where there is a SORT makes more data which makes the sort slower. The extent to which this "matters" depends on the number of records, but it is generally good practice to sort less data rather than more.

If the data for sorting are in fixed positions on the input, there is no real point in just making them variable in position and making a fixed key for the sort at the end of the record. Although it would work. But there are many convoluted ways of doing things in any language that "work" but which would not be recommended.

I think as well as achieving the task, try with the minimum of changing the data.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jun 27, 2012 2:06 pm    Post subject:
Reply with quote

I understand that Bill Thanks for your inputs
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Wed Jun 27, 2012 2:44 pm    Post subject:
Reply with quote

Hello,

To eliminate the spaces, did you tried the squeeze

Code:
INREC BUILD=(1,120,SQZ=(SHIFT=LEFT))


Always try posting the file layout with the code tag for the better understanding.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2165
Location: @my desk

PostPosted: Fri Jun 29, 2012 6:25 pm    Post subject:
Reply with quote

Ragav86,

Why dont you post the Actual Output you got, which you claim to have changed by the addition of just an OUTFIL?
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us