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

Add header and footer records to a sequential file


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

New User


Joined: 25 Jan 2007
Posts: 42
Location: france

PostPosted: Wed Nov 19, 2008 9:49 pm
Reply with quote

Hi all,

What is the best way to add a header and a footer records to a file.

infile is like this
record 001
record 002
record 003
record 004

What I whish in the output file
header record
record 001
record 002
record 003
record 004
footer record

Also , I need to add an other record (after the footer) that contain the records number of the file (except the header and footer).

For a moment I wrote this
Code:

//HEADER   DD *                                       
---- HEADER ----------                               
/*                                                   
//FOOTER   DD *                                       
---- FOOTER ----------                               
/*                                                   
//INF      DD *                                       
RECORD 001                                           
RECORD 002                                           
RECORD 003                                           
RECORD 004                                           
/*                                                   
//******                                             
//OUTF     DD SYSOUT=*                               
//TMPA     DD DSN=&SYSUID..TMPA,DISP=(,DELETE),       
//            DATACLAS=DC100F,LRECL=80       
//TOOLIN   DD *                             
  DEFAULTS LIST(SHOWDEF)                     
 COPY FROM(INF) TO(TMPA) USING(CTL2)         
 COPY FROM(HEADER) TO(OUTF)                 
 COPY FROM(INF) TO(OUTF)       
 COPY FROM(FOOTER) TO(OUTF)                 
 COPY FROM(TMPA) TO(OUTF)                   
/*                                           
//* -----------------------------------------
//CTL2CNTL DD *                             
 OUTFIL FNAMES=TMPA,REMOVECC,NODETAIL,       
 TRAILER1=(/,' RECORD NUMBER: ',COUNT)       
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 19, 2008 10:20 pm
Reply with quote

Wow. That's one of the most convoluted "solutions" to a simple problem I've seen.

Here's a simple DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
record 001
record 002
record 003
record 004
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
   HEADER1=('---- HEADER ----------'),
   TRAILER1=('---- FOOTER ----------',/,
       ' RECORD NUMBER: ',COUNT)
/*


SORTOUT will have:

Code:

---- HEADER ----------       
record 001                   
record 002                   
record 003                   
record 004                   
---- FOOTER ----------       
 RECORD NUMBER:        4     
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top