MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with ICETOOL Compare files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Wed Dec 14, 2005 9:20 am    Post subject: Problem with ICETOOL Compare files Reply with quote

I have a job which used to work,with Frank's help, and now it does not after I made some changes. This job actually saves me a lot of programming, so I want to make this work. Input and output files have LRECL=5000 and FB, I have 3 keys and have the following positions in my file ADFLAG (pos 98,32),ADJID (164,32) The Amount can be upto 25 bytes and not 8 as shown in the job and the keys can be maximum 32 bytes

Note:
------
A STATUSID of SETTLED in file2 should always produce a second record
with a STATUSID of BOOKED

Rule 3,5 and 6 works with the below job. I am going in circles trying to fix the other rules.


FILE1
Code:


AMOUNT   ADJFLAG   EVMADJID   STATUSID      Rule
----------------------------------------------------
2000       N     10002       OPEN            1
3000       N     10002       OPEN            2
1500       N     10002       OPEN            3
4500       N     20002       OPEN            4
300        N     10002       BOOKED          5
300        N     10002       BOOKED          6
100        N     3100A       OPEN            7
 



FILE2
Code:

AMOUNT   ADJFLAG   EVMADJID   STATUSID         Rule
--------------------------------------------------------
2000        N      10002     OPEN            1
3000        N      10002A    OPEN            2
1500        N      10002     BOOKED          3
4500        N      20002     SETTLED         4
300         N      10002     SETTLED         5
250         N      10002     SETTLED         6
900         N      67182     SETTLED         7



My Job
Code:

//IN1 DD  DISP=SHR,DSN=FILE1
//IN2 DD  DISP=SHR,DSN=FILE2
//T1   DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DISP=(,CATLG),LRECL=5000,RECFM=FB,                     
//          DATACLAS=FILEFE,UNIT=SYSDA,                         
//          DSN=OUT.FILE
//TOOLIN DD *                                                   
  COPY FROM(IN1) TO(T1) USING(CTL1)                             
     COPY FROM(IN2) TO(T1) USING(CTL2)                         
     SPLICE FROM(T1) TO(OUT) ON(98,32,CH) ON(164,32,CH) -       
     WITH(5001,5000) KEEPNODUPS USING(CTL3) 
