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

SORT - To repeat a string in same columns in subsequent line


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
masoomraza

New User


Joined: 17 May 2022
Posts: 4
Location: India

PostPosted: Wed Jul 27, 2022 6:56 pm
Reply with quote

Hi All,

Can anyone please help me with SORT logic to -
- Repeat a given string in a specified column in all subsequent rows until a non-blank text is found in the same column.

Below is my input extract -
Code:

2022/04/11 07:35:36  TSO747C
           07:35:39  TSO747C
           07:41:09  TSO747C
           12:35:58  TSO264C
           12:36:01  TSO264C
2022/04/12 00:03:14  BDEFAULT
           00:03:45  BDEFAULT
           00:05:22  BDEFAULT

I want it to be like -
Code:

2022/04/11 07:35:36  TSO747C
2022/04/11 07:35:39  TSO747C
2022/04/11 07:41:09  TSO747C
2022/04/11 12:35:58  TSO264C
2022/04/11 12:36:01  TSO264C
2022/04/12 00:03:14  BDEFAULT
2022/04/12 00:03:45  BDEFAULT
2022/04/12 00:05:22  BDEFAULT

Can anyone please help me with this?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Wed Jul 27, 2022 7:07 pm
Reply with quote

This forum is supposed to provide with hints, no to provide with a ready-to-copy-and-paste solution code.

The hint: try to use SORT statements parameters -
Code:
 ... IFTHEN=(WHEN=GROUP,
             BEGIN=(...),
             PUSH=(...))


P.S.
In that case you MUST read something from any SORT manual/reference.
Back to top
View user's profile Send private message
masoomraza

New User


Joined: 17 May 2022
Posts: 4
Location: India

PostPosted: Wed Jul 27, 2022 7:43 pm
Reply with quote

Thank you Sir,
Below worked -
Code:

INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,FS,EQ,NUM),PUSH=(1:1,10))
OPTION EQUALS                                               
SORT FIELDS=COPY                                             
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Wed Jul 27, 2022 10:45 pm
Reply with quote

Code:
OPTION COPY,EQUALS
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,NE,C' '),PUSH=(items))
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top