ICETOOL - Unique values and the Latest Update of a record

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Shereen
Member
Posts: 2
Joined: Tue Mar 05, 2013 7:53 am

ICETOOL - Unique values and the Latest Update of a record

Post by Shereen » Tue Mar 05, 2013 8:09 am

Hello,

My Requirement contain an input File of FB/80 which has Unique records as wells as records with Duplicates. The output file should contain the records in unsorted format similarly in the input file and the Unique records as wells as the latest update(LASTDUP) should be present.

My Input looks like below :
-------------------------------
A100000001ABCDSEFGDJ
A100000101ABCDTOIYHU
A100000052ABCDSEFGDJ
A100000030ABCDSDWKDL
A100000001ABCD999999
A100000101ABCD111111
A100000052ABCDNBBBBB
A1000000030BCDQQQQQQ
A100000001ABCDDDDDDD
A100000101ABCCCCCCCC
A100000052ABBBBBBBBB
A100000030AAAAAAAAAA

Desired Output would be :

A1000000030BCDQQQQQQ
A100000001ABCDDDDDDD
A100000101ABCCCCCCCC
A100000052ABBBBBBBBB
A100000030AAAAAAAAAA

I tried
//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTIN DD DSN=IN40626.SDW.TEST2,DISP=SHR
//NODUPES DD DSN=IN40626.SDW.TEST3,DISP=SHR
//TOOLIN DD *
SELECT FROM(SORTIN) TO(NODUPES) -
ON(2,10,CH) LASTDUP
/*

The output obtained was :

A100000001ABCDDDDDDD
A100000101ABCCCCCCCC
A100000052ABBBBBBBBB
A100000030AAAAAAAAAA

were I missed the Unique records in the input file. - A1000000030BCDQQQQQQ .
:cry:

Note : It is not mandatory the the output should be unsorted.

Would appreciate help .. Kindly assist.
[/img][/code]

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Mar 05, 2013 12:55 pm

You are asking for LASTDUP, which will only get you the last record of a set of duplicates. If you want last of duplicate + unique, try with LAST instead.

Shereen
Member
Posts: 2
Joined: Tue Mar 05, 2013 7:53 am

Post by Shereen » Tue Mar 05, 2013 3:20 pm

Hello,

Many thanks for your input, it worked :D . Initially I had tried with LAST but dint not work(probably at that time my file format was VB). Now I got the output as below :

A100000001ABCDDDDDDD
A1000000030BCDQQQQQQ
A100000030AAAAAAAAAA
A100000052ABBBBBBBBB
A100000101ABCCCCCCCC

And the output is coming in sorted order.

Thanks once again!!

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Mar 05, 2013 3:43 pm

Well, you'll definitely need the default SORT that SELECT applies, as your duplicates are not contiguous.

If you want it back in the original order, it is possible, but would require sorting the data again, having appended (fixed) or prepended (variable) a sequence number with INREC.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others