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
 

 

Problem getting required output

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

New User


Joined: 14 Dec 2006
Posts: 6
Location: Ohio

PostPosted: Tue Dec 11, 2007 12:43 am    Post subject: Problem getting required output
Reply with quote

I am posting this here to see if I may get some help on my issue.

I have an input file that is 920 bytes.

There are four(4) record types (E05, E06, E07, and E10) within the file. The record type is in pos 61,3.

Each record also has a Member id at position 323,15.

For record types E05 and E06, I want to eliminate duplicates based on the Member ID and Record Type fields only.

For record type E07, an additional Date field is in position 397,8. For this record type, I want to eliminate duplicates as the other record types with the added requirement to keep the record with the most recent Date.

Record type E10 will be eliminated with this process. This is OK.

A final sort orders the file by Member ID, Record Type and also reorganizes the record to move Member ID and Record Type to the beginning of the record.

Below are my sort cards.

Code:
//*INPUT FILE                                           
//INFIL1    DD DSN=WTSO.INPUT.FILE,
//                DISP=SHR         
//*                                                     
//*TEMP FILE                                           
//TEMPDD    DD DSN=&TEMPDD,                             
//             DISP=(NEW,PASS),                         
//             SPACE=(CYL,(100,100),RLSE)               
//*                                                     
//*OUTPUT FILE                                         
//OUTFL1    DD DSN=WTSO.OUTPUT.FILE,                 
//             DISP=(NEW,CATLG,DELETE),                 
//             DCB=(RECFM=FB,LRECL=920,BLKSIZE=0),     
//             UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE),   
//             VOL=SER=                                 
//*                                                     
//TOOLIN    DD *                                       
* SELECT 'E05' TYPE RECORDS AND PUT IN TEMP FILE       
  SELECT FROM(INFIL1) TO(TEMPDD) ON(323,15,CH) FIRST - 
     USING(SRT1)           
*                           
* SELECT 'E06' TYPE RECORDS AND PUT IN TEMP FILE       
  SELECT FROM(INFIL1) TO(TEMPDD) ON(323,15,CH) FIRST -
     USING(SRT2)                                       
*
* SELECT 'E07' TYPE RECORDS AND PUT IN TEMP FILE       
  SELECT FROM(INFIL1) TO(TEMPDD) ON(323,15,CH) FIRST -
     USING(SRT3)     
*                                 
* SORT TEMP FILE AND PUT IN OUTPUT FILE               
  COPY FROM(TEMPDD) TO(OUTFL1) USING(SRT4)             
/*                                                     
//SRT1CNTL DD *                                       
* WRITE MATCHING RECORDS(E05) TO TEMP FILE 1           
  SORT FIELDS=(61,3,CH,A,323,15,CH,A)                 
  OUTFIL FNAMES=TEMPDD,INCLUDE=(61,3,CH,EQ,C'E05')     
/*                                                     
//SRT2CNTL DD *                                       
* WRITE MATCHING RECORDS(E06) TO TEMP FILE 2           
  SORT FIELDS=(61,3,CH,A,323,15,CH,A)                 
  OUTFIL FNAMES=TEMPDD,INCLUDE=(61,3,CH,EQ,C'E06')     
/*                                                     
//SRT3CNTL DD *                                   
* WRITE MATCHING RECORDS(E07) TO TEMP FILE 3       
  SORT FIELDS=(61,3,CH,A,323,15,CH,A,397,8,BI,D)   
  OUTFIL FNAMES=TEMPDD,INCLUDE=(61,3,CH,EQ,C'E07')
/*                                                 
//SRT4CNTL DD *                                   
* SORT FINAL OUTPUT FILE                           
  SORT FIELDS=(323,15,CH,A,61,3,CH,A)             
  OUTREC FIELDS=(323,15,                           
                 61,3,                             
                 1,60,                             
                 64,256,                           
                 320,3,                           
                 338,256,                         
                 594,256,                         
                 850,71)                           
/*                                                 
//*                                               


For my output, I am only getting type E07 records. The output appears correct for the record type, however I need all record types in the output. I can't put my finger on where my problem is.
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Dec 11, 2007 12:52 am    Post subject: Re: Problem getting required output
Reply with quote

leedtech wrote:
I can't put my finger on where my problem is.


I don't see DISP=MOD on TEMPDD. Don't you open, write, and close it several times during this one step with each SELECT statement you call?
Back to top
View user's profile Send private message
leedtech

New User


Joined: 14 Dec 2006
Posts: 6
Location: Ohio

PostPosted: Tue Dec 11, 2007 1:05 am    Post subject:
Reply with quote

Thank you very much for the quick reply.

Your suggestion seems to have fixed my issue.

Thank you.
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 Dec 11, 2007 1:57 am    Post subject:
Reply with quote

Your job is not very efficient. For one thing, you should use an INCLUDE statement to keep only the records you need for the SELECT to reduce the number of records that are sorted. An INCLUDE statement removes records before sorting, whereas an INCLUDE operand of OUTFIL doesn't remove the records until after sorting.

It looks like you could replace the first two SELECT operators with one SELECT operator, e.g.

Code:

  SELECT FROM(INFIL1) TO(TEMPDD) ON(323,15,CH) FIRST - 
     USING(SRT1)     
  SELECT FROM(INFIL1) TO(TEMPDD) ON(323,15,CH) FIRST -
     USING(SRT3)     
  SORT FROM(TEMPDD) TO(OUTFL1) USING(SRT4)   
/*
//SRT1CNTL DD *
  INCLUDE COND=(61,3,SS,EQ,C'E05,E06')   
  SORT FIELDS=(61,3,CH,A,323,15,CH,A)                 
...


You may even be able to replace the first three SELECT operators with one SELECT operator, but it depends on whether sorting on the third field would make any difference for 'E05' and 'E06' - it might make a difference but I can't tell since you haven't shown your input and output records:

Code:

  SELECT FROM(INFIL1) TO(TEMPDD) ON(323,15,CH) FIRST - 
     USING(SRT1) 
  SORT FROM(TEMPDD) TO(OUTFL1) USING(SRT4)   
/*
//SRT1CNTL DD *
  INCLUDE COND=(61,3,SS,EQ,C'E05,E06,E07')   
  SORT FIELDS=(61,3,CH,A,323,15,CH,A,397,8,BI,D)   
...


Although it's probably not likely, you may be able to eliminate the extra SORT operator as well, but again I can't tell since you haven't shown your input and output records.
Back to top
View user's profile Send private message
leedtech

New User


Joined: 14 Dec 2006
Posts: 6
Location: Ohio

PostPosted: Tue Dec 11, 2007 3:48 am    Post subject:
Reply with quote

Frank,

I do see where combining the first 2 sorts will make the sort more efficient.

I wasn't aware of the implications of using INCLUDE in the manner I did. I have modified the sort accordingly to put the INCLUDE before the sort.

I will also look into the impact of including the 3rd sort field with the other record types to see if this can be simplified further as per your recommendation. Each record type has a different layout and the Member Id and record type are the only common fields (for my purposes).

Thank you for your time.
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 Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm


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