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
 

 

Sparse data in ascending order

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Jan 23, 2014 2:25 am    Post subject: Sparse data in ascending order
Reply with quote

From another topic, now locked, I have some code, so I'll put it here.

Since the use of PARSE for this is interesting, I thought I'd do it with the known values:

Code:
//PARSESRT EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC   IFTHEN=(WHEN=INIT,
                   PARSE=(%01=(STARTAT=C'DATA1',
                               FIXLEN=06))),
          IFTHEN=(WHEN=INIT,
                   PARSE=(%02=(STARTAT=C'FINP6',
                               ABSPOS=1,
                               FIXLEN=06))),
          IFTHEN=(WHEN=INIT,
                   PARSE=(%03=(STARTAT=C'HOFG4',
                               ABSPOS=1,
                               FIXLEN=06))),
          IFTHEN=(WHEN=INIT,
                   PARSE=(%04=(STARTAT=C'KIPL9',
                               ABSPOS=1,
                               FIXLEN=06))),
          IFTHEN=(WHEN=INIT,
                   PARSE=(%05=(STARTAT=C'MANS3',
                               ABSPOS=1,
                               FIXLEN=06))),
          IFTHEN=(WHEN=INIT,
                   PARSE=(%06=(STARTAT=C'MARG1',
                               ABSPOS=1,
                               FIXLEN=06))),
          IFTHEN=(WHEN=INIT,
                   PARSE=(%07=(STARTAT=C'OLIV2',
                               ABSPOS=1,
                               FIXLEN=06))),
          IFTHEN=(WHEN=INIT,
                   PARSE=(%08=(STARTAT=C'SELI5',
                               ABSPOS=1,
                               FIXLEN=06))),
          IFTHEN=(WHEN=INIT,
                   BUILD=(%01,
                          %02,
                          %03,
                          %04,
                          %05,
                          %06,
                          %07,
                          %08))
//SORTIN   DD *
MARG1 DATA1 MANS3 SELI5
MANS3 SELI5 MARG1
SELI5 MARG1 DATA1
FINP6 MANS3 HOFG4 MARG1 KIPL9 OLIV2
MANS3 SELI5


With STARTAT, if the parsed field is not found, that is the end of the PARSE. So, since some values are missing, so won't be found, there have to be eight PARSEs.

Then just BUILD the eight values.

Output is:

Code:
DATA1                   MANS3 MARG1       SELI5
                        MANS3 MARG1       SELI5
DATA1                         MARG1       SELI5
      FINP6 HOFG4 KIPL9 MANS3 MARG1 OLIV2     
                        MANS3             SELI5
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jan 23, 2014 4:37 am    Post subject: Reply to: Sparse data in ascending order
Reply with quote

Bill,

I guess OP wanted to perform a horizontal Sort for a set of variables. It can be any value not necessarily a fixed value.

Something like this

Code:

AA1       DR1       BW9
CC3       AA2       EW9
BW7       DR1       AA3
AA1       CC3       BW9
EW9       TY1       CC3
BW9       DR7       FE8
AA1       CC3       BW9
AA1       CC3       DR1
AB1       EW9       BW9


The desired output is

Code:

AA1       BW9       DR1
AA2       CC3       EW9
AA3       BW7       DR1
AA1       BW9       CC3
CC3       EW9       TY1
BW9       DR7       FE8
AA1       BW9       CC3
AA1       CC3       DR1
AB1       BW9       EW9
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Jan 23, 2014 5:26 am    Post subject: Reply to: Sparse data in ascending order
Reply with quote

Well, we never got anything exact, but the desire was for the different values to appear in separate columns. I just thought it looked like fun :-)
Back to top
View user's profile Send private message
Pandora-Box

Moderator


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

PostPosted: Thu Jan 23, 2014 9:48 am    Post subject:
Reply with quote

Also I believe OP wanted a Syncsort solution
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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


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