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

Can we Achieve this with SORT


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

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Wed May 13, 2009 2:38 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 13, 2009 2:50 pm
Reply with quote

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
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Wed May 13, 2009 4:26 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 13, 2009 4:40 pm
Reply with quote

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
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Wed May 13, 2009 4:50 pm
Reply with quote

Thanks Expat,

Can you give me the sort card if its handy for you for the above rewuirement.
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: Wed May 13, 2009 8:31 pm
Reply with quote

I gave you a solution for the same kind of thing the other day:

ibmmainframes.com/viewtopic.php?t=40384&postdays=0&postorder=asc&start=15

Why are you starting a new thread for this?
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Wed May 13, 2009 9:26 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed May 13, 2009 10:23 pm
Reply with quote

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
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Wed May 13, 2009 10:41 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed May 13, 2009 11:04 pm
Reply with quote

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
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Thu May 14, 2009 12:07 pm
Reply with quote

Frank,

Thanks a lot, this is an Excellent Sort, It worked superbly.....Thanks a lot.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top