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

Sort required to format file Horizontally


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Fri Jul 30, 2010 8:50 am
Reply with quote

Hi,

I had a requirement for which i am trying to write a sort. The requirement is as below,

Input file has records unloaded from a Table as below

Code:
0001   AA
0001   BB
0001   CC
0002   BB
0002   DD


I need to get an output file in the format,

Code:
0001    AA,BB,CC
0002    BB,DD

Is it possible to achieve this using sort?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jul 30, 2010 9:58 am
Reply with quote

Debasis Misra,

How many duplicates can be present in the input for field-1?

And input RECFM/LRECL?
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Fri Jul 30, 2010 10:24 am
Reply with quote

Arun,

The duplicates may vary in number. But the max that it can vary is 30.

The first four position indicates the key value. The logical record length of the input file is atleast 7 as the key is 4 byte with a space of 1 byte followed by the value of 2 bytes.

And the output file needs to be just enough to handle 30 duplicates along with the comma.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 30, 2010 9:06 pm
Reply with quote

Debasis,

You can use this DFSORT/ICETOOL job to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/7)
//OUT DD DSN=... output file (FB/94)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,4,CH) WITHEACH -
 WITH(9,2) WITH(12,2) WITH(15,2) WITH(18,2) WITH(21,2) -
 WITH(24,2) WITH(27,2) WITH(30,2) WITH(33,2) WITH(36,2) -
 WITH(39,2) WITH(42,2) WITH(45,2) WITH(48,2) WITH(51,2) -
 WITH(54,2) WITH(57,2) WITH(60,2) WITH(63,2) WITH(66,2) -
 WITH(69,2) WITH(72,2) WITH(75,2) WITH(78,2) WITH(81,2) -
 WITH(84,2) WITH(87,2) WITH(90,2) WITH(93,2) -
 USING(CTL1)
//CTL1CNTL DD *
  OPTION COPY
  INREC IFOUTLEN=94,
    IFTHEN=(WHEN=INIT,OVERLAY=(95:SEQNUM,2,ZD,RESTART=(1,4))),
    IFTHEN=(WHEN=(95,2,ZD,EQ,2),OVERLAY=(9:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,3),OVERLAY=(12:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,4),OVERLAY=(15:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,5),OVERLAY=(18:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,6),OVERLAY=(21:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,7),OVERLAY=(24:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,8),OVERLAY=(27:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,9),OVERLAY=(30:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,10),OVERLAY=(33:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,11),OVERLAY=(36:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,12),OVERLAY=(39:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,13),OVERLAY=(42:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,14),OVERLAY=(45:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,15),OVERLAY=(48:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,16),OVERLAY=(51:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,17),OVERLAY=(54:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,18),OVERLAY=(57:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,19),OVERLAY=(60:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,20),OVERLAY=(63:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,21),OVERLAY=(66:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,22),OVERLAY=(69:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,23),OVERLAY=(72:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,24),OVERLAY=(75:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,25),OVERLAY=(78:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,26),OVERLAY=(81:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,27),OVERLAY=(84:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,28),OVERLAY=(87:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,29),OVERLAY=(90:6,2)),
    IFTHEN=(WHEN=(95,2,ZD,EQ,30),OVERLAY=(93:6,2))
  OUTFIL FNAMES=OUT,
    BUILD=(1,5,6,89,SQZ=(SHIFT=LEFT,MID=C','))
/*
Back to top
View user's profile Send private message
Gabriel Araujo Alves

New User


Joined: 20 Jul 2010
Posts: 38
Location: Brazil

PostPosted: Fri Jul 30, 2010 10:28 pm
Reply with quote

where's my post??? I show some solution... icon_sad.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 30, 2010 11:03 pm
Reply with quote

Your solution was incomplete (for example, you didn't insert the commas) so I deleted it. Please don't post incomplete solutions. We have two DFSORT developers (myself and Kolusu) answering posts here, so we really don't need your "help".
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Jul 30, 2010 11:36 pm
Reply with quote

Wow Frank icon_eek.gif

I realize his post was incomplete/incorrect, but that was pretty harsh.

Maybe we should rename this the "Frank and Kolusu Forum".

'No one else need reply - they don't need your help'
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 30, 2010 11:54 pm
Reply with quote

There are several people who contribute good solutions to this list besides myself and Kolusu. I have no problem with people contributing good solutions. But correcting bad solutions takes too much time away from our day jobs of developing DFSORT and ICETOOL. We participate in several help boards and gets many private e-mails asking for solutions every day. We're happy to help customers use DFSORT and ICETOOL effectively and efficiently, but we don't have time to correct bad or incomplete solutions and such solutions just serve to confuse people.

If you consider that "harsh", I'm sorry.

Quote:
Maybe we should rename this the "Frank and Kolusu Forum".


No, it's correctly named the "DFSORT/ICETOOL Forum" and it's "staffed" by DFSORT/ICETOOL developers. I would think that having experts respond to the Forum would be considered helpful by most people. Would you want to call a helpline for a product and get "help" from somebody who didn't know the product well?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Jul 30, 2010 11:59 pm
Reply with quote

I agree with everything you said.

The part that got me was:
Quote:

We have two DFSORT developers (myself and Kolusu) answering posts here, so we really don't need your "help".
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jul 31, 2010 1:02 am
Reply with quote

Not sure what about that "got you".

I said "your" help referring to THAT particular poster. From what I can tell, he just recently started using DFSORT/ICETOOL and is using this Forum to "practice". I advised him previously to feel free to practice all he wants, but not to post incomplete or untested solutions as they don't really help anyone. It's admirable that he wants to learn to use DFSORT/ICETOOL better, but at this point I believe he should be watching and learning until he becomes proficient at which point he can post all he wants.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top