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

COBOL S9(5) COMP fields display in SPOOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Appu

New User


Joined: 26 Apr 2010
Posts: 73
Location: India

PostPosted: Fri Nov 05, 2010 2:53 pm
Reply with quote

Hi,

Please see the below COBOL code.

COBOL Declarations
Code:

01  ERROR-PCB.                                           
    05      ERROR-DBNAME        PIC     X(8).             
    05      ERROR-SEGLEVEL      PIC     XX.               
    05      ERROR-STATUS        PIC     XX.               
    05      ERROR-PROCOPT       PIC     X(4).             
    05      ERROR-RESERVE       PIC     X(4).             
    05      ERROR-SEGNAME       PIC     X(8).             
    05      ERROR-KEYLENGTH     PIC     S9(5)   COMP.     
    05      ERROR-SENSNUM       PIC     S9(5)   COMP.     
    05      ERROR-KEYAREA       PIC     X(25).           
    05      FILLER              PIC     X(50).           
01  IOBER.                   
   03 PCB-IO        POINTER. 

01  IO-PCB                 PIC X(100). 



COBOL Code
Code:

SET   PCB-IO              TO   ADDRESS OF IO-PCB.
SET  ADDRESS OF ERROR-PCB TO PCB-IO.


The spool display of IO-PCB is as follows :
Code:

4444444410444444444444444444444444444444444444440000
0000000000000000000000000000000000000000000000000000


I tried printing ERROR-PCB after the assignment and in the spool all the items declared inside ERROR-PCB are coming correctly but i am getting unexpected values for ERROR-KEYLENGTH and ERROR-SENSNUM.
I am getting the value 52576 for ERROR-KEYLENGTH and ERROR-SENSNUM. But from the spool display of IO-PCB i was expecting the values from position 29-36 in the hex output above.


Could please anyone explain why ERROR-KEYLENGTH and ERROR-SENSNUM is showing a values which is not at all present in IO-PCB.
Is there any relation since these two fields are PIC S9(5) COMP ?

Please help.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Nov 05, 2010 3:34 pm
Reply with quote

in which section are PCB-IO, IO-PCB, ERROR-PCB defined
all in working storage? all in linkage?
which level of cobol are you using? (cobol II or enterprise?)
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Nov 05, 2010 3:36 pm
Reply with quote

Try this instead -

Code:

SET  PCB-IO            TO ADDRESS OF ERROR-PCB.
SET  ADDRESS OF IO-PCB TO PCB-IO.


The contents of IO-PCB is now the same as the contents of ERROR-PCB, because they are pointing to the same address of ERROR-PCB.

You had just the opposite, pointing both at the address of IO-PCB, which looks to be uninitialized.

Why not just display the contents of ERROR-PCB? Is there a real reason to monkey around with storage addresses as this is foreign to many folks using COBOL.

What version/release of COBOL are you using?

Are these WS or LINKAGE items?

Bill
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top