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 clarification of this SORT

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

New User


Joined: 20 Feb 2009
Posts: 51
Location: Chennai

PostPosted: Fri Jul 17, 2009 3:41 pm    Post subject: Need clarification of this SORT
Reply with quote

Hi,

Can you please help me with this issue.
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: Fri Jul 17, 2009 3:57 pm    Post subject:
Reply with quote

No, because I am not permitted to open attachments from this site.
Please post your problem in clear text so that everyone can see it.
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 Jul 17, 2009 4:39 pm    Post subject:
Reply with quote

Hello,

Please look at other topics posted in the forum and post yours the same way. For jcl, data, and code, use copy/paste and the "Code" tag. Then Preview to make sure your post looks as you want it. Then submit.

As Expat mentioned, not all of our members are permitted to download attachments.
Back to top
View user's profile Send private message
Satheeshkumar

New User


Joined: 20 Feb 2009
Posts: 51
Location: Chennai

PostPosted: Fri Jul 17, 2009 5:59 pm    Post subject: Reply to: SORT
Reply with quote

Hi,
Currently our sort control card working fine, if the input file to the SORT contains data for one day.
The control card is not working fine , if the input file to sort contains the data for two days.
The first character in the input file
“0” indicates header record
“2” Indicates data
“9” Indicates Trailer record.
SortIn file:
Code:
 ***************************** Top of Data ************
 020090705                                             
 2508200907032860000269TN 1200011010330060010  +0000000
 9000000020+000000000410672.24-000000000618875.17-0
 020090706                                             
 2083200907062860000096   1200014060030060010  +0000000
 9000000001+000000000000455.90-000000000000025.16+0
 **************************** Bottom of Data **********

Control card:

Code:
 ***************************** Top of Data **
  SORT FIELDS=(01,01,BI,A,                 
               02,03,BI,A,                 
               04,08,BI,A,                 
               26,05,BI,A,                 
               13,10,BI,A,                 
               23,03,BI,A,                 
               31,06,BI,A)                 
**************************** Bottom of Data


Current output of above sort card:
Code:
 ***************************** Top of Data **********
 020090705                                           
 020090706                                           
 2508200907032860000269TN 1200011010330060010  +00000
 2083200907062860000096   1200014060030060010  +00000
 9000000020+000000000410672.24-000000000618875.17
 9000000001+000000000000455.90-000000000000025.16
 **************************** Bottom of Data ********



Our output file requirement is that, It shoud have record in the order of
Header record
Data record
Trailer record
Header record
Data record
Trailer record
Can anyone help me with this issue..
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 Jul 17, 2009 6:24 pm    Post subject:
Reply with quote

Hello,

Please note how the result of "Coded" appears. Using Preview allows testing/editing before publication icon_smile.gif

It will help if you post the output you want from this process. Also mention the dsorg and lrecl of the files. Please explain the ordering criteria.

You might look for examples of WHEN=GROUP in the forum. . .

The "sort pros" should be along in a little while.
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: Fri Jul 17, 2009 9:08 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
020090705
2508200907032860000269TN 1200011010330060010  +0000000
9000000020+000000000410672.24-000000000618875.17-0
020090706
2083200907062860000096   1200014060030060010  +0000000
9000000001+000000000000455.90-000000000000025.16+0
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'0'),
    PUSH=(81:ID=8))
  SORT FIELDS=(81,8,ZD,A,
               01,01,BI,A,
               02,03,BI,A,
               04,08,BI,A,
               26,05,BI,A,
               13,10,BI,A,
               23,03,BI,A,
               31,06,BI,A)
  OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
Satheeshkumar

New User


Joined: 20 Feb 2009
Posts: 51
Location: Chennai

PostPosted: Sat Jul 18, 2009 2:49 pm    Post subject:
Reply with quote

Hello,

Can you plaese provide some more explanation about the functionaly of the above control card statements.
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: Mon Jul 20, 2009 9:32 pm    Post subject:
Reply with quote

Well, your input example isn't very good because it only has one '2' record for each group, but ...

The GROUP clause puts puts an id in positions 81-89 for each "group" of records. A group of records starts with a '0' in position 1. So after the INREC statement is processed, the first group of records (0, 2, 9) will have an 00000001 id, the second group of records will have a 00000002 id, etc.

Now we sort on the group id in 81-89 to keep the groups in order and then we sort on your other fields to sort the '2' records in the correct order within each group. Then we remove the group id.
Back to top
View user's profile Send private message
Satheeshkumar

New User


Joined: 20 Feb 2009
Posts: 51
Location: Chennai

PostPosted: Tue Jul 21, 2009 2:17 pm    Post subject:
Reply with quote

Thank you so much!!

It is working fine now
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 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