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

Sort - eliminating the spaces between columns


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jun 26, 2012 11:57 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jun 27, 2012 12:10 am
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

Global Moderator


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

PostPosted: Wed Jun 27, 2012 12:15 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jun 27, 2012 12:55 am
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

Global Moderator


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

PostPosted: Wed Jun 27, 2012 1:21 am
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

Global Moderator


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

PostPosted: Wed Jun 27, 2012 1:35 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jun 27, 2012 1:50 pm
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

Global Moderator


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

PostPosted: Wed Jun 27, 2012 2:06 pm
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
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: 2481
Location: @my desk

PostPosted: Fri Jun 29, 2012 6:25 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top