View previous topic :: View next topic
|
Author |
Message |
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
If "4444" is occurred at first time in input file then the record number should be taken and copy to entire records to output file. I am planning to write a dfsort can you you please help me.
Input File
1111
2222
3333
4444
5555
4444
6666
7777
.....
......
1000000
Output File
4444
5555
4444
6666
7777
.....
......
1000000 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Fixed-length records or variable. That determines where you extend your data. IFTHEN=(WHEN=GROUP with BEGIN for your 4s value. OUTFIL INCLUDE= for the 4s (you only acttually need to PUSH one byte) and then BUILD to drop off the extended data. |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Its a fixed file. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It wasn't actually a question (no question-mark). It was telling you how to determine where to extend your record. I think I've given you everything you need, Have a crack at it at least. If you get stuck, come back. |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
INREC IFTHEN=(WHEN=INIT,OVERLAY=(89:1,2)),
IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444'),
PUSH=(81:ID=8))
SORT FIELDS=COPY
OUTREC BUILD=(1,80)
As suggesed,I am trying this query but I am getting all the records to ouput fie but I need get only the below records
Output File
4444
5555
4444
6666
7777
.....
.....
.....
Please check this and let me know your ideas on this |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
I think this is what Bill meant...pls see code below
Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444'),PUSH=(81:ID=1))
OUTFIL INCLUDE=(81,1,CH,GT,C' '),BUILD=(1,80)
|
Thanks,
Ashwin. |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Thanks Ashwin. I tried testing your sort card but above sort card also but I am getting the entire input records. Sequence # is not starting on C'4444' the records (i.e 4th record). I think something we have to modify this sort card |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have to post what you are using. I'd have done it slightly differently (PUSHed the first byte of the key, and then checked for equal to '4') but I can't see that Ashwin's control cards wouldn't work. |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
I am testing the below sort card but this sort is not filtering any records. I am getting entire input records to output file.
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444')),
PUSH=(81:ID=8))
OUTFIL INCLUDE=(81,8,ZD,GT,00000000),BUILD=(1,80) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Humour me. Run the following, post the test results and the full sysout from the step.
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444')),
PUSH=(81:ID=8))
OUTFIL INCLUDE=(81,8,ZD,GT,00000000),BUILD=(1,40,81,8)
|
Then try this:
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444')),
PUSH=(81:1,1))
OUTFIL INCLUDE=(81,1,CH,EQ,C'4'),BUILD=(1,80) |
|
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Thanks a lot. Its working fine.
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,4,CH,EQ,C'4444')),
PUSH=(81:ID=8))
OUTFIL INCLUDE=(81,8,ZD,GT,00000000),BUILD=(1,40,81,8) |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Did you try the other solution suggested by Bill? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The first wasn't a suggested solution, just an attempt to show what was happening...
How the output can be considered correct, I have no clue :-) |
|
Back to top |
|
|
|