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
 

 

Adding field names in the extract file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vinit

New User


Joined: 31 Jul 2006
Posts: 8
Location: TCS, INDIA

PostPosted: Fri Feb 02, 2007 10:24 am    Post subject: Adding field names in the extract file
Reply with quote

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
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Feb 02, 2007 10:31 am    Post subject:
Reply with quote

Hi Vinit,

Would u please elaborate ur question by providing example
Back to top
View user's profile Send private message
vinit

New User


Joined: 31 Jul 2006
Posts: 8
Location: TCS, INDIA

PostPosted: Fri Feb 02, 2007 11:17 am    Post subject: clarification
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Feb 02, 2007 11:20 am    Post subject:
Reply with quote

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
View user's profile Send private message
vinit

New User


Joined: 31 Jul 2006
Posts: 8
Location: TCS, INDIA

PostPosted: Fri Feb 02, 2007 11:26 am    Post subject:
Reply with quote

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
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Fri Feb 02, 2007 3:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mani_jnumca

New User


Joined: 18 Jan 2006
Posts: 16
Location: PUNE

PostPosted: Fri Feb 02, 2007 3:17 pm    Post subject: Re: Adding field names in the extract file
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Feb 02, 2007 3:28 pm    Post subject:
Reply with quote

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.... icon_smile.gif
Back to top
View user's profile Send private message
vinit

New User


Joined: 31 Jul 2006
Posts: 8
Location: TCS, INDIA

PostPosted: Fri Feb 02, 2007 3:50 pm    Post subject:
Reply with quote

Thanks ALL
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Feb 02, 2007 4:03 pm    Post subject:
Reply with quote

vinit wrote:
Thanks ALL
Huh? icon_rolleyes.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Feb 03, 2007 2:33 am    Post subject:
Reply with quote

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. icon_smile.gif
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Mon Feb 05, 2007 2:05 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Feb 05, 2007 4:06 am    Post subject:
Reply with quote

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 icon_smile.gif
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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