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

Horizantal Sorting using SYNC SORT


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aron

New User


Joined: 15 Feb 2013
Posts: 4
Location: United States

PostPosted: Thu Mar 21, 2013 10:59 pm
Reply with quote

Hi All,

We have a requirement to sort records horizontally . Our Shop uses only SYNC SORT.

The input file is VB with record length of 598.

Here below is the input record:
J7185 J7183 J7184 J7180 J7186 J7190 J7189 J7197 J7194 J7193 38205 36500

Expected output record
J7180 J7183 J7184 J7185 J7186 J7189 J7190 J7193 J7194 J7197 36500 38205

The first digit of P-CODE can be A to Z and 0 to 9 and last four digits 0-9

Record layout:
05 CODES-DATA OCCURS 99 TIMES
INDEXED BY W-CX2.
10 P-CODE PIC X(05).
10 FILLER PIC X(01).

Could you please help on this.

Thanks a lot.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Mar 21, 2013 11:30 pm
Reply with quote

Quote:
Could you please help on this.

OK You asked for it ....
go to the machine room and lay sideway the MF and the DISK/TAPE units icon_cool.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 22, 2013 12:30 am
Reply with quote

Hello,

Your question is about Syncsort and will be moved to the JCL part of the forum (where Syncsort topics ar supported).

Suggest you consider a bit of COBOL or Easytrieve code to do what you want.
Back to top
View user's profile Send private message
Aron

New User


Joined: 15 Feb 2013
Posts: 4
Location: United States

PostPosted: Fri Mar 22, 2013 1:55 am
Reply with quote

@Enrico..

Appreciate your Humor. icon_lol.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Mar 22, 2013 5:22 am
Reply with quote

SyncSort sorts records. Unless you split your data into (upto) 99 records, sort them, then stick them back together, then SyncSort is't going to do it.

If the order of the data in the table is important, what happened to it? How much is it "out of order by"? How many records on the file? With what we know at the moment, I agree with Dick.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon Mar 25, 2013 10:25 pm
Reply with quote

Hello Aron.

Bill is correct. Here is a shortened example of how Syncsort can accomplish this task. This example only takes into account 12 fields. It will need to be modified to support 99 fields.
Code:

//STEP1 EXEC PGM=SORT                                                 
//SYSOUT  DD SYSOUT=*                                                 
//SORTOUT DD DISP=(NEW,PASS),SPACE=(TRK,1),UNIT=SYSDA,                 
//    DSN=&&OUT1                                                       
//SORTIN  DD *                                                         
J7185 J7183 J7184 J7180 J7186 J7190 J7189 J7197 J7194 J7193 38205 36500
//SYSIN  DD *                                                         
   SORT FIELDS=COPY                                                   
   OUTFIL BUILD=(1:1,5,/, 
                 1:7,5,/, 
                 1:13,5,/,
                 1:19,5,/,
                 1:25,5,/,
                 1:31,5,/,
                 1:37,5,/,
                 1:43,5,/,
                 1:49,5,/,
                 1:55,5,/,
                 1:61,5,/,
                 1:67,5)   
/*                         
//STEP2 EXEC PGM=SORT                                 
//SYSOUT  DD SYSOUT=*                                 
//SORTOUT DD DISP=(NEW,PASS),UNIT=SYSDA,SPACE=(TRK,1),
//   DSN=&&OUT2                                       
//SORTIN  DD DISP=SHR,DSN=&&OUT1                     
//SYSIN   DD *                                                         
  SORT FIELDS=(1,5,CH,A)           
  OUTREC IFTHEN=(WHEN=INIT,         
       BUILD=(1:SEQNUM,3,ZD,1,5)), 
     IFTHEN=(WHEN=(1,3,ZD,EQ,1),   
       BUILD=(1X,4,5,67Z)),         
     IFTHEN=(WHEN=(1,3,ZD,EQ,2),   
       BUILD=(1X,6Z,4,5,61Z)),     
     IFTHEN=(WHEN=(1,3,ZD,EQ,3),   
       BUILD=(1X,12Z,4,5,55Z)),     
     IFTHEN=(WHEN=(1,3,ZD,EQ,4),   
       BUILD=(1X,18Z,4,5,49Z)),       
     IFTHEN=(WHEN=(1,3,ZD,EQ,5),
       BUILD=(1X,24Z,4,5,43Z)),       
     IFTHEN=(WHEN=(1,3,ZD,EQ,6),
       BUILD=(1X,30Z,4,5,37Z)),       
     IFTHEN=(WHEN=(1,3,ZD,EQ,7),
       BUILD=(1X,36Z,4,5,31Z)),       
     IFTHEN=(WHEN=(1,3,ZD,EQ,8),
       BUILD=(1X,42Z,4,5,25Z)), 
     IFTHEN=(WHEN=(1,3,ZD,EQ,9),
       BUILD=(1X,48Z,4,5,19Z)), 
     IFTHEN=(WHEN=(1,3,ZD,EQ,10),
       BUILD=(1X,54Z,4,5,13Z)), 
     IFTHEN=(WHEN=(1,3,ZD,EQ,11),
       BUILD=(1X,60Z,4,5,7Z)),   
     IFTHEN=(WHEN=(1,3,ZD,EQ,12),
       BUILD=(1X,66Z,4,5,1Z))   
/*                               
//STEP3 EXEC PGM=SORT                       
//SYSOUT  DD SYSOUT=*                       
//SORTOUT DD SYSOUT=*                       
//SORTIN  DD DISP=SHR,DSN=&&OUT2           
//SYSIN   DD *                             
  SORT FIELDS=(1,1,CH,A)                   
  DUPKEYS SUM=(2,4,6,4,10,4,14,4,18,4,22,4,
  26,4,30,4,34,4,38,4,42,4,46,4,           
  50,4,54,4,58,4,62,4,66,4,70,4),FORMAT=BI 
  OUTREC BUILD=(2,71)                       
/*                                         
                       


Hope this helps.

Regards,
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 -> SYNCSORT

 


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
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top