Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merging lines

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Merging lines
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: 603
Location: Maryland

PostPosted: Tue Nov 05, 2019 2:04 am    Post subject:
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    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2296
Location: NY,USA

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

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

Active Member


Joined: 29 Apr 2008
Posts: 603
Location: Maryland

PostPosted: Wed Nov 06, 2019 1:26 am    Post subject:
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    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 Split single i/p line into multiple l... elixir1986 DFSORT/ICETOOL 2 Wed Feb 27, 2019 12:47 am
No new posts Reformatting and adding additional fi... Badbeef SYNCSORT 6 Thu Apr 05, 2018 4:45 pm
No new posts write multiple lines in PS file in cobol Balu5491 COBOL Programming 7 Wed Mar 07, 2018 10:27 am
No new posts Merging records, but not all the time prino DFSORT/ICETOOL 17 Sat Feb 17, 2018 4:20 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am

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