View previous topic :: View next topic
|
Author |
Message |
saikarthik94
New User
Joined: 04 Sep 2019 Posts: 12 Location: India
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Use DFSORT GROUP and PUSH and include only what is being PUSHed. On the way out. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
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 |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
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 |
|
|
saikarthik94
New User
Joined: 04 Sep 2019 Posts: 12 Location: India
|
|
|
|
Hi Rohit and Joerg, Thank you very much. It really worked. Great thanks again
Alos Nic, thanks for the suggestion. |
|
Back to top |
|
|
|