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
 

 

Add header and footer records to a sequential file

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

New User


Joined: 25 Jan 2007
Posts: 32
Location: france

PostPosted: Wed Nov 19, 2008 9:49 pm    Post subject: Add header and footer records to a sequential file
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 Moderator


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

PostPosted: Wed Nov 19, 2008 10:20 pm    Post subject:
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    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 SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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