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

Need clarification of this SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Fri Jul 17, 2009 3:57 pm
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

Moderator Emeritus


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

PostPosted: Fri Jul 17, 2009 4:39 pm
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
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

Moderator Emeritus


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

PostPosted: Fri Jul 17, 2009 6:24 pm
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 17, 2009 9:08 pm
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
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jul 20, 2009 9:32 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


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
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top