Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Problem in SORT

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

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Fri Dec 26, 2008 7:44 pm    Post subject: Problem in SORT
Reply with quote

Hi,

I am facing problem in sorting ine file which has header ,detail and trailer.

I wanr sort form 3rd byte to 24rth byte.
Below is my file

Code:

01AAAA   < ðGT                                       
05U@00002408121809423082003648DR021209635335210892801J
05U@00002408121809423072003648DR021209635335210892801J
05U@00002408121809423062003648DR021209635335210892801J
05U@00002408121809423052003648DR021209635335210892801J
05U@00002408121809423042003648DR021209635335210892801J
05U@00002408121809423032003648DR021209635335210892801J
09   ð


I am using the below sort JCL

Code:

//LBSORT01 EXEC PGM=SORT                                     
//SYSPRINT DD SYSOUT=*                                       
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DISP=SHR,DSN=input dataset   
//SORTOUT  DD DSN=out put dataset           
//            DISP=(NEW,CATLG),                             
//            SPACE=(CYL,(10,10),RLSE),                     
//            DCB=(LRECL=6004,RECFM=V,BLKSIZE=0),           
//            UNIT=SYSDA                                     
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(1,1))                   
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(1,1))                   
//SYSIN    DD *                                             
 SORT FIELDS=(3,22,CH,A)                                     
/*     


But the result is same as the input. Means its not sorting .

Please advice.

Regards,
Harsha.
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 Dec 26, 2008 8:54 pm    Post subject:
Reply with quote

I see two problems here.

1) Since your output file has RECFM=V, I assume your input file also has RECFM=V. So you have to add 4 to the starting position to account for the RDW in positions 1-4. With 3,22, your field actually starts with the 3rd byte of the RDW rather than with the 3rd data byte and all of the 05 records have the same 22 bytes of data.
2) You have 01 for the header record, 05 for the detail records and 09 for the trailer record in the first two data bytes (positions 5-6). If you start sorting with the 3rd data byte, the order of the header, data and trailer records can change. You need to include the 01, 05 and 09 in the SORT.

Given all of that, the correct DFSORT SORT statement would be:

Code:

  SORT FIELDS=(5,24,CH,A)
Back to top
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Sat Dec 27, 2008 4:28 pm    Post subject: Reply to: Problem in SORT
Reply with quote

Hi Frank,

Thanks alot for your reply....Its working now.

The fact that the files which I am using are varibale files , just slipped out of my mind. But by trail and error method I have tried the sort card as SORT FIELDS=(5,24,CH,A) and its working. Also its sorting only detail records and header trailer records uneffected.

Thanks again.

Cheers,
Harsha
Back to top
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Sat Dec 27, 2008 4:34 pm    Post subject: Reply to: Problem in SORT
Reply with quote

Now I have changed my sort to
SORT FIELDS=(7,22,CH,A)

which will acomodate the 4 bytes of RDW.

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

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Sat Dec 27, 2008 4:49 pm    Post subject: Reply to: Problem in SORT
Reply with quote

Hi Frank,

By using above sort (SORT FIELDS=(7,22,CH,A) )

The header and trailers are also getting changed icon_sad.gif

So I am using By using above sort (SORT FIELDS=(5,24,CH,A) ) which will sort form first byte. And I will always get header with 01,detail with 05 or 06 ,trailer with 09 so I can sort form first byte.
Can you please suggest how I can avoid this.

Do you want me to omit the first and last record and again to merger the final file after sorting?

Please advice.

Thanks,
Harsha
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: Sat Dec 27, 2008 9:45 pm    Post subject:
Reply with quote

Quote:
Can you please suggest how I can avoid this.


Huh? Why would you want to avoid sorting on the first two bytes when doing so gives you the records in the correct order and not doing so doesn't?

If for some reason you want to sort the detail records only by 7,22 but still keep the header and trailer records in place, you could use DFSORT's new DATASORT function available with z/OS DFSORT PTF UK90013 (July, 2008). Here's the DFSORT/ICETOOL job for that. If you don't have that PTF, ask your System Programmer to install it.

Code:

//S2   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN   DD DSN=...  input file
//OUT  DD DSN=...  output file
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(7,22,CH,A)
/*


For complete details on DFSORT's new DATASORT function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us