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

DFSORT/ICETOOL Requirement


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

New User


Joined: 24 May 2006
Posts: 7

PostPosted: Thu Dec 17, 2009 3:53 pm
Reply with quote

I have an input file which is an FB (1500 LRECL). My point of interest are two fields in them.
1. Reference number
2. Flag which needs to be set the same for the a given reference number.

The input file would like this

Input File

D1234567.........R.......
D1234567.........R.......
D1234567.........X.......
D1234567.........L.......
D1234568.........L.......
D1234568.........X.......
D1234568.........L.......
D1234568.........L.......
D1234569.........L.......
D1234569.........L.......
D1234569.................

As you can see the first 8 chars are the reference numbers which are sorted and the single byte char (which contains 'R' or 'X' or 'L' ) are the flags to be set. It would be required that all records of a specific reference number to be set with one single flag.

All records to be filled with 'R' if any one of the record contains 'R'
All records to be filled with 'X' if any one of the record contains 'X' and none of them have an 'R'
All records to be filled with 'L' if any one of the record contains 'L' and none of them have an 'R' or an 'X'.

Essentially the output record should be as below

D1234567.........R.......
D1234567.........R.......
D1234567.........R.......
D1234567.........R.......
D1234568.........X.......
D1234568.........X.......
D1234568.........X.......
D1234568.........X.......
D1234569.........L.......
D1234569.........L.......
D1234569.........L.......

I would like the above to be done with DFSORT ( ICETOOL ).
Saran
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Dec 17, 2009 4:06 pm
Reply with quote

Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT and will be moved into the JCL forum by one of the moderators. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in you site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
saranyan_j

New User


Joined: 24 May 2006
Posts: 7

PostPosted: Thu Dec 17, 2009 4:12 pm
Reply with quote

Im sorry for not being specific before. We use product DFSORT and the line containing ICE201I is below

ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Thu Dec 17, 2009 5:08 pm
Reply with quote

Hi Saran,
Below sortstep will give you desired output...
Code:

//S1    EXEC  PGM=SORT                                     
//SORTIN DD *                                             
D1234567.........R.......                                 
D1234567.........R.......                                 
D1234567.........X.......                                 
D1234567.........L.......                                 
D1234568.........L.......                                 
D1234568.........X.......                                 
D1234568.........L.......                                 
D1234568.........L.......                                 
D1234569.........L.......                                 
D1234569.........L.......                                 
D1234569.................                                 
//SORTOUT DD SYSOUT=*                                     
//SYSOUT    DD  SYSOUT=*                                   
//SYSIN    DD  *                                           
  SORT FIELDS=(1,8,CH,A,1501,1,CH,A)                         
  INREC IFTHEN=(WHEN=(18,1,CH,EQ,C'R'),OVERLAY=(1501:C'1')),
        IFTHEN=(WHEN=(18,1,CH,EQ,C'X'),OVERLAY=(1501:C'2')),           
        IFTHEN=(WHEN=(18,1,CH,EQ,C'L'),OVERLAY=(1501:C'3')),           
        IFTHEN=(WHEN=NONE,OVERLAY=(1501:C'4'))                         
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(1502:SEQNUM,8,ZD,RESTART=(1,8))), 
         IFTHEN=(WHEN=GROUP,BEGIN=(1502,8,ZD,EQ,1),PUSH=(18:18,1))     
  OUTFIL BUILD=(1,1500)                                               
/*                                                                   

Output will be...
Code:

D1234567.........R.......       
D1234567.........R.......       
D1234567.........R.......       
D1234567.........R.......       
D1234568.........X.......       
D1234568.........X.......       
D1234568.........X.......       
D1234568.........X.......       
D1234569.........L.......       
D1234569.........L.......       
D1234569.........L.......       
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
Search our Forums:

Back to Top