Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 23
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: 331
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: 23
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: 7234

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: 23
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: 7234

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: 23
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: 159
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 Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm
No new posts Insert Lines in JCL with Rexx after a... Willy Jensen CLIST & REXX 3 Tue Aug 30, 2016 4:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us