View previous topic :: View next topic
Author
Message
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
I have a file(FILE A) its VB and length is 4500. Its having a key field in 11th position. And Key can have multiple records.
FILE A
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX121XXXXXXXXX
XXXXXXXXXX121XXXXXXXXX
XXXXXXXXXX122XXXXXXXXX
XXXXXXXXXX122XXXXXXXXX
XXXXXXXXXX123XXXXXXXXX
XXXXXXXXXX123XXXXXXXXX
XXXXXXXXXX124XXXXXXXXX
XXXXXXXXXX124XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
I have one more file(FILE B) which contain the key numbers, this file length is 15 FB and starting postion of key value is 1
FILE B
123
124
125
If i uses Include cond=(15,3,CH,EQ,C'123',OR,
15,3,CH,EQ,C'124',OR,
15,3,CH,EQ,C'125')
This will sort all the records of 123,124,125 from File A and give me out put.
Instead of giving this Include cond, Can i use FILE B directly and sort the records from FILEB and get the below output?
XXXXXXXXXX123XXXXXXXXX
XXXXXXXXXX123XXXXXXXXX
XXXXXXXXXX124XXXXXXXXX
XXXXXXXXXX124XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
Click HERE to view DFSORT smart tricks, and see the section Join fields from two files on a key , which I believe will help you.
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Expat,
As i believe sort works only on 4080 record length....but my first file is having 4500 record length, doesnt it a problem?
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
I think that you will find that the restriction is on the length of the key rather than the length of the record.
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Thanks Expat,
Can you give me the sort card if its handy for you for the above rewuirement.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Frank, started new thread as i have posted my question in other question...
Any ways....
I have posted here exact file format as well records of file, in last post your answer my question with your assumption was (as i dont reply to u r Q :-) ), first file do not have dupicates, but my question is that first file will have duplicate records......
Can you give me sort for this...
Posted: Wed May 13, 2009 2:38 pm Post subject: Can we Achieve this with SORT
--------------------------------------------------------------------------------
I have a file(FILE A) its VB and length is 4500. Its having a key field in 11th position. And Key can have multiple records.
FILE A
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX121XXXXXXXXX
XXXXXXXXXX121XXXXXXXXX
XXXXXXXXXX122XXXXXXXXX
XXXXXXXXXX122XXXXXXXXX
XXXXXXXXXX123XXXXXXXXX
XXXXXXXXXX123XXXXXXXXX
XXXXXXXXXX124XXXXXXXXX
XXXXXXXXXX124XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
I have one more file(FILE B) which contain the key numbers, this file length is 15 FB and starting postion of key value is 1
FILE B
123
124
125
If i uses Include cond=(15,3,CH,EQ,C'123',OR,
15,3,CH,EQ,C'124',OR,
15,3,CH,EQ,C'125')
This will sort all the records of 123,124,125 from File A and give me out put.
Instead of giving this Include cond, Can i use FILE B directly and sort the records from FILEB and get the below output?
FILEC
XXXXXXXXXX123XXXXXXXXX
XXXXXXXXXX123XXXXXXXXX
XXXXXXXXXX124XXXXXXXXX
XXXXXXXXXX124XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
XXXXXXXXXX125XXXXXXXXX
FILED
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX120XXXXXXXXX
XXXXXXXXXX121XXXXXXXXX
XXXXXXXXXX121XXXXXXXXX
XXXXXXXXXX122XXXXXXXXX
XXXXXXXXXX122XXXXXXXXX
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEA DD DSN=... input fileA (VB/4500)
//FILEB DD DSN=... input fileB (FB/15)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS),
// LRECL=4502
//FILEC DD DSN=... output fileC (VB/4500)
//FILED DD DSN=... output fileD (VB/4500)
//TOOLIN DD *
COPY FROM(FILEB) USING(CTL1)
COPY FROM(FILEA) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(FILEC) ON(17,3,CH) KEEPBASE KEEPNODUPS -
VLENOVLY WITHALL WITH(5,1) WITH(7,4496) USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,FTOV,BUILD=(C'BB',13:1,3)
/*
//CTL2CNTL DD *
INREC BUILD=(1,4,5:C'VV',7:5)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=FILEC,INCLUDE=(5,2,CH,EQ,C'VB'),
BUILD=(1,4,5:7)
OUTFIL FNAMES=FILED,INCLUDE=(5,2,CH,EQ,C'VV'),
BUILD=(1,4,5:7)
/*
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Frank.....thanks a lot.
If you dont mind, can you please explain me this
SPLICE FROM(T1) TO(FILEC) ON(17,3,CH) KEEPBASE KEEPNODUPS -
VLENOVLY WITHALL WITH(5,1) WITH(7,4496) USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,FTOV,BUILD=(C'BB',13:1,3)
/*
//CTL2CNTL DD *
INREC BUILD=(1,4,5:C'VV',7:5)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=FILEC,INCLUDE=(5,2,CH,EQ,C'VB'),
BUILD=(1,4,5:7)
OUTFIL FNAMES=FILED,INCLUDE=(5,2,CH,EQ,C'VV'),
BUILD=(1,4,5:7)
/*
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
CTL1CNTL converts FILEB from FB to VB, inserts an id of 'BB' (base) after the RDW and puts the key in position 13. The output goes in T1 (MOD).
CTL2CNTL copies FILEA and inserts an id of 'VV' (overlay) after the RDW - the key will be in position 13. The output goes in T1 (MOD).
SPLICE matches the keys in the T1 records and puts the first id character into each overlay record. The keys that have a match in FILEB and FILEA will have an id of 'VB'. The keys from FILEB that do not have a match in FILEA will have an id of 'VV'.
CTL3CNTL separates the records into FILEC (id=VB) and FILED (id=VV) and removes the id.
For complete information on SPLICE, see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA30/6.13?DT=20080528171007
For more examples of using SPLICE, see "Smart DFSORT Tricks" at:
Use [URL] BBCode for External Links
Back to top
Mazahar New User Joined: 11 Dec 2007Posts: 82 Location: hyderabad
Frank,
Thanks a lot, this is an Excellent Sort, It worked superbly.....Thanks a lot.
Back to top
Please enable JavaScript!