Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can we Achieve this with SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Can we Achieve this with SORT
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: 8593
Location: Back in jolly old England

PostPosted: Wed May 13, 2009 2:50 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed May 13, 2009 4:40 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed May 13, 2009 8:31 pm    Post subject:
Reply with quote

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

http://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    Post subject:
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 Moderator


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

PostPosted: Wed May 13, 2009 10:23 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed May 13, 2009 11:04 pm    Post subject:
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:

http://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:

www.ibm.com/systems/support/storage/software/sort/mvs/tricks/
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us