Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us