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
 

 

making OUTFIL's Trailer1 a Header1

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

New User


Joined: 31 Dec 2012
Posts: 31
Location: England

PostPosted: Fri May 31, 2013 5:22 pm    Post subject: making OUTFIL's Trailer1 a Header1
Reply with quote

OUTFIL's Trailer1 has counts and aggregates that can find use as a Header1 (which doesn't have the same counts for obvious reasons), but how to do it?
What I'd like to do is to take an input dataset, get counts, etc., then put a record of those counts as the first record.
My best thought at the moment is to read the input file and write just the Trailer1 record to a temporary dataset, then to Merge this sole record dataset with the original file. This would take two steps - one with a COPY and OUTFIL, and another with a MERGE: can it be done better, especially in just one step?
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri May 31, 2013 5:43 pm    Post subject:
Reply with quote

Do you mind pasting the code which you tried?

I couldnt follow your description pretty clear
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Fri May 31, 2013 7:11 pm    Post subject: Re: making OUTFIL's Trailer1 a Header1
Reply with quote

Jim Alton wrote:
OUTFIL's Trailer1 has counts and aggregates that can find use as a Header1 (which doesn't have the same counts for obvious reasons), but how to do it?
What I'd like to do is to take an input dataset, get counts, etc., then put a record of those counts as the first record.
My best thought at the moment is to read the input file and write just the Trailer1 record to a temporary dataset, then to Merge this sole record dataset with the original file. This would take two steps - one with a COPY and OUTFIL, and another with a MERGE: can it be done better, especially in just one step?


If you just want original file, with a header at the front, one possibility which avoids another pass of the data is just to use "concatenation" to deal with the "file" (treat it as a "virtual file" consisting of two physical datasets). If your data is "huge", this may be effective. For smaller amounts of data, you might not want (or be able to have due to standards, audit requirements, whatever) this approach due to the extra "complexity".

JOINKEYS with the same file as the two inputs will be able to do what you want, using SUM in one of the CNTL files, but requires a SORT of the data.

To use MERGE your data needs to be in sequence on a key, and that key has to be "lowest" for your header. You can use INREC and OUTREC if you need to "fake-up" a key.

If your data is not in sequence, you can use JOINKEYS to insert the header.

So, what is your data like?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri May 31, 2013 10:52 pm    Post subject: Re: making OUTFIL's Trailer1 a Header1
Reply with quote

Jim Alton wrote:
This would take two steps - one with a COPY and OUTFIL, and another with a MERGE: can it be done better, especially in just one step?


As Bill pointed out there is a trick to get the count of records as the first record using a single step of JOINKEYS with just a COPY operation. You don't have to perform SORT.
Back to top
View user's profile Send private message
Jim Alton

New User


Joined: 31 Dec 2012
Posts: 31
Location: England

PostPosted: Mon Jun 03, 2013 12:38 am    Post subject: Reply to: making OUTFIL's Trailer1 a Header1
Reply with quote

Dear Bill,

Thanks for your reply and the suggestion that JOINKEYS will satisfy my need (I'm not familiar with JOINKEYS so will have to learn about its functionality that will achieve this) but I don't understand your first suggestion:
Quote:
If you just want original file, with a header at the front, one possibility which avoids another pass of the data is just to use "concatenation" to deal with the "file" (treat it as a "virtual file" consisting of two physical datasets). If your data is "huge", this may be effective. For smaller amounts of data, you might not want (or be able to have due to standards, audit requirements, whatever) this approach due to the extra "complexity".

What are you concatenating and treating as a virtual file? And what is a virtual file - how is it created and manipulated?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Jun 03, 2013 2:59 am    Post subject: Reply to: making OUTFIL's Trailer1 a Header1
Reply with quote

Code:
//MYFILE DD DSN=MYFILE.WITH.THE.HEADER,DISP=OLD

//MYFILE DD DSN=MYFILE.THE.HEADER,DISP=OLD
//       DD DSN=MYFILE.THE.DATA,DISP=OLD


In the first example, the header was written, then all the data copied to it.

With the second, the header was written, but then a simple concatenation in the JCL gets you the entire input, although it consists of two DSNs.

It is my invention to call it a "virtual" file, not a specific terminological meaning.

If you have 732,000,000 records, this can save a bit of processing, at the expense of making the JCL (not very much) more complicated. Some site standards and audit requirements may not allow this.

For "small" (a relative term) volumes of data someone may argue that the additional "complexity" outweighs the saving.

My experience with Auditors is that they like all the data that is part of the same file to be in the same file.

It is an option, and something to be seriously considered for large volumes. Avoids extra DASD usage and lengthening of the Critical Path as well as the 250-365 times a year processing cost just to get that header at the front.
Back to top
View user's profile Send private message
Jim Alton

New User


Joined: 31 Dec 2012
Posts: 31
Location: England

PostPosted: Mon Jun 03, 2013 6:57 pm    Post subject: Reply to: making OUTFIL's Trailer1 a Header1
Reply with quote

Dear Bill,

I see what you're getting at - either you do further processing on the merged (not necessarily DFSORT MERGEd) file or you don't merge and try to continue processing with the files as a concatenation.
Regarding the worth or need of performing this process, in my installation, special (small) programs have been created to provide in a header record the counts that are found in the Trailer1 record.
Talk of virtual files threw me a bit. If you had instead de-virt-ed from the virtual you would have come up with dual.
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 HEADER1 error in JCL pshongal SYNCSORT 4 Fri Sep 02, 2016 12:15 pm
No new posts Appending 1 after 61 records using He... l.nethaji DFSORT/ICETOOL 2 Tue Feb 02, 2016 11:51 am
No new posts OUTREC on OUTFIL error rocky_balboa DFSORT/ICETOOL 4 Thu Aug 27, 2015 10:26 am
No new posts Making Reference Phrase field " ... Casper656 TSO/ISPF 11 Thu Feb 05, 2015 7:05 pm
No new posts OMIT other unsatisfied records in OUT... tvinodkumar7 DFSORT/ICETOOL 6 Thu Jan 08, 2015 1:33 pm


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