View previous topic :: View next topic
|
Author |
Message |
senthilmurugan
New User
Joined: 19 Feb 2008 Posts: 15 Location: chennai
|
|
|
|
Hi friends,
i want to copy the 'n' records after the master record (only one master record will be there in a file)....
master record can be found a definite value in a particular position....
an example
Code: |
----+----1----+----2----+----3
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 v3 v35`353
12 413r 3 25 456b46
adasfsdf liht2385 ldfdgsdgf
1 ancd 235
2 sample 4235
3 sapl 346
4 wetwe 356
5 wegf 5789
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 sqtgwergyw t
----+----1----+----2----+----3 |
master record is ==> liht2385 in pos 10
i want 5 records after the master record...
likely output is..
Code: |
1 ancd 235
2 sample 4235
3 sapl 346
4 wetwe 356
5 wegf 5789
|
is it possible by default IBM utilities...such as sort, iceman, icetool....etc..?
Thanks in advance friends.... |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Fact considered here is
Quote: |
(only one master record will be there in a file).... |
Also LRECL=80 assumed
Below step will give you required output...
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 v3 v35`353
12 413r 3 25 456b46
adasfsdf liht2385 ldfdgsdgf
1 ancd 235
2 sample 4235
3 sapl 346
4 wetwe 356
5 wegf 5789
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 sqtgwergyw t
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(10,8,CH,EQ,C'liht2385'),
PUSH=(81:SEQ=8))
OUTFIL INCLUDE=(81,8,ZD,GT,1,AND,81,8,ZD,LE,6),BUILD=(1,80)
/*
|
Quote: |
is it possible by default IBM utilities...such as sort, iceman, icetool....etc..?
|
Do you think they are different? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's another way to do it with DFSORT:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 v3 v35`353
12 413r 3 25 456b46
adasfsdf liht2385 ldfdgsdgf
1 ancd 235
2 sample 4235
3 sapl 346
4 wetwe 356
5 wegf 5789
qwfgef dfgdfgsdgdsgf21414
dasfsf qe 124 sqtgwergyw t
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(10,8,CH,EQ,C'liht2385'),
RECORDS=6,PUSH=(81:ID=1))
OUTFIL OMIT=(10,8,CH,EQ,C'liht2385',OR,81,1,CH,EQ,C' '),
BUILD=(1,80)
/*
|
|
|
Back to top |
|
|
senthilmurugan
New User
Joined: 19 Feb 2008 Posts: 15 Location: chennai
|
|
|
|
Thanks a lot BTW sry for the delayed gratitude |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
After reading the reply,
For a moment I thought Frank was back.. |
|
Back to top |
|
|
|
|