Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
To extract the records after the first instance of a field.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
saikarthik94

New User


Joined: 04 Sep 2019
Posts: 5
Location: India

PostPosted: Thu Feb 20, 2020 7:00 pm    Post subject: To extract the records after the first instance of a field.
Reply with quote

Hi, How to extract all the data from the dataset after the first instance of a field?

Eg:
Input:
1 AAAA
1 BBBB
1NAAAA
1 BBBB
1NCCCC

Output Expected:
1NAAAA
1 BBBB
1NCCCC

I have to write all the data after I encounter 'N' in position 2.
Can someone help me ? Please let me know if i need to provide some more details.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2365
Location: Hampshire, UK

PostPosted: Thu Feb 20, 2020 7:11 pm    Post subject: Reply to: To extract the records after the first instance of a field.
Reply with quote

You cannot do this with JCL - JCL tells the OS to execute programs and the resources required.

What have you tried? Have you tried writing a program? Have you tried writing some sort control statements?

Please use the code tags when posting code and data.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2417
Location: NY,USA

PostPosted: Fri Feb 21, 2020 7:03 am    Post subject:
Reply with quote

Use DFSORT GROUP and PUSH and include only what is being PUSHed. On the way out.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2417
Location: NY,USA

PostPosted: Fri Feb 21, 2020 11:21 pm    Post subject:
Reply with quote

Code:
//SORTIN   DD  *                                   
1 AAAA                                             
1 BBBB                                             
1NAAAA                                             
1 BBBB                                             
1NCCCC                                             
//SORTOUT  DD  SYSOUT=*                           
//SYSIN    DD    *                                 
 OPTION COPY                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,1,CH,EQ,C'N'),
          END=(2,1,CH,EQ,C' '),PUSH=(40:ID=3))   
  OUTFIL BUILD=(1,6),INCLUDE=(41,1,CH,NE,C' ')     
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


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

PostPosted: Sat Feb 22, 2020 12:39 am    Post subject:
Reply with quote

The identificator can just be pushed through.
Code:
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,1,CH,EQ,C'N'),PUSH=(40:2,1)) 
  OUTFIL INCLUDE=(40,1,CH,EQ,C'N'),BUILD=(1,6)                   
/*
Back to top
View user's profile Send private message
saikarthik94

New User


Joined: 04 Sep 2019
Posts: 5
Location: India

PostPosted: Mon Feb 24, 2020 7:27 pm    Post subject:
Reply with quote

Hi Rohit and Joerg, Thank you very much. It really worked. Great thanks again icon_smile.gif

Alos Nic, thanks for the suggestion.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem while trying to manipulate re... amitc23 DFSORT/ICETOOL 2 Tue Jun 30, 2020 1:19 pm
No new posts Need to select all records belonging ... Q5P418 DB2 2 Mon Jun 22, 2020 11:34 pm
No new posts How to filter out certain records bas... manugeorge2004 JCL & VSAM 5 Wed Jun 17, 2020 10:05 pm
No new posts Need to delete inactive records from ... Sanchayita Sinha DB2 5 Fri May 29, 2020 10:47 pm
No new posts Need SQL for two latest records havin... Q5P418 DB2 10 Sun May 10, 2020 8:24 am

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