IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can this be done with DFSORT?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Apr 23, 2015 11:26 am
Reply with quote

Hi Bill,

I found my mistake. icon_redface.gif

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. icon_smile.gif

I'll perform some more tests today.

Thanks again,
Claes
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Apr 23, 2015 11:46 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 23, 2015 11:59 am
Reply with quote

Yes. I get the same. Looking.
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Apr 23, 2015 1:04 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 23, 2015 2:16 pm
Reply with quote

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
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Apr 23, 2015 2:26 pm
Reply with quote

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
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Apr 23, 2015 2:40 pm
Reply with quote

I think you nailed it, Bill! icon_biggrin.gif
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Apr 23, 2015 9:16 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 23, 2015 10:10 pm
Reply with quote

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
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Apr 23, 2015 11:31 pm
Reply with quote

@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
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Apr 23, 2015 11:34 pm
Reply with quote

RahulG, I will for sure test your solution and compare it to Bill's tomorrow. icon_smile.gif
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Fri Apr 24, 2015 4:28 pm
Reply with quote

RahulG, where is the code for step 1? I'm confused.. icon_question.gif
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Apr 24, 2015 6:26 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page Previous  1, 2

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top