Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Clubbing of SORT steps in ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

PostPosted: Mon Dec 17, 2012 11:30 am    Post subject: Clubbing of SORT steps in ICETOOL
Reply with quote

Hi,

I have a file of length 80. The requirement is to check

1.if the 1st 9 bytes of the file. If there are duplicates then check the next set of 9 bytes (10-18). If that also matches, then it should be written into Output file F1.
2. If there are no duplicates in the 1-9 bytes of the file, then also it should be written into Output file F1.
3. If the bytes 1-9 are same and 10-18 are different, then it needs to be written into Output File F2.

Currently am planning to have 2 Sort Steps.

Step 1
Filter out all duplicate records (on 1-9 bytes) from Input file using ICETOOL - ALLDUPS (Output file F2).
Non Duplicate records pushed into Output file F1

Step 2
Sort the output of Step 1 on bytes 1-9 and 10-18. If there are duplicates, i write into Output file F1 (using MOD)
If they don't match, then write into Output file F3.

Can these 2 steps be clubbed into one single step

Thanks
Sikkandhar
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Mon Dec 17, 2012 12:29 pm    Post subject:
Reply with quote

Your explanation is pretty vague for me

Can you please post your requirement with sample data ?
Back to top
View user's profile Send private message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

PostPosted: Mon Dec 17, 2012 12:46 pm    Post subject:
Reply with quote

The input file looks like

Code:
A123456782012121
A123456782012121
A123456782012121
B123456782012121
B123456782012121
B123456782012122
C123456782012121
D123456782012121



The 1st 3 records, has same value in 1-18 bytes, so it has to be written into Output file F1 (Requirement 1 in the above post).

Records 4 through 6, has same value for 1st 9 bytes (B12345678), but the next 9 bytes have different value. Hence it has to be written into Output file F2 (Requirement 3 in the above post).

In Last 2 reocrds, there are no duplicate values for the bytes 1 through 9, hence it needs to be written into Output file F1 (Requirement 2 in the above post).
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Dec 17, 2012 12:50 pm    Post subject: Reply to: Clubbing of SORT steps in ICETOOL
Reply with quote

Your description is still confusing ...

looks like You want to process not single records but groups of records

and ... when You post data/jcl use the code tags ,
they preserve the spacing and provide better readability
Back to top
View user's profile Send private message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

PostPosted: Mon Dec 17, 2012 1:54 pm    Post subject:
Reply with quote

The input file looks like

Code:
Column 1 - 9   Column 10 -18
A12345678   2012121
A12345678   2012121
A12345678   2012121

B12345678   2012121
B12345678   2012121
B12345678   2012122
B12345678   2012122

C12345678   2012121
D12345678   2012121


The first 9 bytes (1-9) are Account numbers and the next set (10-19) are dates.

My Output file F1 should not contain duplicate accounts (.i.e. There should be only one record for Account number - date combination). Records 8 and 9 meet this requirement.

If there are multiple records with the same Account number and Same date (records 1 through 3 meet this requirement), then that should also be considered .i.e. Records 1 to 3 should be written into Output file F1

If there are multiple records with same account number but if the dates are different (records 4 through 7 meet this requirement. There are different dates for the same Account number), Then all these four records should be written into a separate Output file F2.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Mon Dec 17, 2012 2:14 pm    Post subject:
Reply with quote

What is your sort product and level ?

To check please execute the below code and let us know the SYSOUT message

Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*
Back to top
View user's profile Send private message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

PostPosted: Mon Dec 17, 2012 2:21 pm    Post subject:
Reply with quote

Code:
SYNCSORT FOR Z/OS  1.4.0.1R    U.S. PATENTS: 4210961, 5117495   (C) 2010 SYNCSORT INC.   DATE=2012/352   TIME=03.49.23
                                                      z/OS   1.13.0
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 1B593, MODEL 2097 734             LICENSE/PRODUCT EXPIRATION DATE: 02 MAR 2013
SYSIN :                                                                   
  OPTION COPY                                                             
WER276B  SYSDIAG= 12561134, 21228076, 21228076, 8622750                   
WER164B  6,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,         
WER164B     0 BYTES RESERVE REQUESTED, 332K BYTES USED                     
WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                           
WER108I  SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE=    80             
WER073I  SORTIN   : DSNAME=A494472.TICEMAN.JOB58057.D0000101.?             
WER110I  SORTOUT  : RECFM=FB   ; LRECL=    80; BLKSIZE=    80             
WER074I  SORTOUT  : DSNAME=NULLFILE                                       
WER410B  5,856K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,   
WER410B     0 BYTES RESERVE REQUESTED, 216K BYTES USED                     
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                             
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                             
WER416B  BSAM WAS USED FOR SORTIN                                         
WER416B  BSAM WAS USED FOR SORTOUT                                         
WER054I  RCD IN          1, OUT          1                                 
WER169I  RELEASE 1.4 BATCH 0520 TPF LEVEL 0.1                                 
WER052I  END SYNCSORT - TICEMAN,S1,,DIAG=8200,400E,AAA0,00E6,CA5E,6CA3,AAE8,EC64
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Mon Dec 17, 2012 2:34 pm    Post subject:
Reply with quote

WER messages belong to Syncsort
ICE messages belong to DFSORT

Syncsort questions should be posted in JCL forum

This forum belongs to only DFSORT queries
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Dec 17, 2012 7:00 pm    Post subject: Reply to: Clubbing of SORT steps in ICETOOL
Reply with quote

