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
 

 

Horizantal Sorting using SYNC SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: Horizantal Sorting using SYNC SORT
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Thu Mar 21, 2013 11:30 pm    Post subject: Reply to: Horizantal Sorting using SYNC SORT
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

Site Director


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

PostPosted: Fri Mar 22, 2013 12:30 am    Post subject:
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    Post subject:
Reply with quote

@Enrico..

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Fri Mar 22, 2013 5:22 am    Post subject: Reply to: Horizantal Sorting using SYNC SORT
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: 500
Location: USA

PostPosted: Mon Mar 25, 2013 10:25 pm    Post subject: Reply to: Horizantal Sorting using SYNC SORT
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    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 Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
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


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us