|
View previous topic :: View next topic
|
| Author |
Message |
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
Hi Bill,
I found my mistake.
I couldn't find your definition for AN-ODD-NUMBER and AN-EVEN-NUMBER, so I guessed - but guessed wrong. Now I get the same result as you do.
I'll perform some more tests today.
Thanks again,
Claes |
|
| Back to top |
|
 |
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
Hi Bill,
I'm sorry, but there seems to be an issue more. Giving this input:
| Code: |
00000024 001
00000024 002
00000024 003
00000024 006
00000024 007
00000024 008
00000024 009
00000024 010
00000024 011
00000024 012
00000024 013
00000024 014
00000024 015
00000024 016
00000024 017
00000024 018
00000024 020
00000024 021
00000024 023
00000024 024
00000024 025
00000024 026
00000024 027
00000024 028
00000024 029
00000024 031
00000024 033
|
I get this:
| Code: |
STREETCODE HOUSE-FR HOUSE-TO EVEN/ODD
00000024 001 003 O
00000024 001 017 O <== 7-17 expected
00000024 021 033 O
00000024 002 002 E
00000024 002 020 E <=== 6-20 expected
00000024 024 028 E
|
Can you please verify you get the same?
/Claes |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Yes. I get the same. Looking. |
|
| Back to top |
|
 |
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
| Bill Woodger wrote: |
| That "lrecl" is a nice thing. I can' do that, as I don't have DFSORT 2.1, which greatly extended the places where a symbol could be used. It adds one unnecessary byte, but a small price to pay in this type of situation. |
Didn't see this post at first. Yes, I agree. A small price to pay. Would be fantastic if we could have calculations in symbols.. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Claes,
If you add this as the last GROUP in the OUTREC:
| Code: |
IFTHEN=(WHEN=GROUP,
BEGIN=(REFEX-NUMBER-DIFF,
EQ,
DIFFERENCE-OF-TWO,
AND,
(REFEX-LEFT-DIFF,
NE,
DIFFERENCE-OF-TWO,
OR,
REFEX-RIGHT-DIFF,
NE,
DIFFERENCE-OF-TWO)),
PUSH=(REFEX-START-NUMBER:
REFEX-SAVE-F2-NUMBER)), |
|
|
| Back to top |
|
 |
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
Bill, the last comma in your code makes me wonder where to put it exactly, because last group would be right before OUTFIL - thus the comma shouldn't be there?
Edit: got it. |
|
| Back to top |
|
 |
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
I think you nailed it, Bill!  |
|
| Back to top |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
In the mean time, I also worked a little more and got something working. I know it's not the best but I believe it's easier to debug and understand what is being done if you use multiple steps. I know Bill would not agree but that would be me doing it ;-)
1. Identify Even/Odd.
2. ICETOOL Step: Run this step 2 times using Even and Odd file separately. You'll get 2 output files (one from each run):
| Code: |
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
COPY FROM(IN) TO(T2) USING(CTL2)
COPY FROM(T1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(17:SEQNUM,2,ZD))
SORT FIELDS=(17,2,CH,A)
/*
//CTL2CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(17:SEQNUM,2,ZD))
SORT FIELDS=(17,2,CH,A),
SKIPREC=1
/*
//CTL3CNTL DD *
JOINKEYS F1=T1,FIELDS=(17,2,A)
JOINKEYS F2=T2,FIELDS=(17,2,A)
REFORMAT FIELDS=(F1:13,3,
F2:13,3,F1:1,8)
OPTION COPY
|
3. Another ICETOOL using both the files we got from Step 2 and that is it:
| Code: |
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(10,3,CH) FIRST USING(CTL2)
/*
//CTL1CNTL DD *
INREC BUILD=(1,14,15:(4,3,ZD,SUB,1,3,ZD))
OUTREC IFTHEN=(WHEN=(15,15,ZD,GT,2),BUILD=(1,6,3X,10:C'B',X,7,8)),
IFTHEN=(WHEN=(15,15,ZD,EQ,2),BUILD=(1,6,X,8:C'A',3X,7,8))
/*
//CTL2CNTL DD *
INREC IFTHEN=(WHEN=GROUP,
END=(10,1,CH,EQ,C'B'),PUSH=(21:1,3)),
IFTHEN=(WHEN=(10,1,CH,EQ,C'B'),BUILD=(12,8,X,21,3,X,C'-',X,1,3)),
IFTHEN=(WHEN=(8,1,CH,EQ,C'A'),BUILD=(12,8,X,21,3,X,C'-',X,4,3))
SORT FIELDS=(10,3,CH,A,16,3,CH,D)
/*
|
I gave Input as
| Code: |
00000024 001
00000024 002
00000024 003
00000024 006
00000024 007
00000024 008
00000024 009
00000024 010
00000024 011
00000024 012
00000024 013
00000024 014
00000024 015
00000024 016
00000024 017
00000024 018
00000024 020
00000024 021
00000024 023
00000024 024
00000024 025
00000024 026
00000024 027
00000024 028
00000024 029
00000024 031
00000024 033 |
And got OUTPUT as:
| Code: |
00000024 001 - 003
00000024 006 - 020
00000024 007 - 017
00000024 021 - 033
00000024 024 - 028 |
Claes,
Could you please try this one as well with your different Inputs to see if it works? I am just curious to know whether the approach fetched me the right results
. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The required output for that data is:
| Code: |
00000024 001 - 003
00000024 007 - 017
00000024 021 - 033
00000024 006 - 020
00000024 024 - 028 |
Your 2) is a long way round. You can just do a JOINKEYS with JNFnCNTL files. The SKIPREC gives the same effect as starting the sequence from 0/1 for the different files.
Then the point of you running it twice is for the odd and the even. So with the odd/even embedded in the file, it comes back to the JOINKEYS.
Everything in your 3) can be done in the Main Task of a JOINKEYS. So you have the two JNFnCNTLs, the two JOINKEYS, and the Main Task with SORT and OUTREC.
Not sure how that makes it more complicated :-)
Sure, I've had to change mine twice, but that's because I pickled it in the first place... |
|
| Back to top |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
@Bill: When I first looked at your earlier posts, I thought it would be complicated and I would not be able to achieve it. But then, somehow, I got some courage to try more on that to get to the above post of mine.
You have already given the solution but since I had also put some efforts, I want Claes to say it is also working and make me feel happy about it :-)
. |
|
| Back to top |
|
 |
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
RahulG, I will for sure test your solution and compare it to Bill's tomorrow.  |
|
| Back to top |
|
 |
Claes Norreen
Active User
Joined: 20 Dec 2005 Posts: 137 Location: Denmark
|
|
|
|
RahulG, where is the code for step 1? I'm confused..  |
|
| Back to top |
|
 |
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
I thought it was already given earlier, so I skipped it.
Step 1: To identify Even/Odd:
| Code: |
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=EVEN,INCLUDE=(15,1,BI,EQ,B'.......0')
OUTFIL FNAMES=ODD,SAVE
/* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|