View previous topic :: View next topic
|
Author |
Message |
selvamphigai
New User
Joined: 22 Jan 2010 Posts: 11 Location: chennai
|
|
|
|
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 |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
selvamphigai
New User
Joined: 22 Jan 2010 Posts: 11 Location: chennai
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
Back to top |
|
|
|