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

need do keep only changed data


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

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Fri Jan 02, 2009 7:17 pm
Reply with quote

hi all,

I have one file :

1000 ABC DEF
2000 IJK LMN
3000 ABC EFG
1000 ABC DEF
2000 IJK OPQ
3000 ABC EFG

I want output file with duplicate records on 1,4 and changed data:
2000 OPQ
As 2000 has the same value on 5,3 i don't need IKJ.

Regards,
Back to top
View user's profile Send private message
loverj24

New User


Joined: 05 Jul 2007
Posts: 16
Location: bangalore

PostPosted: Fri Jan 02, 2009 7:36 pm
Reply with quote

Hi Farouck,

Welocme to the forum.

Could you please give us a clear example of what you need, do you need to eliminate duplicates here?
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Fri Jan 02, 2009 7:53 pm
Reply with quote

hi loverj24,

Yes i need to eliminate duplicates records for each but for each line too.

In my sample :
the lines 2000 are not duplicates because the 3th records is not the same

2000 IJK LMN
2000 IJK OPQ

But the second records is the same

Then i wants: 2000 OPQ
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: Fri Jan 02, 2009 8:41 pm
Reply with quote

Your description is still unclear and confusing.

Quote:
3th records


You mean the "3rd value" - right?

Quote:
But the second records is the same


You mean the "second value" - right?

Please try to use the correct terminology to avoid confusion.

Quote:
As 2000 has the same value on 5,3 i don't need IKJ.


In your example, it looks like IKJ is at 6,3, not 5,3. Is there actually a blank between the fields or not?

What is the RECFM and LRECL of the input file? What is the starting position and length of each of the three fields?

A better example with more variations would help. For example, what do you expect for output with the following input records and why (assume the values for the three fields are in the correct positions)?

Code:

1000 ABC DEF
2000 IJK LMN
3000 ABC EFG
4000 XYZ ABC
5000 ABC DEF
1000 ABC DEF
2000 IJK OPQ
3000 ABC EFG
4000 MNO ABC
5000 CDE TUX
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Fri Jan 02, 2009 8:53 pm
Reply with quote

hi frank,
I' m sorry if i don't be clear.

for this sample i wants :

Code:

2000     LMN
4000 XYZ
5000 ABC DEF


LRECL=23
RECFM=FB
First field on 1 to 4
second field on 6 to 8
third field on 10 to 12
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Jan 02, 2009 9:55 pm
Reply with quote

farouck,

Do you have always 2 duplicate key records? Or the number can vary?

For e.g, Is the following input possible? If yes, what would be the output for that. Let me know if I got this wrong.
Code:
1000 ABC DEF
2000 IJK LMN
3000 ABC EFG
2000 IJK OPQ
3000 ABC EFG
2000 IJK STU
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Fri Jan 02, 2009 10:02 pm
Reply with quote

hi Arcvns,

i have always 2 duplicate keys for the first records (not more).
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: Fri Jan 02, 2009 10:48 pm
Reply with quote

Here's a DFSORT job that will do what you asked for. You'll need z/OS PTF UK90013 (July, 2008) to use DFSORT's new WHEN=GROUP function. If you don't have that PTF, ask your System Programmer to install it (it's free).

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=..  input file (FB/23)
//SORTOUT DD DSN=...  output file (FB/23)
//SYSIN    DD    *
  OPTION EQUALS
  SORT FIELDS=(1,4,CH,A)
  OUTREC IFTHEN=(WHEN=INIT,
     BUILD=(1,4,24:SEQNUM,1,ZD,RESTART=(1,4),32:6,7)),
    IFTHEN=(WHEN=GROUP,BEGIN=(24,1,CH,EQ,C'1'),
      PUSH=(25:32,7))
  OUTFIL INCLUDE=(24,1,CH,EQ,C'2',AND,25,7,CH,NE,32,7,CH),
    IFOUTLEN=23,
    IFTHEN=(WHEN=(25,3,CH,NE,32,3,CH),OVERLAY=(6:25,3),HIT=NEXT),
    IFTHEN=(WHEN=(29,3,CH,NE,36,3,CH),OVERLAY=(10:29,3))
/*


For complete details on the DFSORT's new WHEN=GROUP function and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Mon Jan 05, 2009 8:03 pm
Reply with quote

Thanks you for the jcl, but this ptf is not applied.
I 'll take here with the next refresh in march.

Did you have the same jcl without Group.

Regards,
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: Mon Jan 05, 2009 11:50 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you want without WHEN=GROUP. Note that this job is less efficient than the WHEN=GROUP job.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=..  input file (FB/23)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/23)
//TOOLIN  DD    *
SORT FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(T1) TO(OUT) ON(1,4,CH) WITH(32,7) USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(1,4,CH,A)
  OUTREC IFOUTLEN=38,
    IFTHEN=(WHEN=INIT,
     OVERLAY=(24:SEQNUM,1,ZD,RESTART=(1,4))),
    IFTHEN=(WHEN=(24,1,CH,EQ,C'1'),
      BUILD=(1,4,25:6,7)),
    IFTHEN=(WHEN=NONE,
      BUILD=(1,4,32:6,7))
/*
//CTL2CNTL DD *
  OPTION COPY
  OUTFIL FNAMES=OUT,
    INCLUDE=(25,7,CH,NE,32,7,CH),
    IFOUTLEN=23,
    IFTHEN=(WHEN=(25,3,CH,NE,32,3,CH),OVERLAY=(6:25,3),HIT=NEXT),
    IFTHEN=(WHEN=(29,3,CH,NE,36,3,CH),OVERLAY=(10:29,3))
/*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Jan 06, 2009 11:05 am
Reply with quote

May be I am missing something here. In his first post the OP said he needed the fields from the modified records. But in his latest post, the required output has the initial values when a mismatch is found. icon_rolleyes.gif
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Tue Jan 06, 2009 6:40 pm
Reply with quote

For me it is the same, because i merge two files, the first value can be the modified value or the initial value.

Thanks a lot at franck for the solution.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Jan 06, 2009 6:56 pm
Reply with quote

Quote:
For me it is the same
I m sorry, still I am not clear.icon_sad.gif Consider the sample input posted by Frank. Are you saying that the below output is also acceptable?
Code:

2000     OPQ
4000 MNO
5000 CDE TUX
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Tue Jan 06, 2009 7:27 pm
Reply with quote

With the sample and the jcl of franck my output is :

Code:

2000     LMN               
4000 XYZ                   
5000 ABC DEF         


But you are right, i changed the desired resultat in comparison with the beginning.

To have this ouput or your ouput is same for me because i can order the file as i wants.

I'm clear?

Lionel
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 Jan 06, 2009 9:33 pm
Reply with quote

So to be clear, my job gives you the output you want - right?
Back to top
View user's profile Send private message
farouck

New User


Joined: 12 Apr 2006
Posts: 18
Location: France

PostPosted: Tue Jan 06, 2009 9:45 pm
Reply with quote

yes, your job is ok for me.

Thanks,
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 Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top