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

2 input files with the same copybook format


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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
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

Moderator Emeritus


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

PostPosted: Mon May 03, 2010 1:45 am
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: 6966
Location: porcelain throne

PostPosted: Mon May 03, 2010 4:26 am
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
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: 3156
Location: Tucson AZ

PostPosted: Mon May 03, 2010 12:34 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top