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

Sparse data in ascending order


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bill Woodger

Moderator Emeritus


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

PostPosted: Thu Jan 23, 2014 2:25 am
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
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

Moderator Emeritus


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

PostPosted: Thu Jan 23, 2014 5:26 am
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

Global Moderator


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

PostPosted: Thu Jan 23, 2014 9:48 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts View GDG data which is copied from a ... JCL & VSAM 2
No new posts JCL (SET) variables in input stream data JCL & VSAM 0
No new posts Issues with outrec overlay while extr... SYNCSORT 7
No new posts compare two file to find position/dat... SYNCSORT 2
No new posts Secondary index error while loading d... IMS DB/DC 2
Search our Forums:

Back to Top