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
 
2 input files with the same copybook format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
selvamphigai

New User


Joined: 22 Jan 2010
Posts: 11
Location: chennai

PostPosted: Sun May 02, 2010 7:58 pm    Post subject: 2 input files with the same copybook format
Reply with quote

Hi,Can anyone pls clarify my doubts .

I have 2 input files ,say EOD file & SOD file
These 2 files has the same layout with same fields inside. but in cobol programs we should not declare the same 2 copybooks twice .

In FD section,how can i declare the 2 copybooks for these 2 input files ? I can use replacing command but i hav to include the copybook names,is it possible or is there anyother way.???
Here is the example ,

Code:
FD  I-SOD                                                 
    LABEL RECORDS ARE STANDARD                                 
    BLOCK CONTAINS 0 RECORDS                                   
    RECORDING  MODE  IS F.                                     
                                                               
01  SOD-REC.                                               
    COPY FILEDATA REPLACING == :FILEDATA: == BY == SOD ==. 
                                                               
FD  I-EOD                                                   
    LABEL RECORDS ARE STANDARD                                 
    BLOCK CONTAINS 0 RECORDS                                   
    RECORDING  MODE  IS F.                                     
                                                               
01  EOD-REC.                                               
    COPY FILEDATA REPLACING == :FILEDATA: == BY == EOD ==. 

Here FILEDATA is the copybook for the 2 inputs SOD & EOD .
The variables inside the layout will be like ,
FILEDATA-ACCT,FILEDATA-ADDRESS,FILEDATA-NAME, ETC ETC.
PLease respond ASAP
Back to top
View user's profile Send private message

Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Sun May 02, 2010 8:26 pm    Post subject: Re: 2 input files with the same copybook format
Reply with quote

selvamphigai wrote:
Hi,Can anyone pls clarify my doubts .

I have 2 input files ,say EOD file & SOD file
These 2 files has the same layout with same fields inside. but in cobol programs we should not declare the same 2 copybooks twice .

In FD section,how can i declare the 2 copybooks for these 2 input files ? I can use replacing command but i hav to include the copybook names,is it possible or is there anyother way.???
Here is the example ,

Code:
FD  I-SOD                                                 
    LABEL RECORDS ARE STANDARD                                 
    BLOCK CONTAINS 0 RECORDS                                   
    RECORDING  MODE  IS F.                                     
                                                               
01  SOD-REC.                                               
    COPY FILEDATA REPLACING == :FILEDATA: == BY == SOD ==. 
                                                               
FD  I-EOD                                                   
    LABEL RECORDS ARE STANDARD                                 
    BLOCK CONTAINS 0 RECORDS                                   
    RECORDING  MODE  IS F.                                     
                                                               
01  EOD-REC.                                               
    COPY FILEDATA REPLACING == :FILEDATA: == BY == EOD ==. 

Here FILEDATA is the copybook for the 2 inputs SOD & EOD .
The variables inside the layout will be like ,
FILEDATA-ACCT,FILEDATA-ADDRESS,FILEDATA-NAME, ETC ETC.
PLease respond ASAP


1) Unless it is a restriction in your shop, you actually CAN use the SAME copybook with the SAME names. Such use will require, however, that any reference to one of the copybook datanames be qualified - as, for example, FILEDATA-ACCT of SOD-REC or FILEDATA-ACCT of EOD-REC.
2) If you wish to proceed as you suggest, then you should remove the leading and trailing spaces between the == delimiters - as in COPY FILEDATA REPLACING ==:FILEDATA:== BY ==EOD==.
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 May 03, 2010 1:45 am    Post subject:
Reply with quote

Hello,

Quote:
but in cobol programs we should not declare the same 2 copybooks twice .
Well, you will declare "the copybook" twice - one way or another. . .

You might choose to create an entirely new copybook with a different name (now there are 2 to maintain/keep current - not desirable usually).

You might name every field in the code with a different name (not acceptable most places i've been).

Or you could use the REPLACING feature. . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon May 03, 2010 4:26 am    Post subject:
Reply with quote

Quote:
Or you could use the REPLACING feature

unless the proper suffix syntax is used - when creating the copybook,
it is best just to have the highest level a 05,
declare each under a different 01 reference name
and as Ronald indicated,
use qualification.

qualification is something that many programmers
(actually coders as far as i am concerned),
complain about.
I have never understood why -
unless of course
it is because they have such low/undeveloped tso/ispf/edit skills
that they continue to type every line.
anytime I hear/see someone complain about having to repetitively enter something,
or type so many lines of code
I know that they are useless.................

about the only thing that I type while entering code is:
  • cut&paste instructions
  • copy instructions
  • chg instructions
  • copy over instructions
  • save
  • end
Back to top
View user's profile Send private message
selvamphigai

New User


Joined: 22 Jan 2010
Posts: 11
Location: chennai

PostPosted: Mon May 03, 2010 12:20 pm    Post subject: Reply to: 2 input files with the same copybook format
Reply with quote

Thank You ALL for replying me.

I hav another doubt now . Even the copybook name will get changed by the REPLACING command while compiling ???
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Mon May 03, 2010 12:34 pm    Post subject: Re: Reply to: 2 input files with the same copybook format
Reply with quote

selvamphigai wrote:
I hav another doubt now . Even the copybook name will get changed by the REPLACING command while compiling ???
No, only the Pseudo-text, An identifier, A literal, A COBOL word (except the word COPY) or Function identifier.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Comparing 2 Files using Current time arunsoods DFSORT/ICETOOL 2 Fri Sep 22, 2017 6:00 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm

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