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
 

 

How to sort a file when sort key is at diffrent position

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

New User


Joined: 23 Jun 2005
Posts: 5

PostPosted: Sat Nov 05, 2005 10:22 am    Post subject: How to sort a file when sort key is at diffrent position
Reply with quote

Hi all ,
Urgently need one help.....

Assume we have a file of 100 LRECL ,first 3 bytes of each records says Message type.lets assume A01 and B01 ,for A01 type of records we have a field called account nbr starting at 50th position having offset of 9 bytes ,similarly for B01 account nbr is at 25th position having offset of 9 bytes,now i want to sort this file based on account nbr .since account nbr for all records are not starting at same postion so i cant do normal DFSORT.but i believe ,still this can be done using DFSORT ,but not sure of Syntax ...

any sggestions with sort steps will be appriciable.

Thanks,
Chanchal
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 Nov 05, 2005 9:00 pm    Post subject:
Reply with quote

Chanchal,

The DFSORT below will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/100)
//SORTOUT DD DSN=...  output file (FB/100)
//SYSIN    DD    *
* Make a copy of the A01 key from 50-58 in 101-109.
   INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'A01'),OVERLAY=(101:50,9)),
* Make a copy of the B01 key from 25-33 in 101-109.
        IFTHEN=(WHEN=(1,3,CH,EQ,C'B01'),OVERLAY=(101:25,9))
* Sort on the copy of the key.
   SORT FIELDS=(101,9,ZD,A)
* Remove the copy of the key.
   OUTREC FIELDS=(1,100)
/*
Back to top
View user's profile Send private message
kranti

New User


Joined: 10 Oct 2005
Posts: 27

PostPosted: Mon Nov 07, 2005 11:59 pm    Post subject: Re: How to sort a file when sort key is at diffrent position
Reply with quote

Hi Frank,

Your solution is superb. But If we dont have the newer version installed in our system,Is there any possibility to have some other syntax?? Because earlier you provided me one solution like that which contained the older version syntax. So is there any provision like that? If so... could you please provide us the solution

Thanks ,
Kran.
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: Tue Nov 08, 2005 12:10 am    Post subject:
Reply with quote

Hmmm ... the "newer" version has been available since Dec, 2004 so it's not really that new any more. Please show me the //SYSOUT messages you get when you run this job:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DUMMY
//SYSIN DD *
   OPTION COPY
   OUTREC OVERLAY=(5:C'A')
/*
Back to top
View user's profile Send private message
kranti

New User


Joined: 10 Oct 2005
Posts: 27

PostPosted: Wed Nov 09, 2005 1:05 pm    Post subject: Re: How to sort a file when sort key is at diffrent position
Reply with quote

Hi Frank,
As you said,I have submitted the JCL whichever you provided to me.
In SYSOUT I found some message that has shown below.Please check the SYSOUT below


Code:

1ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                               
 ICE000I 1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 08:40 ON TUE NOV  08, 2005 -

0            OPTION COPY                                                       
             OUTREC OVERLAY=(5:C'A')                                           
                    $                                                           
 ICE104A 0 INVALID INREC OR OUTREC STATEMENT OPERAND                           
 ICE012A 3 MISSING FIELDS OPERAND DEFINER                                       
 ICE052I 3 END OF DFSORT                                                       


If my operating system doesn't have that latest version of DFSORT option ...... is there any Syntax to work using the same version of DFSORT.

Thanks for your extended support,
Kran.
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: Thu Nov 10, 2005 9:18 pm    Post subject:
Reply with quote

Yes, that message means you don't have the Dec, 2004 DFSORT PTF so you can't use OVERLAY. Based on the note you sent me offline, this two-pass DFSORT job will do what you want without using any of the Dec, 2004 DFSORT PTF functions.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
   OPTION COPY
   OUTFIL FNAMES=T1,
     INCLUDE=(36,3,CH,EQ,C'A10'),OUTREC=(1,1238,1239:50,9)
   OUTFIL FNAMES=T2,
     INCLUDE=(36,3,CH,EQ,C'B10'),OUTREC=(1,1238,1239:25,9)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//       DD DSN=&&T2,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
   SORT FIELDS=(1239,9,ZD,A)
   OUTREC FIELDS=(1,1238)
/*
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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am


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