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

Producing ouput file with header using DFSORT


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

New User


Joined: 08 Mar 2005
Posts: 20

PostPosted: Thu Mar 15, 2007 3:45 pm
Reply with quote

Hi ,
I am doing cobol , db2 program . Ouput is a from program report file wthout header. but i need to have a header for that file using DFSORT

Input for program : db2 tables (no files)

report oupute file with header


can u help how to add header to ouput file using DFSORT


Thanks

Arunachalla
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Mar 15, 2007 3:50 pm
Reply with quote

What does the header contain? Is the header going to remain constant?
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Thu Mar 15, 2007 4:06 pm
Reply with quote

Hey

The simple solution to this is to add the logic to write the header in the program itself.
Back to top
View user's profile Send private message
jagadish2005

New User


Joined: 08 Mar 2005
Posts: 20

PostPosted: Thu Mar 15, 2007 4:54 pm
Reply with quote

Hi murmohk1

My header is going remain constant ex:

Code:

Name                 age
-----------          -----
arunachalla          23
....


like this

Thanks
Jagadish Raju
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Thu Mar 15, 2007 5:04 pm
Reply with quote

Here is the code:

Code:

//step111 exec  pgm=sort
//sysout dd sysout=*
//sortin dd dsn=your.input.file,disp=....         
//sortout dd dsn=op.file,disp=....
//sysin dd *
  sort fields=copy
  OUTFIL REMOVECC,
   header1=(c'name......',             * put header here
                   /,                             * new line
                  80c'-' )                       
/*


Assumed your OP file is 80 in lenght
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: Thu Mar 15, 2007 8:46 pm
Reply with quote

Arunachalla,

HEADER1 will give you ONE header at the beginning of the report. HEADER2 will give you a header at the beginning of each page. Which one you would use depends on which type of header you want.

Assuming you want a page header, the following DFSORT job will do what you asked for. If you want a report header, change HEADER2 to HEADER1. If you don't want ANSI carriage control characters (e.g. '1' for eject), specify REMOVECC on the OUTFIL statement.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
arunachalla          23
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL HEADER2=(1:'Name',22:'age',/,
    1:11'-',22:5'-')


For more information on creating reports with DFSORT's OUTFIL, see:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.6.8?DT=20060615173822
Back to top
View user's profile Send private message
jagadish2005

New User


Joined: 08 Mar 2005
Posts: 20

PostPosted: Fri Mar 16, 2007 8:52 pm
Reply with quote

Hi Friends

I want to copy the data from one to another file

Input file : (length of input 169, DOES NOT contain any header)

Code:

AAAA1234EEEE
BBBB1234EEEE


output file : (length of 200, header should be added)

Code:

HEADER1     HEADER2   HEADER3
AAAA        1234      EEEE
BBBB        1234      EEEE


i need to do this using DFSORT. I tried it but itis not working , getting length error. How to solve this problem

Thanks
Arunachalla
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: Fri Mar 16, 2007 9:23 pm
Reply with quote

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/169)
//SORTOUT DD DSN=...  output file (FB/200)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,
    HEADER1=(1:'HEADER1',13:'HEADER2',23:'HEADER3'),
    BUILD=(1,4,13:5,4,23:9,4,200:X)
/*
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 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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top