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: 2312
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: 2343
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: 2343
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: 147
Location: 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 Include Group record based on detail ... guptae DFSORT/ICETOOL 11 Thu Mar 12, 2020 1:54 pm
No new posts Compare 2 records of the same PS file... Twinkle22 COBOL Programming 10 Fri Jan 31, 2020 3:25 pm
No new posts Include current & next records if... Manny Rizal DFSORT/ICETOOL 22 Mon Dec 30, 2019 9:14 am
No new posts Extract data from n DB2 Views automat... esmeraldo All Other Mainframe Topics 5 Wed Nov 13, 2019 12:32 am
No new posts Syncsort for field to field comparision Deepti_R SYNCSORT 3 Thu Nov 07, 2019 11:04 pm

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