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
 
Reading a file using copybook

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

New User


Joined: 30 Mar 2007
Posts: 7
Location: Chennai

PostPosted: Tue Apr 01, 2008 4:11 pm    Post subject: Reading a file using copybook
Reply with quote

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

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Tue Apr 01, 2008 4:34 pm    Post subject:
Reply with quote

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

Global Moderator


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

PostPosted: Tue Apr 01, 2008 5:14 pm    Post subject:
Reply with quote

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

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Tue Apr 01, 2008 10:32 pm    Post subject:
Reply with quote

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

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Apr 02, 2008 12:04 am    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Wed Apr 02, 2008 12:06 am    Post subject:
Reply with quote

Hello,

Quote:
try this ....
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
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 opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

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