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
 

 

Need suggestion in sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 28
Location: India

PostPosted: Wed Jul 24, 2013 12:00 pm    Post subject: Need suggestion in sort
Reply with quote

Hi,

I have the input file as below.

Code:

HEADER
SBR_AT 0010
DMT_AT 0010
MEM_GR 0010 GRPID20
SBR_AT 0011
DMT_AT 0011
MEM_GR 0011 GRPID10



The above input file must be sorted such that if (5:6) = 'GR' then it is to be sorted on groupid(13:7) and the block ordering must not change as shown below.

Code:

HEADER
SBR_AT 0011
DMT_AT 0011
MEM_GR 0011 GRPID10
SBR_AT 0010
DMT_AT 0010
MEM_GR 0010 GRPID20



Is there any way to achieve this in sort?

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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed Jul 24, 2013 12:06 pm    Post subject: Reply to: Need suggestion in sort
Reply with quote

Is all your data of that "pattern"? (if not, show a better sample input file which is representative of possible combinations, including maximum number of records per group).

What is the RECFM and LRECL of your input?
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 28
Location: India

PostPosted: Wed Jul 24, 2013 12:11 pm    Post subject: Need suggestion in sort
Reply with quote

Hi Bill,

Yes, All the data will be present in the above pattern.

Thanks,
Senthil
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 28
Location: India

PostPosted: Wed Jul 24, 2013 12:13 pm    Post subject: Need suggestion in sort
Reply with quote

But groupid(13:7) GRPID10, GRPID20 mentioned above will be system generated unique alphanumeric ids. For easier identification i have mentioned as GRPID
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 28
Location: India

PostPosted: Wed Jul 24, 2013 12:24 pm    Post subject: Need suggestion in sort
Reply with quote

Hi Bill,
Sorry to mention file details, RECFM will be FB and LRECL = 626

Thanks,
Senthil
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed Jul 24, 2013 12:43 pm    Post subject: Reply to: Need suggestion in sort
Reply with quote

OK. First see if you have DATASORT available under SYNCTOOL (perhaps done as EXEC PGM=ICETOOL). That will keep the file header where it is.

Then identify your first two record types, separately, with IFTHEN=(WHEN=GROUP PUSH the entire record to separate (for each record type) extended areas on the record.

Your third record will now contain the data belonging to all three records, and it has the sort key you want. Sort on that key.

Two tasks for OUFIL. OMIT= for the original first two record types. BUILD with the "slash operator (/)" to cause multiple records to be output from one input record.

Like BUILD=(627,626,/,1253,626,/,1,626).

Then you should be about there.
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 28
Location: India

PostPosted: Wed Jul 24, 2013 1:03 pm    Post subject: Need suggestion in sort
Reply with quote

Hi Bill,

THats great!!. I have ICETOOL option. but it would be better if u can provide me syntax as I am new to ICETOOL. Thanks.

Thanks,
Senthil
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed Jul 24, 2013 1:23 pm    Post subject: Reply to: Need suggestion in sort
Reply with quote

DATASORT is very easy. Search the forum/web and you should find some examples. You then put the processing in the USING(xxxx) file, so you have xxxxCNTL as a DD.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2162
Location: @my desk

PostPosted: Wed Jul 24, 2013 2:10 pm    Post subject:
Reply with quote

Senthil,

Do you always have 3 records in a 'group' assuming a group ends with some non-blank 7 byte value at pos-13? Or can it be more or less than 3?
Quote:
if (5:6) = 'GR' then it is to be sorted on groupid(13:7)
Does this mean that you can have groups such that the last record in the group has some value at pos-5 other than 'GR'?
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 28
Location: India

PostPosted: Wed Jul 24, 2013 2:23 pm    Post subject: Need suggestion in sort
Reply with quote

Hi Arun,

The record count can be more or less than 3 but always the last record will hold 'GR' for 1 set with non blank 7 byte from position 13.

Senthil
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2162
Location: @my desk

PostPosted: Wed Jul 24, 2013 3:22 pm    Post subject:
Reply with quote

Senthil,

Do you know the maximum number of records that can come in a single 'group'?
Back to top
View user's profile Send private message
SENTHIL MURUGAAN
Warnings : 1

New User


Joined: 12 Jan 2013
Posts: 28
Location: India

PostPosted: Wed Jul 24, 2013 3:30 pm    Post subject:
Reply with quote

Arun,

The maximum no of records for a single group cannot be predicted. As far i see the test file it holds not more than 5 records for 1 set.

But (8:4) will be always same as shown above for 1 set and will be in ascending order. This is the only position which denotes they belong to 1 group(Ex:0010,0011). If there is any way to copy this at the end for all the records for that particular group, then it helps easy sorting
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed Jul 24, 2013 9:59 pm    Post subject: Reply to: Need suggestion in sort
Reply with quote

Quote:
Is all your data of that "pattern"? (if not, show a better sample input file which is representative of possible combinations, including maximum number of records per group).


Quote:
Yes, All the data will be present in the above pattern.


Quote:
Do you always have 3 records in a 'group' assuming a group ends with some non-blank 7 byte value at pos-13? Or can it be more or less than 3?


Quote:
The record count can be more or less than 3...


Quote:
Do you know the maximum number of records that can come in a single 'group'?


Quote:
The maximum no of records for a single group cannot be predicted. As far i see the test file it holds not more than 5 records for 1 set.


I'm glad that all got clarified :-)
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2162
Location: @my desk

PostPosted: Thu Jul 25, 2013 2:39 pm    Post subject:
Reply with quote

Senthil,

You might want to try the below Syncsort.
Note that the same input file needs to be assigned to both SORTJNF1 and SORTJNF2 DDs.
Code:
//STEP01   EXEC  PGM=SORT                       
//*                                             
//SORTJNF1 DD DISP=SHR,DSN= Input file (FB/626) 
//SORTJNF2 DD DISP=SHR,DSN= Input file (FB/626) 
//*                                             
//SYSOUT   DD SYSOUT=*                           
//SORTOUT  DD DSN= Output file (FB/626)         
//*                                             
//SYSIN    DD  *                                 
 JOINKEYS FILE=F1,FIELDS=(8,4,A),SORTED         
 JOINKEYS FILE=F2,FIELDS=(8,4,A),SORTED,         
                  INCLUDE=(5,2,CH,EQ,C'GR')     
 JOIN UNPAIRED,F1                               
 REFORMAT FIELDS=(F1:1,626,F2:13,7)             
 SORT FIELDS=(627,7,CH,A),EQUALS                 
 OUTREC BUILD=(1,626)                           
//* 
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 -> SYNCSORT 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