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
 
Dynamic sort where the keys are not on the same positition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
cima

New User


Joined: 22 Mar 2006
Posts: 8

PostPosted: Tue Jun 15, 2010 12:10 pm    Post subject: Dynamic sort where the keys are not on the same positition
Reply with quote

Hi all,

I'd like to know if its possible to sort a file, where the keys are not always on the same position.

example:

Input:
ID001.................ID002................ID003..10....................
ID001.................ID003..07..............ID004......................
ID001.................ID003..02..............ID004......................
ID001.................ID002................ID003..01....................

Output:
ID001.................ID002................ID003..01....................
ID001.................ID003..02..............ID004......................
ID001.................ID003..07..............ID004......................
ID001.................ID002................ID003..10....................

Problem: In ID003, there is a subkey (two-digit) which I'd like to sort. However, ID003's position is variable because not all IDs are always present, like the 2nd record, where ID002 is omitted.

Is sorting in this case possible?

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

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 15, 2010 9:46 pm    Post subject: Reply to: Dynamic sort where the keys are not on the same po
Reply with quote

cima,

Assuming your input is FB recfm and LRECL of 80 , use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
ID001.................ID002................ID003..10...............
ID001.................ID003..07............ID004...................
ID001.................ID003..02............ID004...................
ID001.................ID002................ID003..01...............
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  INREC PARSE=(%00=(STARTAFT=C'ID003..',FIXLEN=2)),BUILD=(1,80,%00)
  SORT FIELDS=(1,5,CH,A,81,2,CH,A)                                 
  OUTREC BUILD=(1,80)                                             
//*
Back to top
View user's profile Send private message
cima

New User


Joined: 22 Mar 2006
Posts: 8

PostPosted: Mon Jun 21, 2010 10:26 am    Post subject:
Reply with quote

Hi Skolusu,

Thanks for the reply..

Actually its VB and LRECL 29998.. Also the 2 DOTS between ID003 and the 2digit Subkey are just fillers.. They have values like:

ID003AB02abcdefg1234ID004
ID003CD07asdfjkl12341ID004

The bluemarked text can have different values..

Sorry for the incomplete infos..

Thanks,
cima
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 22, 2010 3:29 am    Post subject:
Reply with quote

cima wrote:
Hi Skolusu,

Thanks for the reply..

Actually its VB and LRECL 29998.. Also the 2 DOTS between ID003 and the 2digit Subkey are just fillers.. They have values like:

Sorry for the incomplete infos..

Thanks,
cima


Cima,

It would save a lot of time , if you are clear with your requirements. Anyway use the following control cards which will give you the desired results.

Code:

//SYSIN    DD *                                                   
  INREC PARSE=(%00=(STARTAFT=C'ID003',FIXLEN=4)),BUILD=(1,4,%00,5)
  SORT FIELDS=(9,5,CH,A,7,2,CH,A),EQUALS                         
  OUTREC BUILD=(1,4,9)                                           
//*
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 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
No new posts Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 5 Sat Aug 19, 2017 2:33 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am

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