View previous topic :: View next topic
|
Author |
Message |
vinit
New User
Joined: 31 Jul 2006 Posts: 8 Location: TCS, INDIA
|
|
|
|
hi all
iam facing a problem in adding some fields in the extract file, which is created through cobol.
i have to add some field names to the existing record in the extract
can anyone tell |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Vinit,
Would u please elaborate ur question by providing example |
|
Back to top |
|
|
vinit
New User
Joined: 31 Jul 2006 Posts: 8 Location: TCS, INDIA
|
|
|
|
output of a cobol prog
in the extract file
no. name add so on <== to be added
121 sdds 3232 sdfsdfs
i want to add a row which shows the records actual name |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Vinit,
Still its not clear
Quote: |
I have to add some field names to the existing record in the extract |
Quote: |
no. name add so on <== to be added
121 sdds 3232 sdfsdfs
i want to add a row which shows the records actual name |
|
|
Back to top |
|
|
vinit
New User
Joined: 31 Jul 2006 Posts: 8 Location: TCS, INDIA
|
|
|
|
suppose i have writen a cobol program which produces an extract file with some records in it
example:
Code: |
121 sdds 3232 sdfsdfs |
now i want to add a row which identifies each record through cobol prog.
Code: |
no. name addre. city <== row to be added |
i have to do this through cobol
i hope it is clear now |
|
Back to top |
|
|
Aji
New User
Joined: 03 Feb 2006 Posts: 53 Location: Mumbai
|
|
|
|
Hi
Take the backup of the existing extract file.
Create a new FD with the appended fileds.
read first file with old FD, and write into newfile with new fd.
Aji Cherian |
|
Back to top |
|
|
mani_jnumca
New User
Joined: 18 Jan 2006 Posts: 16 Location: PUNE
|
|
|
|
i means to say that u want to add a row as header
simply fist populate the field with the header value
with the appropriate positions.... |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Terminology problems...
vinit wrote: |
extract file with some records in it
example:
Code: |
121 sdds 3232 sdfsdfs |
|
Does the above represent one record with 4 fields or 4 records?
Quote: |
now i want to add a row which identifies each record through cobol prog.
Code: |
no. name addre. city <== row to be added |
|
Rows are in tables, not extract files, why the change in terminology?
Quote: |
i hope it is clear now |
Not yet, but we're working on it.... |
|
Back to top |
|
|
vinit
New User
Joined: 31 Jul 2006 Posts: 8 Location: TCS, INDIA
|
|
|
|
Thanks ALL |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Huh? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Vinit,
Is your problem solved?
If not, in the COBOL program, after opening the output file, write one record that is all of the header info. You can do this by defining a "header" record in working-storage and writing from it. Just line up the values so they come out over the correct positions in your data records.
My understanding is shaky sometimes, so if that will not do what you need, just let us know. |
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
first write the records that you want and add new that you want
check following programe
Code: |
- ID DIVISION.
PROGRAMME-ID. ADDITION.
ENVIRONMENT DIVISION.
SELECT FILE1 ASSIGN TO DD1
FILE STATUS IS FS1.
SELECT FILE2 ASSIGN TO DD2
FILE STAUS IS FS2.
DATA DIVISION.
FD FILE1.
01 INPUT
02 X PIC X(80).
FD FILE2
01 OUTPUT.
[--- 02 ECODE PIC X(3).
OLD RECORD[ 02 FILLER PIC X.
[ 02 ESAL PIC X(4)
[ 02 FILLER PIC X.
02 NEW1 PIC X(8)
02 FILLER PIC X(67).
PROCEDURE DIVISION.
OPEN FILE1 OUTPUT MODE.
READ FILE1
IF FS1=0
THEN
MOVE INPUT TO OUTPUT
MOVE "URBRILLIANT" TO NEW1
WRITE OUTPUT
STOP RUN. |
====================================== |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Please re-post the code "solution" to include the data Vinit provided. Assume that there are more than one input records because while there may be only 1 example record, it is likely that when this runs for "real" there will be multiples.
The "solution" as posted will not do what Vinit needs. I doubt that FILE1 would be opened as output. FILE2 is not opened at all. If the posted code was eventually made to run, it would add a literal to whatever data was in the first input record possibly moving the literal over some of the good data.
We'll be here for version2 |
|
Back to top |
|
|
|