/*                                                         
//CTL1CNTL DD *                                             
  OUTREC FIELDS=(1,8,SFF,TO=FS,LENGTH=8,9,4992,10000:X)     
/*                                                         
//CTL2CNTL DD *                                             
  OUTREC FIELDS=(98:98,32,164:164,32,                       
    5001:1,8,SFF,TO=FS,LENGTH=8,9,4992)                     
/*                                                         
//CTL3CNTL DD *         
OUTFIL FNAMES=OUT,IFOUTLEN=5000,                                   
  IFTHEN=(WHEN=(5230,32,CH,EQ,C'SETTLED',AND,1,8,FS,EQ,5001,8,FS), 
     BUILD=(1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,4992)),     
  IFTHEN=(WHEN=(5230,32,CH,EQ,C'SETTLED',AND,1,8,FS,NE,5001,8,FS), 
     BUILD=(1:1,8,FS,MUL,-1,EDIT=(SIIIT.TT),SIGNS=(,-),9,4992,/,   
            1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,4992,/,     
            1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,221,       
              C'BOOKED',262:5262,4739)),                           
  IFTHEN=(WHEN=(5001,8,CH,EQ,C' '),                                 
    BUILD=(1:1,8,FS,MUL,-1,EDIT=(SIIIT.TT),SIGNS=(,-),9,4992)),     
      IFTHEN=(WHEN=(1,8,CH,EQ,C' '),                               
         BUILD=(1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,4992)),
      IFTHEN=(WHEN=NONE,                                           
         BUILD=(1:1,8,FS,MUL,-1,EDIT=(SIIIT.TT),SIGNS=(,-),9,4992,/,
                1:5001,8,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5009,4992))                                                         



Expected in out file.
-----------------------
Code:

AMOUNT   ADJFLAG  EVMADJID          STATUSID     Rules/ Comments
-----------------------------------------------------------------------------
 duplicate do nothing                              1                         

3000       N          10002A           OPEN       2, key not in file1

-1500       N         10002          OPEN      3 
1500        N         10002          BOOKED    3

-4500      N         20002           OPEN       4
4500       N         20002           SETTLED    4
4500       N         20002           BOOKED     4
 
300         N         10002          SETTLED     5  Only SETTLED as -300 BOOKED and 300 BOOKED = 0

-300        N         10002         BOOKED      6
250         N         10002         SETTLED     6
250         N         10002         BOOKED      6

900         N         67182         SETTLED     7  keys are different only record from file2 and a BOOKED
900         N        67812          BOOKED      7 
 
 
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Dec 14, 2005 11:00 am    Post subject: Reply with quote

Quote:
Rule 3,5 and 6 works with the below job. I am going in circles trying to fix the other rules.


You haven't said what the rules are.

I don't know how you expect anyone to help you with this based on the limited information you've given in this post.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Wed Dec 14, 2005 1:29 pm    Post subject: Reply with quote

I know it is difficult to help without any proper specifications. I hope I got
it right this time.
What I am trying to do is compare file1 with file2, and produce an output
file based on the rules mentioned below

File1

Code:

AMOUNT   ADJFLAG   EVMADJID   STATUSID       
----------------------------------------------------
2000       N     10002       OPEN            1
3000       N     10002       OPEN            2
1500       N     10002       OPEN            3
4500       N     20002       OPEN            4
300        N     10002       BOOKED          5
300        N     10002       BOOKED          6
100        N     3100A       OPEN            7
 


File 2

Code:

AMOUNT   ADJFLAG   EVMADJID   STATUSID         
------------------------------------------------------
2000        N      10002     OPEN            1
3000        N      10002A    OPEN            2
1500        N      10002     BOOKED          3
4500        N      20002     SETTLED         4
300         N      10002     SETTLED         5
250         N      10002     SETTLED         6
900         N      67182     SETTLED         7
 


Rules:
-------
1). File1 and File2 same keys, Amount and status duplicate, nothing in
out file
2). File2 record not found in file1, so file2 record in out file
3). File1 and file2 have the same keys but with a status of OPEN in File1
and BOOKED in file2. Out file should have the file1 record with the
Amount reversed and the record from file2. (This rule works with my
job)
4). File1 and file2 have the same keys but with a Status of OPEN in file1
and SETTLED in file2. Out file should have the record from file1 with
the Amount reversed,record from file2 with status SETTLED, and again
the record from file2 but now with the Status BOOKED. A status of
SETTLED in file2 should always produce another record with status
BOOKED.
5). File1 and file2 have the same keys but with a Status of BOOKED in
file1 and SETTLED in file2 and with the same Amount. Out file should
have the record from file1 with the Amount reversed, record from
file2 with status SETTLED, and again the record from file2 but now
with the Status BOOKED.
If the reversed amount from file1, and the amount from file2 with
the same status = 0, in this case only SETTLED record from file2
in out file.
(This rule works with my job)

6).File1 and file2 have the same keys but with a Status of BOOKED in
file1 and SETTLED in file2 and with different Amount. Out file should
have the record from file1 with the Amount reversed, record from
file2 with SETTLED and and again the record from file2 but now
with the Status BOOKED. (This rule works with my job)
7). Since the keys are different only record from file2 in out file and since
it's SETTLED status in file2,generate another record with the Status
BOOKED

My job produces the proper results for rules 3,5 and 6. I am having difficulties with the other rules. Rule1 for example, should'nt KEEPNODUPS remove duplicate records?
Here is what the out file should look based on the above example files
and rules

Code:


AMOUNT   ADJFLAG  EVMADJID          STATUSID     Rules/ Comments
-----------------------------------------------------------------------------
 duplicate do nothing                              1                         

3000       N          10002A           OPEN       2, key not in file1

-1500       N         10002          OPEN      3 
1500        N         10002          BOOKED    3

-4500      N         20002           OPEN       4
4500       N         20002           SETTLED    4
4500       N         20002           BOOKED     4
 
300         N         10002          SETTLED     5  Only SETTLED (-300 +300 = 0) 

-300        N         10002         BOOKED      6
250         N         10002         SETTLED     6
250         N         10002         BOOKED      6

900         N         67182         SETTLED     7 
900         N        67812          BOOKED      7 
 
 
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Dec 14, 2005 3:42 pm    Post subject: Reply with quote

Sorry, I won't have time to look at this for a while. I'm in the middle of packing to move to a new site and I'll be on vacation for the next two weeks. If I get a chance, I'll take a look, but no promises. Maybe somebody else can help.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Thu Dec 15, 2005 9:37 am    Post subject: Reply with quote

Just enjoy your vacation Frank, you can take a look at it after you get back.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Dec 15, 2005 7:53 pm    Post subject: Reply with quote

Started looking at this but couldn't figure out the positions and lengths of some fields and some other stuff.

Please list the position and length of:

AMOUNT
ADJFLAG
EVMADJID
STATUSID

Are all of the starting positions the same in FILE1 and FILE2?

Quote:
Rule1 for example, should'nt KEEPNODUPS remove duplicate records?


KEEPNODUPS says you want to keep any records that don't have a match. Without KEEPNODUPS, the non-matching records are deleted. For matching records (dups), the base and overlay records are spliced together according to the parameters you specify (ON, WITHALL, WITHEACH, WITH).

You say "I have 3 keys". Which fields are the 3 keys?

You say "File1 and File2 same keys, Amount and status duplicate". How does this correspond to the 3 keys? If Amount and status are not keys, then there would only be 2 fields left as keys. If Amount or status is one of the keys, why did you say same keys and then list those two?

How do these rules relate to the rules you had for the original job I gave you? What's different this time?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Fri Dec 16, 2005 2:12 am    Post subject: Reply with quote

Position and length
----------------------
AMOUNT 1,25
ADJFLAG 98,32
EVMADJID 164,32
STATUSID 230,32

- The positions are the same in File1 and File2.
- I have 2 keys(ADJFLAG and EVMADJID) and not 3 keys. I meant to write 2 keys.

In the original job ,Rule 4 and 7 were not tested , when file1 had a OPEN
status and file2 with SETTLED. I tried to modify my job to get rule1,2,4 and 7 to work, but I did not get the expected result,so I had to ask for help. What is different is that the Amount is now 25 bytes (1,25). I was testing with 8 bytes Amount, trying to get all my rules to work and later
adapt my job for 25 bytes Amount.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Dec 16, 2005 12:13 pm    Post subject: Reply with quote

I just realized that you have duplicate keys in each file (10002). SPLICE is not going to be able to tell which of these keys in file1 matches up with which of these keys in file2 unless you also want to match up the record numbers (e.g. file1 record 1 with file2 record 1, file1 record 2 with file2 record 2, etc), so you'd essentially have the record number as the first key. Is that what you want?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Sat Dec 17, 2005 4:59 am    Post subject: Reply with quote

Using record number as the key is not really what I want as the records to be spliced will not be in the same order in the files
I tried testing rule1 with just 1 record each, in file1 and file2 like below
Code:

AMOUNT   ADJFLAG   EVMADJID   STATUSID       
----------------------------------------------------
2000     N         10002         OPEN          (file1)
2000     N         10002         OPEN          (file2)



and I got the follwing result in my out file,and I do not want anything in the out file (duplicates)

Code:

AMOUNT   ADJFLAG   EVMADJID   STATUSID       
----------------------------------------------------
-2000     N         10002         OPEN        (from file1)
 2000     N         10002         OPEN        (from file2)


Since the keys match,should'nt KEEPNODUPS remove the records?
Frank, I really don't feel very comfortable bothering you,when you are on vacation. I am grateful that,you still find the time to look into this problem. I could also wait till you get back.
Thanks again
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Dec 17, 2005 11:28 am    Post subject: Reply with quote

Does each file have duplicate records within it as shown in your previous example (e.g. several records in each file with N/10002)? If so, and you're not matching record-by-record, then you won't be able to use SPLICE to do what you want because it can't tell which dup in file1 is supposed to match up with which dup in file2.

Quote:
Since the keys match,should'nt KEEPNODUPS remove the records?


KEEPNODUPS keeps records without a match - it doesn't remove any records. A record is removed when two records that match are SPLICEd together.

DFSORT's SPLICE is fully described online here:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/6.13?DT=20050222160456

So you can read for yourself what each of the SPLICE parameters does.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Mon Dec 19, 2005 8:21 am    Post subject: Reply with quote

The keys will be unique in each file. My examples(rules) are all individual test cases,I find is easier to test it this way. That is the reason for duplicate keys.
The rules 3,4,5,6 work when the keys are the same but fails when the keys in file2 are different than File1. If the keys in file2 are not found in file1, then only the, file2 record should be in out file, an additional record
in out file, if the file2 has a status of SETTLED. This works well in the below
Job.


My job looks like this now with Amount 10 bytes


Code:

//TOOLIN DD *                                                       
   COPY FROM(IN1) TO(T1) USING(CTL1)                                 
      COPY FROM(IN2) TO(T1) USING(CTL2)                               
      SPLICE FROM(T1) TO(OUT) ON(98,32,CH) ON(164,32,CH) -           
      WITH(5001,5000) KEEPNODUPS USING(CTL3)                         
 /*                                                                   
 //CTL1CNTL DD *                                                     
   OUTREC FIELDS=(1,10,SFF,TO=FS,LENGTH=10,11,4989,10000:X)           
 /*                                                                   
 //CTL2CNTL DD *                                                     
   OUTREC FIELDS=(98:98,32,164:164,32,                               
     5001:1,10,SFF,TO=FS,LENGTH=10,11,4989)                           
 /*                                                                   
 //CTL3CNTL DD *                                                     
    OUTFIL FNAMES=OUT,IFOUTLEN=5000, 
*---- for rule 4                               
      IFTHEN=(WHEN=                                                             
           (230,32,CH,EQ,C'OPEN',AND,5230,32,CH,EQ,C'SETTLED'),
            BUILD=(1:1,10,FS,MUL,-1,EDIT=(SIIIT.TT),SIGNS=(,-),11,4989,/,
                1:5001,10,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5011,4989,/, 
                1:5001,10,FS,EDIT=(SIIIT.TT),SIGNS=(,-),5011,219,     
                  C'BOOKED',260:5262,4739)), 
*                       
      IFTHEN=(WHEN=             
          (5230,32,CH,EQ,C'SETTLED',AND,1,10,FS,EQ,5001,10,FS),
           BUILD=(1:5001,10,FS,EDIT=(SIIIIIT.TT),SIGNS=(,-),5011,4989)),   
 
*---> Settled in file2 should always produce a booked record
        IFTHEN=(WHEN=
           (5230,32,CH,EQ,C'SETTLED',AND,1,10,FS,NE,5001,10,FS),
           BUILD=(1:1,10,FS,MUL,-1,EDIT=(SIIIIIT.TT),SIGNS=(,-),11,4989,/,   
          1:5001,10,FS,EDIT=(SIIIIIT.TT),SIGNS=(,-),5011,4989,/,       
          1:5001,10,FS,EDIT=(SIIIIIT.TT),SIGNS=(,-),5011,219,           
             C'BOOKED',262:5262,4739)),       
*                     
        IFTHEN=(WHEN=(5001,10,CH,EQ,C' '),                               
       BUILD=(1:1,10,FS,MUL,-1,EDIT=(SIIIIIT.TT),SIGNS=(,-),11,4989)),   
*
       IFTHEN=(WHEN=(1,10,CH,EQ,C' '),                               
        BUILD=(1:5001,10,FS,EDIT=(SIIIIIT.TT),SIGNS=(,-),5011,4989)),     
*
       IFTHEN=(WHEN=NONE,                                           
         BUILD=(1:1,10,FS,MUL,-1,EDIT=(SIIIIIT.TT),SIGNS=(,-),11,4989,/,   
          1:5001,10,FS,EDIT=(SIIIIIT.TT),SIGNS=(,-),5011,4989))     
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group