Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1542
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us