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

Confused with nodups


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

New User


Joined: 17 Oct 2007
Posts: 5
Location: Central Illinois

PostPosted: Tue Apr 22, 2008 10:02 pm
Reply with quote

I have 2 copies of one file. File A is yesterday mornings version of the file and File B is current mornings version of the file. Both have LRECL of 224. Key is position 2 for length of 9. I need to keep all records from file B that have a value change in position 71 from an "A" in file A to a "T" in file B. The only time a record should appear in both files is when the value in position 71 has changed to a "T"

File A:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 8666666660100 Mickey Mouse                      820723060814         A0
 8777777770100 Donald Duck                       500924060201         A0
 8888888880100 HUNTSMAN THOMAS                   680731000228         A0
 8999999990100 Goofey Dog                        620805901015         A9


File B :
Code:


----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 8666666660100 Minnie Mouse                      820723060814         T0
 8777777770100 Donald Duck                       500924060201         T0
 8888888880100 HUNTSMAN THOMAS                   680731000228         T0



I expect to find 8888888880100 Huntsman Thomas in file. The output should be that the key position 2 thru 9 is in both records and position 71 has changed from an "A" to a "T".

Here is what I have tried that does not give me what I want:

Code:


//STEP4 EXEC  PGM=ICETOOL                                       
//TOOLMSG DD SYSOUT=*                                           
//DFSMSG DD SYSOUT=*                                           
//*   
//IN1 DD DSN=TADM.yesterdays.file,DISP=SHR                       
//IN2 DD DSN=TADM.todays.file,DISP=SHR                         
//*                 
//T1 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(55,5)),DISP=(MOD,PASS) 
//OUT1 DD DSN=TADM.ISIHR.EXPIRE,UNIT=SYSDA,                     
//      DISP=(,CATLG,CATLG),                                   
//      SPACE=(CYL,(5,2),RLSE)                                 
//TOOLIN DD *                                                   
COPY FROM(IN1) TO(T1) USING(CTL1)                               
COPY FROM(IN2) TO(T1) USING(CTL2)                               
SELECT FROM(T1) TO(OUT1) ON(2,9,BI) NODUPS USING(CTL3)         
//*SELECT FROM(T1) TO(OUT1) ON(2,9,BI) NODUPS USING(CTL3)       
/*                                                             
//CTL1CNTL DD *                                                 
* IN1 -> T1; T1:  ADD '1' ID TO IN1 RECORDS                     
  INREC OVERLAY=(225:C'1')                           
/*                                                   
//CTL2CNTL DD *                                     
* IN2 -> T2; T2:  ADD '2' ID TO IN2 RECORDS         
  INREC OVERLAY=(225:C'2')                           
/*                                                   
//CTL3CNTL DD *                                     
* KEEP ONLY NODUPS RECORDS WITH '2' ID.             
* REMOVE ID.                                         
  OUTFIL FNAMES=OUT1,INCLUDE=(225,1,CH,EQ,C'2'),     
   BUILD=(1,224)                                     
//                                                   



any and all help is appreciated. It has been a couple of years since I have tooled around in DFSORT so it is probably great risk to me that I have things confused.
Back to top
View user's profile Send private message
Tom Huntsman

New User


Joined: 17 Oct 2007
Posts: 5
Location: Central Illinois

PostPosted: Tue Apr 22, 2008 10:07 pm
Reply with quote

I should have said I expect to see two records Donald Duck and Huntsman Thomas in my out put record
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Apr 22, 2008 10:14 pm
Reply with quote

Just what did you see in the output file?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Apr 22, 2008 10:24 pm
Reply with quote

Tom Huntsman,

Quote:

Key is position 2 for length of 9. I need to keep all records from file B that have a value change in position 71 from an "A" in file A to a "T" in file B. The only time a record should appear in both files is when the value in position 71 has changed to a "T"

I expect to find 8888888880100 Huntsman Thomas in file. The output should be that the key position 2 thru 9 is in both records and position 71 has changed from an "A" to a "T".



Why only "8888888880100 Huntsman" Thomas record? Both 8666666660100 MICKEY MOUSE &
8777777770100 DONALD DUCK have a 'T' in file 2 and they have an 'A' in file 1 , so why didn't you pick them?

If your intention is to pick all records from current file which has 'T' and a matching 'A' in yesterday's file, the following DFSORT JCL will give you the desired results.

Concatenate both files to sortin and make sure that the current day file is FIRST in the concatenation list. A brief explanation of the job. We add a +1 in packed decimal format for records initially and we flip that to -1 when the 71st byte is a 'T' and we sort on the key and sum on this additional byte at the end. if there is a matching T record for a record the sum will be zero. We use an Include cond on OUTFIL to inlucde only such records.

Code:

//STEP0100  EXEC  PGM=ICEMAN                                           
//SYSOUT    DD  SYSOUT=*                                               
//SORTIN    DD DSN=your current day file B,disp=shr
//             DSN=Your yesterday day file,disp=shr
//SORTOUT   DD DSN=your output file,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//SYSIN     DD *                                               
  OPTION EQUALS                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(225:X'1C')),               
        IFTHEN=(WHEN=(71,1,CH,EQ,C'T'),OVERLAY=(225:X'1D'))   
                                                             
  SORT FIELDS=(2,9,CH,A)                                     
  SUM FIELDS=(225,1,PD)                                       
  OUTFIL INCLUDE=(225,1,PD,EQ,0),BUILD=(1,224)               
/*                                                           


Hope this helps...

Cheers
Back to top
View user's profile Send private message
Tom Huntsman

New User


Joined: 17 Oct 2007
Posts: 5
Location: Central Illinois

PostPosted: Tue Apr 22, 2008 10:45 pm
Reply with quote

CICS guy --- with that JCL I posted I get all terminated records even if they did not exist in FILE A.

Skolusu ----- I should see all three records as you mentioned I tried to changed the mouse record from Mickey to Minnie but in fact I did not change the Key of 866666666 so yes in fact I should return all three records. I will try the job stream you provided and let you know how it works.

Thank you both for your time and replies.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Apr 22, 2008 11:13 pm
Reply with quote

Just for the record.

Quote:
with that JCL I posted I get all terminated records even if they did not exist in FILE A.


I don't see how you would get all of the file2 records in OUT1, if that's what you're saying here.

The way you set it up, you are doing a NODUPS on position 2-9. All of the records have matches on 2-9 except for the Goofey Dog record, so that's the only record without a duplicate and the only one SELECT would output with NODUPS. Since that record is from file1, you then remove it with the OUTFIL statement, so you'd end up with no records in OUT1. That's what I got when I used your job and input with DFSORT's ICETOOL.
Back to top
View user's profile Send private message
Tom Huntsman

New User


Joined: 17 Oct 2007
Posts: 5
Location: Central Illinois

PostPosted: Tue Apr 22, 2008 11:27 pm
Reply with quote

Frank and CICS Guy

I apologize. I have confused my self with having to change data before posting for Confidentiality reasons. I am sure that what Frank states is true the data that I have in my real issue is more convoluted than the four records of examples I came up with and in my haste I had forgotten that I at one time utilized a different file trying to figure out a solution and that is where I got records from both files in my output. That trial was a poor one and will not be shown here. sorry about the misinformation.
Back to top
View user's profile Send private message
Tom Huntsman

New User


Joined: 17 Oct 2007
Posts: 5
Location: Central Illinois

PostPosted: Wed Apr 23, 2008 12:18 am
Reply with quote

kolusu

I have ran the files thru your job stream and from all tests I have done it appears to have worked like I needed it to work. Thank you for your assistance.
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

 


Similar Topics
Topic Forum Replies
No new posts Write out NODUPS but just from one file DFSORT/ICETOOL 8
No new posts confused about SUM function DFSORT/ICETOOL 11
No new posts Being confused by merge performance DFSORT/ICETOOL 5
No new posts Confused with "value is" cl... COBOL Programming 2
No new posts Confused! Whether the problem is with... COBOL Programming 8
Search our Forums:

Back to Top