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 required to format file Horizontally

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort required to format file Horizontally
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: 2181
Location: @my desk

PostPosted: Fri Jul 30, 2010 9:58 am    Post subject:
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    Post subject: Reply to: Sort required to format file Horizontally
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 Moderator


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

PostPosted: Fri Jul 30, 2010 9:06 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Jul 30, 2010 11:03 pm    Post subject:
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: 646
Location: Pennsylvania

PostPosted: Fri Jul 30, 2010 11:36 pm    Post subject:
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 Moderator


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

PostPosted: Fri Jul 30, 2010 11:54 pm    Post subject:
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: 646
Location: Pennsylvania

PostPosted: Fri Jul 30, 2010 11:59 pm    Post subject:
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 Moderator


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

PostPosted: Sat Jul 31, 2010 1:02 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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