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

syncsort: copy lines after the keyword


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

New User


Joined: 13 Mar 2014
Posts: 31
Location: USA

PostPosted: Fri Dec 02, 2016 9:47 am
Reply with quote

I have a flat file and I need to copy few lines from it to another PS file.
I need to search for some words like "XYZ Report" and then copy next 10 lines after it to the other PS file.
Please suggest how this can be done
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Dec 02, 2016 9:36 pm
Reply with quote

So, you mean, you need to copy a 'GROUP' of 'RECORDS' to another data set.

I think this should be a suggestion good enough.

.
Back to top
View user's profile Send private message
shreya19

New User


Joined: 13 Mar 2014
Posts: 31
Location: USA

PostPosted: Mon Dec 05, 2016 12:38 pm
Reply with quote

Thanks, I got that working icon_smile.gif

Now, if I want to copy a group the begins with 'AB' at 1st position and should end when another 'AB' is found at 1st position.
and 5th row has a word "XYZ" at 10th column.
Can this be achieved? Any hints will be of help.
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: Mon Dec 05, 2016 2:31 pm
Reply with quote

Update a sequence number when it is AB, use KEYBEGIN.

If you get stuck, post what code you have, representative sample input, expected output and what you get.
Back to top
View user's profile Send private message
shreya19

New User


Joined: 13 Mar 2014
Posts: 31
Location: USA

PostPosted: Tue Dec 06, 2016 9:36 am
Reply with quote

I got the below sequence numbers assigned using the code

Code:
SORT FIELDS=COPY                           
OUTREC IFTHEN=(WHEN=GROUP,                 
             BEGIN=(1,2,CH,EQ,C'AB'),     
             PUSH=(31:ID=1))               
OUTFIL BUILD=(1,30)


Code:
AB                        1
Group data 1         1
Group data 1 ABC  1
Group data 1         1
Group data 1         1

AB                        2
Group data 2         2
Group data 2         2
Group data 2         2
Group data 2         2


Now I want to display only those groups having ABC at (14,3) on any of the rows.
Stuck on how to get this done.

Code'd
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: Tue Dec 06, 2016 3:36 pm
Reply with quote

No you can identify the different groups which start with AB, yes?
Back to top
View user's profile Send private message
shreya19

New User


Joined: 13 Mar 2014
Posts: 31
Location: USA

PostPosted: Tue Dec 06, 2016 3:57 pm
Reply with quote

yes, I got the sequence numbers assigned as above.
stuck at the next step
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Wed Dec 07, 2016 2:26 am
Reply with quote

Is the number of rows for a group is always four as shown in example,

If yes then you can use RESIZE to make all four records into one record and have an outfil include condition assuming your LRECL=50, then 50 * 4 (1,200,SS,EQ,C'ABC') and use '/' symbol to split the record back to multiple rows.

If the number of the rows are not fixed, then you may use joinkeys having the same input file in JNF1 and JNF2.
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 SYNCSORT/ICETOOL JOINKEYS SORT Statem... DFSORT/ICETOOL 13
No new posts Extract 2 more lines below line that ... DFSORT/ICETOOL 2
No new posts Syncsort- Merging two records into on... SYNCSORT 3
No new posts exclude the 5 first lines for compare... TSO/ISPF 2
This topic is locked: you cannot edit posts or make replies. include and copy COBOL Programming 4
Search our Forums:

Back to Top