I am executing a COBOL-DB2 program wherein i am generating a output file by name UNIT.ABCD.OUTPUT.G in a GDG version.Moreover i am also assining values to HEADER and TRAILER datasets in my program at runtime.I would like to have in my output file first the header dataset to be printed,second the output file to be printed and then the trailer dataset like this:.Can anybody guide me if i am correct or not as i want to have that satisfied in STEP001 only instead of using one more step using IEBGENER to concatinate the datasets?
HEADER DATASET
OUTPUT DATASET
TRAILER DATASET
Code:
For example : UNIT.ABCD.OUTPUT.G(+1)
------------
********************************* Top of Data **********************************
00000ABCD HDR TOP SHELL
RAM 24
ANIL 18
MAHESH 46
ANDY 67
00000ABCD TRL BOT SHELL
********************************* Bottom of Data *******************************
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Sat Sep 17, 2005 12:30 am Post subject:
Shekar123,
I am not clear with your request. Let me know if my understanding is correct.
1. You are writing some data to your output file which is a GDG.
2. You want to include header and trailer records into that.
3. The Header and Trailer records are stored in two files UNIT.ABCD.HEADER and UNIT.ABCD.TRAILER.
Your question:
Can we write these header / trailer records into the output file in STEP01 or do we need to add a new IEBGENER/SORT step to concatenate these ?
Assuming this is your question, the answer will be - YES - you can achieve this in STEP01 ifself. Provided you need to change your program 'ABCD' a bit.
1. Before writing any records the output file, read your header file and write its contents to your output GDG. This will become the first record.
2. Read your database and generate DETAIL records.
3. Just before closing your output GDG, read the contents of TRAILER file and write them to your output file.
Posted: Sat Sep 17, 2005 12:21 pm Post subject: Concatinate Header and Trailer
Hai,
Thanks for your reply,but your understanding is not correct .Basically i want to write data to a file which is a GDG.But in the GDG,first i want to write the header record which i have declared as a file , then the details records , then the trailer rec which also i have decalared as a file.The reason behind why i want to do this is ,i want to assign some values to both header record and trailer record in program execution.
With my JCL i can execute my program and generate the output routed to a simple GDG file without header and trailer and in the second step i can concatinate all of them three( header + detail + trailer ) and copy it to one more GDG.But i do not want to use two steps ,i want to use only one step which will execute the program and generate the ouput file in GDG with Header and trailer basically i want to avoid concatination step.
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Sun Sep 18, 2005 4:36 am Post subject:
Shekar123,
Quote:
With my JCL i can execute my program and generate the output routed to a simple GDG file without header and trailer and in the second step i can concatinate all of them three( header + detail + trailer ) and copy it to one more GDG.
I have few more questions.
1. Are you reading / updating the contents of Header & Trailer files. If not, what is the reason behind giving them as input to your program ?
2. Do you really need to GDGs ? one without header/trailer and other with header-detail-trailers
3. Do you have the authorization to change your COBOL program ? if Yes, then as I said earlier, why don't you change the program and read your Header/Trailer datasets and write their contents to your output GDG along with the detail records ?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum