View previous topic :: View next topic
|
Author |
Message |
elangovan_paul
New User
Joined: 30 Mar 2007 Posts: 7 Location: Chennai
|
|
|
|
Hi,
I am fairly new to the mainframe world. I have the following requirement.
I have to read a file using copybook.
I am not able to read the file while using DEBIT-BALANCE PIC S9(13) in the copybook but I am able to read the file when I use DEBIT-BALANCE PIC X(14). I cannot use PIC X(14) in the copybook since DEBIT-BALANCE is a amount field and I need to process it using a program.
Is there some way by which I can read the copybook using S9(13) for DEBIT-BALANCE.
Regards,
Elan |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Quote: |
I am not able to read the file while using DEBIT-BALANCE PIC S9(13) in the copybook |
What is the error message and its code?
It seems...
Change the data type for DEBIT-BALANCE in record structure in program from X(14) to S9(13). |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
we realize you are new - but, please, what do you mean read a file using a copybook? You can not do that in cobol. file-aid, ya, but you do not read files with copybooks.
you can define a record image with a copybook. as long as the length of the copybook matches the dcb parms of the file, you can read the file without any problem. now, you might get a s0c7 if your copybook does not match your files' record layout.
but the only error you will have is the open because of dcb mismatch.
might help us to help you if you were to tell us the error - and not your interpretation of the error, the exact error that mvs provided you during the execution of your program. |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
define in your copybook
05 DEBIT-BALANCE s9(13).
05 DEBIT-BALANCE-x redefines DEBIT-BALANCE pic x(13).
after read convert your x(13) to numeric using
compute ws-DEBIT-BALANCE = function numval(DEBIT-BALANCE-x)
try this .... |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
DEBIT-BALANCE PIC S9(13)
DEBIT-BALANCE PIC X(14)
Are different sizes s9(13) and x(13) would be the same size or s9(14) and x(14). The S does not count in the size of a numeric field. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Maybe, but it would be better if Elan replied to these requests. . .
Quote: |
What is the error message and its code? |
Quote: |
might help us to help you if you were to tell us the error - and not your interpretation of the error, the exact error that mvs provided you during the execution of your program. |
|
|
Back to top |
|
|
|