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

Simpler way of doing it using only one sort card


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Fri Oct 10, 2008 3:10 pm
Reply with quote

I have an input file with the following records



Code:


00roshni1020080910           
01RECORD  MAX  10203040506300MAX
01RECORD  MAX  20304050607100MAX
01RECORD  MAX  40506070809200MAX
01RECORD  MAX  20304050607300MAX
01RECORD  MAX  30405060708300MAX
01RECORD  MAX  40506070809300MAX
01RECORD  MAX  30405060708200MAX
0200000003



My file is 91 bytes long and the output file should have the field from 27th position till length 3 to be sorted in the order 300, 100 and then 200.
And my output should look like this

Code:


00HEADER           
01RECORD  MAX  10203040506300MAX
01RECORD  MAX  20304050607300MAX
01RECORD  MAX  30405060708300MAX
01RECORD  MAX  40506070809300MAX
01RECORD  MAX  20304050607100MAX
01RECORD  MAX  40506070809200MAX
01RECORD  MAX  30405060708200MAX
02TRAILER
               



I am trying to split the file into the three types and then merging again. but I want to know if there is any simpler method.

My sort card looks like this

Code:


SORT FIELDS=(27,3,CH,A)     
OUTFIL FNAMES=SORTO300,     
  INCLUDE=(27,3,CH,EQ,C'300')
OUTFIL FNAMES=SORTO100,     
  INCLUDE=(27,3,CH,EQ,C'100')
OUTFIL FNAMES=SORTO200,     
  INCLUDE=(27,3,CH,EQ,C'200')




I want to know if there is any simpler way of doing it using only one sort card?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Oct 10, 2008 6:28 pm
Reply with quote

Quote:
I want to know if there is any simpler way of doing it using only one sort card?


Yes ther is...
Code:

//SORTIN DD *                           
00ROSHNI1020080910                     
01RECORD  MAX  10203040506300MAX       
01RECORD  MAX  20304050607100MAX       
01RECORD  MAX  40506070809200MAX       
01RECORD  MAX  20304050607300MAX       
01RECORD  MAX  30405060708300MAX       
01RECORD  MAX  40506070809300MAX       
01RECORD  MAX  30405060708200MAX       
02TRAILER                               
/*                                     
//SORTOUT DD SYSOUT=*                   
//SYSIN    DD    *                     
   SORT FIELDS=(34,2,CH,A)             
   INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'00'),
                 OVERLAY=(33:C'00')),     
         IFTHEN=(WHEN=(1,2,CH,EQ,C'02'), 
                 OVERLAY=(33:C'04')),     
         IFTHEN=(WHEN=(27,3,CH,EQ,C'300'),
                 OVERLAY=(33:C'01')),     
         IFTHEN=(WHEN=(27,3,CH,EQ,C'100'),
                 OVERLAY=(33:C'02')),     
         IFTHEN=(WHEN=(27,3,CH,EQ,C'200'),
                 OVERLAY=(33:C'03'))     
   OUTREC FIELDS=(1,32)                   
/*                                       

Output is:
Code:

00ROSHNI1020080910             
01RECORD  MAX  10203040506300MAX
01RECORD  MAX  20304050607300MAX
01RECORD  MAX  30405060708300MAX
01RECORD  MAX  40506070809300MAX
01RECORD  MAX  20304050607100MAX
01RECORD  MAX  40506070809200MAX
01RECORD  MAX  30405060708200MAX
02TRAILER                       
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Fri Oct 10, 2008 7:19 pm
Reply with quote

Thanks a lot for the solution.

But I have a problem. I want to retain records only with the (27:3) with 300, 100 and 200. And I dont want any other records to be in the output. All my previous requirements remain the same and in addition I dont want any record with 27:3 anything other than 100, 300 and 200.
Now say my input layout is this

Code:


00roshni1020080910           
01RECORD  MAX  10203040506300MAX
01RECORD  MAX  20304050607100MAX
01RECORD  MAX  40506070809200MAX
01RECORD  MAX  20304050607300MAX
01RECORD  MAX  30405060708300MAX
01RECORD  MAX  40506070809300MAX
01RECORD  MAX  30405060708200MAX
01RECORD  MAX  30405060708150MAX
01RECORD  MAX  40506070809700MAX
01RECORD  MAX  30405060708800MAX
0200000003




and my output should look like this

Code:


00roshni1020080910           
01RECORD  MAX  10203040506300MAX
01RECORD  MAX  20304050607300MAX
01RECORD  MAX  30405060708300MAX
01RECORD  MAX  40506070809300MAX
01RECORD  MAX  20304050607100MAX
01RECORD  MAX  40506070809200MAX
01RECORD  MAX  30405060708200MAX
0200000003



My output should neglect the last three records whic have 150, 700 and 800 in the position 27:3.

Can I use omit condition for this??
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 10, 2008 9:18 pm
Reply with quote

Roshini,

Try this DFSORT JCL

Code:

//STEP0100 EXEC PGM=ICEMAN                                   
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
00ROSHNI1020080910                                           
01RECORD  MAX  10203040506300MAX                             
01RECORD  MAX  20304050607100MAX                             
01RECORD  MAX  40506070809200MAX                             
01RECORD  MAX  20304050607300MAX                             
01RECORD  MAX  30405060708300MAX                             
01RECORD  MAX  40506070809300MAX                             
01RECORD  MAX  30405060708200MAX                             
02TRAILER                                                   
//SORTOUT DD SYSOUT=*                                       
//SYSIN    DD    *                                           
  INCLUDE COND=(1,2,SS,EQ,C'00,02',OR,                       
                27,3,SS,EQ,C'100,200,300')                   
                                                             
  INREC IFTHEN=(WHEN=(27,3,CH,EQ,C'300'),OVERLAY=(33:C'1')),
  IFTHEN=(WHEN=(27,3,CH,EQ,C'100'),OVERLAY=(33:C'2')),       
  IFTHEN=(WHEN=(27,3,CH,EQ,C'200'),OVERLAY=(33:C'3'))       
                                                             
  SORT FIELDS=(1,2,CH,A,33,1,CH,A)                           
                                                             
  OUTREC BUILD=(1,32)                                       
//*
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Mon Oct 13, 2008 11:14 am
Reply with quote

Thank you so much icon_smile.gif It worked just the way I wanted!!!! icon_smile.gif
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