IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To extract the records after the first instance of a field.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
saikarthik94

New User


Joined: 04 Sep 2019
Posts: 12
Location: India

PostPosted: Thu Feb 20, 2020 7:00 pm
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: 2454
Location: Hampshire, UK

PostPosted: Thu Feb 20, 2020 7:11 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Feb 21, 2020 7:03 am
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Feb 21, 2020 11:21 pm
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

Senior Member


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

PostPosted: Sat Feb 22, 2020 12:39 am
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: 12
Location: India

PostPosted: Mon Feb 24, 2020 7:27 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Help required to reset decimal points... DFSORT/ICETOOL 10
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts To Omit records based n SORT condition DFSORT/ICETOOL 6
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 5
Search our Forums:

Back to Top