Portal | 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: 2405
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: 2466
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: 2466
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: 309
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 How do i verify the char field is hav... Raghu M N PL/I & Assembler 1 Tue Sep 22, 2020 9:26 pm
No new posts RPLDDDD field for extended VSAM - ESDS amitsjcntl JCL & VSAM 0 Tue Sep 22, 2020 1:45 pm
No new posts Group selective VB records - Trailer ... Premnath_TJ DFSORT/ICETOOL 12 Sun Sep 13, 2020 3:38 am
This topic is locked: you cannot edit posts or make replies. SORT the records based on the second ... Ramsee SYNCSORT 1 Wed Aug 19, 2020 3:01 pm
No new posts to Insert Rows from File1 to File 2 ... Arun_Tupili DFSORT/ICETOOL 1 Thu Aug 13, 2020 6:22 pm

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