Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
shreya19

New User

Joined: 13 Mar 2014
Posts: 28
Location: USA

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

RahulG31

Active User

Joined: 20 Dec 2014
Posts: 447
Location: USA

 Posted: Fri Dec 02, 2016 9:36 pm    Post subject: Reply to: syncsort: copy lines after the keyword So, you mean, you need to copy a 'GROUP' of 'RECORDS' to another data set. I think this should be a suggestion good enough. .
shreya19

New User

Joined: 13 Mar 2014
Posts: 28
Location: USA

 Posted: Mon Dec 05, 2016 12:38 pm    Post subject: Thanks, I got that working 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.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Mon Dec 05, 2016 2:31 pm    Post subject: Reply to: syncsort: copy lines after the keyword 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.
shreya19

New User

Joined: 13 Mar 2014
Posts: 28
Location: USA

Posted: Tue Dec 06, 2016 9:36 am    Post subject: na

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
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Tue Dec 06, 2016 3:36 pm    Post subject: Reply to: syncsort: copy lines after the keyword No you can identify the different groups which start with AB, yes?
shreya19

New User

Joined: 13 Mar 2014
Posts: 28
Location: USA

 Posted: Tue Dec 06, 2016 3:57 pm    Post subject: yes, I got the sequence numbers assigned as above. stuck at the next step
magesh23586

Active User

Joined: 06 Jul 2009
Posts: 213
Location: Chennai

 Posted: Wed Dec 07, 2016 2:26 am    Post subject: Reply to: syncsort: copy lines after the keyword 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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Copy physical Tape files to a Mainfra... Dadi Krishna Teja JCL & VSAM 11 Thu May 16, 2019 10:25 pm How to copy\replace the members in pr... abdulrafi JCL & VSAM 6 Fri Mar 22, 2019 7:02 pm Copy one file to possible multiple files dibyendumandal11111 SYNCSORT 9 Fri Mar 08, 2019 2:47 am Split single i/p line into multiple l... elixir1986 DFSORT/ICETOOL 2 Wed Feb 27, 2019 12:47 am how to copy a sequential dataset by u... javen777 JCL & VSAM 3 Thu Feb 21, 2019 11:37 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us