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
 
syncsort: copy lines after the keyword

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
shreya19

New User


Joined: 13 Mar 2014
Posts: 26
Location: USA

PostPosted: Fri Dec 02, 2016 9:47 am    Post subject: syncsort: copy lines after the keyword
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: 444
Location: USA

PostPosted: Fri Dec 02, 2016 9:36 pm    Post subject: Reply to: syncsort: copy lines after the keyword
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: 26
Location: USA

PostPosted: Mon Dec 05, 2016 12:38 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Mon Dec 05, 2016 2:31 pm    Post subject: Reply to: syncsort: copy lines after the keyword
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: 26
Location: USA

PostPosted: Tue Dec 06, 2016 9:36 am    Post subject: na
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Tue Dec 06, 2016 3:36 pm    Post subject: Reply to: syncsort: copy lines after the keyword
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: 26
Location: USA

PostPosted: Tue Dec 06, 2016 3:57 pm    Post subject:
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    Post subject: Reply to: syncsort: copy lines after the keyword
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Anyone know how to copy Unix files? John Poulakos JCL & VSAM 7 Wed Oct 10, 2018 12:57 am
No new posts SYNCSORT keep MIN/MAX record Cloink SYNCSORT 16 Mon Sep 17, 2018 3:00 pm
No new posts Copy records with unknown LRECL oerdgie DFSORT/ICETOOL 8 Tue Jul 24, 2018 7:50 pm
No new posts INCLUDE 2 conditions to copy in the o... Chiku kumar DFSORT/ICETOOL 10 Tue Jul 03, 2018 7:11 pm
No new posts Reformatting and adding additional fi... Badbeef SYNCSORT 6 Thu Apr 05, 2018 4:45 pm

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