MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

header and trailer needed in split files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Wed Oct 15, 2003 6:24 pm    Post subject: header and trailer needed in split files Reply with quote

DFSORT requirement:
I have a requirement which says there 3 input files, each containing header and trailer, and 100,200, 300 records respectively.

I need to repartiton these 3 files into 2 files such that each
will contain header and footer information. They should contain say 150
records each depending on some sort criteria. The header in both the
output files should be same as the header info in any 1 of the input
file (it contains date etc). And the trailer in both the files, should
contain number of records in that file.

I should also need 1 temp file which just contains 6
records. this should be:
header from Input file 1
header from Input file 2
header from Input file 3
trailer from Input file 1
trailer from Input file 2
trailer from Input file 3

I heard that the TRAILER option of the dfsort works only if the record length is 132 or less.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Oct 15, 2003 7:03 pm    Post subject: Reply with quote

Some questions:

What identifies a header record? Does it have something in it that identifies it (e.g. a '0' in position 1). If so, what? Or is the header record only identified by being the first record in the file?

What identifies a trailer record? Does it have something in it that identifies it (e.g. a '9' in position 1). If so, what? Or is the trailer record only identified by being the last record in the file?

What is the starting position and length of the record count you want in the trailer records? What do you want these counts to look like?

What is the RECFM and LRECL of the input files?

Quote:
I heard that the TRAILER option of the dfsort works only if the record length is 132 or less.


You heard wrong. The TRAILER option of DFSORT works with any record length.

Quote:
They should contain say 150 records each depending on some sort criteria.


What do you mean by this? How exactly do you want to select the records for the two output files? Do you mean INCLUDE criteria rather than sort criteria? If not, what exactly do you mean?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Fri Oct 17, 2003 4:57 pm    Post subject: Reply with quote

The header would be identified by a word callled as 'hdrdate'
The tailer would be identified by word 'CNTR'

Yes, you are right, I actually meant Include criteria, and not the sort criteria. The include condition could be anythign that could make the too files equal. That would be decided during execution. So you can ignore the actual Include condition for the time being

As of now, we have a 9 digit trailer counter field. The trailer should look like
TRAILER=(2:"Trailer Counter",COUNT).

The length of the input record is around 1400 bytes

thanks
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Oct 17, 2003 5:47 pm    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job that will do what I think you're asking for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//CON DD DSN=...  input file1
//    DD DSN=...  input file2
//    DD DSN=...  input file3
//OUT1 DD DSN=&&O1,UNIT=SYSDA,SPACE=(CYL,(5,5)),
//***> Use MOD for OUT1
// DISP=(MOD,PASS)
//OUT2 DD DSN=&&O2,UNIT=SYSDA,SPACE=(CYL,(5,5)),
//***> Use MOD for OUT2
// DISP=(MOD,PASS)
//OUT3 DD DSN=&&O3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
* Write one header record to OUT1 and OUT2
  COPY FROM(CON) TO(OUT1,OUT2) USING(CTL1)
* MOD the detail records and trailer records
* to OUT1 and OUT2
  COPY FROM(CON) USING(CTL2)
/*
//CTL1CNTL DD *
* Write the first header record to OUT1 and OUT2.
* Stop after reading/writing the header record.
  INCLUDE COND=(1,7,CH,EQ,C'hdrdate')
  OPTION STOPAFT=1
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT1,REMOVECC,
* OUT1:  output file1.
* Omit the header and trailer records.  Keep the needed records.
* Write the trailer as the last record.
    INCLUDE=(1,7,CH,NE,C'hdrdate',AND,1,4,CH,NE,C'CNTR',AND,
      additional conditions),
    TRAILER1=(2:'Trailer Counter',COUNT)
  OUTFIL FNAMES=OUT2,REMOVECC,
* OUT2:  output file2.
* Omit the header and trailer records.  Keep the needed records.
* Write the trailer as the last record.
    INCLUDE=(1,7,CH,NE,C'hdrdate',AND,1,4,CH,NE,C'CNTR',AND,
      additional conditions),
    TRAILER1=(2:'Trailer Counter',COUNT)
* OUT3:  output file3.
* Create file with all header and trailer records.         
  OUTFIL FNAMES=OUT3,REMOVECC,                             
    INCLUDE=(1,7,CH,EQ,C'hdrdate',OR,1,4,CH,EQ,C'CNTR')   
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Mon Oct 20, 2003 10:42 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Mon Oct 20, 2003 9:47 am    Post subject: Reply with quote

Hi Frank,
thanks for this. This definately takes care of the primary requirement. But there is also a secondary requirement, which is to creates 1 file which just contains the header and trailer records of all input files. I should be able to this in the same step, i.e without increasing the number of passes on the data.

This file should look like
header from Input file 1
header from Input file 2
header from Input file 3
trailer from Input file 1
trailer from Input file 2
trailer from Input file 3

Thanks all the same
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Oct 20, 2003 10:43 am    Post subject: Reply with quote

Oops, I forgot about that part. I've updated the DFSORT/ICETOOL job above to create OUT3 with all of the headers and trailers.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Mon Oct 20, 2003 1:26 pm    Post subject: Reply with quote

Frank,

Da_one wanted all the header records as a group and the all the footer records as one group.But with a copy operation you will get a header followed by a footer record.Or am I intrepreting the question differently?

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Oct 20, 2003 2:02 pm    Post subject: Reply with quote

Kolusu,

I assumed Da_one just wanted all of the header and trailer records in one file and didn't care about their order. I guess he/she will have to let us know if the order is important. If so, that would require some modifications to the job.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
da_one
Beginner


Joined: 15 Oct 2003
Posts: 11
Topics: 4

PostPosted: Mon Oct 20, 2003 6:11 pm    Post subject: Reply with quote

Hi Frank, it would have been great if I could do that, but this is great by itelf. I will just need to change the program that was going to read this header trailer file. But thats ok. thanks a lot
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Oct 21, 2003 10:13 am    Post subject: Reply with quote

Well, we could do it, but we'd have to do a sort on the header/trailer record file to get the header/trailer records into the sequence you want
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group