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

Merging lines


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

New User


Joined: 16 Aug 2005
Posts: 53

PostPosted: Mon Nov 04, 2019 10:57 pm
Reply with quote

Good afternoon

I have an input file where the data is grouped.
Would like to bring to discussion any approach to have the data moved to the same line using DFSort.
The amount of lines in each group may vary randomly (200 bytes length max).

I think the main issue is that i don't see a way to use the "RESISE FROM(IN) TO(OUT) TOLEN(200) because the groups of data will vary the amount of lines.

Any ideas please ?

In (FB80)
Code:
    AAAAAAA  Mainframes have high
       availability, one of the
    GGGG  primary reasons for their
       longevity, since they are
    AAAAAAA  typically used in applications
       where downtime would be
       costly or catastrophic.
    GGGG  In the late 1950s, mainframes
       had only a rudimentary
       interactive interface
       (the console), and used sets of ...
       
       
       
       


Out
Code:

    AAAAAAA  Mainframes have high availability, one of the
    GGGG  primary reasons for their longevity, since they are
    AAAAAAA  typically used in applications where downtime would be costly or catastrophic.
    GGGG  In the late 1950s, mainframes had only a rudimentary interactive interface (the console), and used sets of ...
   
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 962
Location: Maryland

PostPosted: Tue Nov 05, 2019 2:04 am
Reply with quote

The operation MERGE in SORT utilities has completely different meaning from what you need.

Please, remove the word MERGE from your post.
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 53

PostPosted: Tue Nov 05, 2019 2:55 am
Reply with quote

what subject do you suggest ?

In addition... any idea to approach the issue ?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2588
Location: NYC,USA

PostPosted: Tue Nov 05, 2019 2:55 am
Reply with quote

Try SPLICE
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 962
Location: Maryland

PostPosted: Wed Nov 06, 2019 1:26 am
Reply with quote

In general, SORT products are not supposed to concatenate multiple records of the same dataset into single record, neither in full, nor in parts.

Using some tricks this can be done, with restrictions.

For instance, if the maximum number of lines concatenated into one single line is limited to a reasonable value, the following approach might work.

Code:
//CONCAT   EXEC PGM=SORT                       
//*                                             
//SYSOUT   DD  SYSOUT=*                         
//*                                             
//SORTIN   DD  *                               
    AAAAAAA  mainframes have high               
       availability, one of the                 
    GGGG  primary reasons for their             
       longevity, since they are               
    AAAAAAA  typically used in applications     
       where downtime would be                 
       costly or catastrophic.                 
    GGGG  in the late 1950s, mainframes         
       had only a rudimentary                   
       interactive interface                   
       (the console), and used sets of ...     
//SORTOUT  DD  SYSOUT=*                         
//*                                             
//SYSIN    DD  *                               
 INREC IFTHEN=(WHEN=GROUP,                     
               BEGIN=(1,7,CH,NE,C' '),         
               PUSH=(1:SEQ=4))                 
*                                               
 SORT FIELDS=COPY                               
*                                               
 OUTREC IFTHEN=(WHEN=GROUP,                     
               BEGIN=(1,4,ZD,EQ,+1),           
               PUSH=(091:5,80)),               
       IFTHEN=(WHEN=GROUP,                     
               BEGIN=(1,4,ZD,EQ,+2),           
               PUSH=(171:5,80)),               
       IFTHEN=(WHEN=GROUP,                     
               BEGIN=(1,4,ZD,EQ,+3),           
               PUSH=(251:5,80)),               
       IFTHEN=(WHEN=GROUP,                     
               BEGIN=(1,4,ZD,EQ,+4),           
               PUSH=(331:5,80)),               
       IFTHEN=(WHEN=GROUP,                     
               BEGIN=(1,4,ZD,EQ,+5),           
               PUSH=(411:5,80)),                             
       IFTHEN=(WHEN=(1,4,ZD,LE,+5),                           
               BUILD=(91,400,SQZ=(SHIFT=LEFT,MID=C' ')))     
*                                                             
 OUTFIL REMOVECC,NODETAIL,                                   
        SECTIONS=(1,8,                                       
        TRAILER3=(1,400))                                     
//*

Code:
********************************* TOP OF DATA **********************************
AAAAAAA mainframes have high availability, one of the                           
GGGG primary reasons for their longevity, since they are                       
AAAAAAA typically used in applications where downtime would be costly or catastr. . . . . . . . . .
GGGG in the late 1950s, mainframes had only a rudimentary interactive interface. . . . . . . . . . . . . . 
******************************** BOTTOM OF DATA ********************************


But this way is a sort of workaround. We know for sure that there is a lot of fish in the sea. For this specific task using REXX code would be much more preferable, and flexible compared to any SORT/ICETOOL... icon_exclaim.gif
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 Remove additional information in SUPE... TSO/ISPF 10
No new posts Merging more than two records DFSORT/ICETOOL 15
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts Join lines with dfsort DFSORT/ICETOOL 5
No new posts using TXT2PDF to colour specific lines All Other Mainframe Topics 3
Search our Forums:

Back to Top