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

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Sat Nov 05, 2005 9:00 pm
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:

Use [URL] BBCode for External Links

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
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 Developer


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

PostPosted: Tue Nov 08, 2005 12:10 am
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
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 Developer


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

PostPosted: Thu Nov 10, 2005 9:18 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
Search our Forums:

Back to Top