do You realize that records 8 and 9 fall under the same case as records 1 and 3

write to file two when an account <group> contains different dates
write to file one otherwise

learn the KISS principle ==> Keep It Simple Sam
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Dec 17, 2012 7:47 pm    Post subject:
Reply with quote

Hello,

Quote:
My Output file F1 should not contain duplicate accounts (.i.e. There should be only one record for Account number - date combination). Records 8 and 9 meet this requirement.

If there are multiple records with the same Account number and Same date (records 1 through 3 meet this requirement), then that should also be considered .i.e. Records 1 to 3 should be written into Output file F1
Well, i'm confused icon_confused.gif

Please post what the output should be for the sample input data posted.
Back to top
View user's profile Send private message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

PostPosted: Tue Dec 18, 2012 12:54 pm    Post subject:
Reply with quote

Hi All,

I was able to solve the above issue. Used below control card

Assume the below to be the Input File contents

Code:
Column 1 - 9   Column 10 - 16
A12345678   2012121
A12345678   2012121
A12345678   2012121

B12345678   2012121
B12345678   2012121
B12345678   2012122
B12345678   2012123

C12345678   2012121
D12345678   2012121


The first SELECT statement segregates Duplicate Account numbers (into FIle 3) and Unique Account numbers into File 2

The Second SELECT statement analyzes the File 3 (which contains the Duplicate Account numbers) on Account number and Date. If there are duplicate records on with same Account number and Date, it is moved to Output File F2. Rest (same Account number but different dates) are moved to Output File F1

Since I have used Disposition as MOD for File F2, i am copying contents of File 2 to File 4

So in the Above case

File F1 would contain

Code:
Column 1 - 9   Column 10 - 16
B12345678   2012122
B12345678   2012123


File 3

Column 1 - 9 Column 10 - 16
Code:
A12345678   2012121
A12345678   2012121
A12345678   2012121

B12345678   2012121
B12345678   2012121
B12345678   2012122
B12345678   2012123


File 4

Code:
Column 1 - 9   Column 10 - 16
A12345678   2012121
A12345678   2012121
A12345678   2012121
B12345678   2012121
B12345678   2012121
C12345678   2012121
D12345678   2012121


Tool In control card

Code:

SELECT FROM(IN) TO(OUT3) ON(1,9,CH) ALLDUPS                      -
  DISCARD(OUT2) USING(CTL1)                                         
SELECT FROM(OUT3) TO(OUT2) ON(1,9,CH) ON(10,7,CH) ALLDUPS       -
  DISCARD(OUT1) USING(CTL2)                                         
COPY FROM(OUT2) TO(OUT4) USING(CTL3)                                 


CTL1
Code:
OUTFIL FNAMES=OUT2,     
BUILD=(1,238)           
OUTFIL FNAMES=OUT1,     
BUILD=(1,238)


CTL2
Code:
OUTFIL FNAMES=OUT3,     
BUILD=(1,238)           
OUTFIL FNAMES=OUT2,     
BUILD=(1,238) 



CTL3
Code:
OUTFIL FNAMES=OUT4,         
BUILD=(1,238)   


Job
Code:

//IN       DD DSN=INPUT.FILE,DISP=SHR
//OUT1     DD DSN=OUTPUT.FILE.F1,               
//            DISP=(,CATLG,DELETE),                           
//            DCB=(LRECL=400,RECFM=FB,BLKSIZE=0),             
//            SPACE=(CYL,(90,90),RLSE)                         
//OUT2     DD DSN=OUTPUT.FILE.F2,           
//            DISP=MOD,                                       
//            DCB=(LRECL=238,RECFM=FB,BLKSIZE=0),             
//            SPACE=(CYL,(90,90),RLSE)                         
//OUT3     DD DSN=OUTPUT.FILE.F3,               
//            DISP=(,CATLG,DELETE),                           
//            DCB=(LRECL=238,RECFM=FB,BLKSIZE=0),             
//            SPACE=(CYL,(90,90),RLSE)                         
//OUT4     DD DSN=OUTPUT.FILE.F4,           
//            DISP=(,CATLG,DELETE),                           
//            DCB=(LRECL=238,RECFM=FB,BLKSIZE=0),             
//            SPACE=(CYL,(90,90),RLSE)                         
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Dec 18, 2012 1:53 pm    Post subject:
Reply with quote

Quote:
Code:

SELECT FROM(IN) TO(OUT3) ON(1,9,CH) ALLDUPS                      -
  DISCARD(OUT2) USING(CTL1)                                         
SELECT FROM(OUT3) TO(OUT2) ON(1,9,CH) ON(10,7,CH) ALLDUPS       -
  DISCARD(OUT1) USING(CTL2)                                         
COPY FROM(OUT2) TO(OUT4) USING(CTL3)                                 


CTL1
Code:
OUTFIL FNAMES=OUT2,     
BUILD=(1,238)           
OUTFIL FNAMES=OUT1,     
BUILD=(1,238)


CTL2
Code:
OUTFIL FNAMES=OUT3,     
BUILD=(1,238)           
OUTFIL FNAMES=OUT2,     
BUILD=(1,238) 



CTL3
Code:
OUTFIL FNAMES=OUT4,         
BUILD=(1,238)   


Why the BUILDs? Are you reducing the length of records? If you are, all records should be 238 after the first SELECT. Three outputs from the first SELECT? In the second SELECT OUT3 as input and output?

Did you try the two-step approach you were considering? How does it do in terms of resources compared to this?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us