soc7 help



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

soc7 help

Postby mainframe1 » Fri Feb 26, 2010 11:39 am

WS-SRX-TST      PIC S9(8)V9(3).

WS-NEW-RX                   PIC X(12).           
WS-SRX  REDEFINES WS-NEW-RX     PIC S9(8)V9(3). 

 RX1                      PIC X(6).       
 WS-SRX1   REDEFINES RX1      PIC V9(5). 

COMPUTE  WS-SRX-TST = WS-STRX * WS-SRX1 (WS-FACT) 
mainframe1
 
Posts: 35
Joined: Wed Oct 08, 2008 11:39 am
Has thanked: 0 time
Been thanked: 0 time

Re: soc7 help

Postby Anuj Dhawan » Fri Feb 26, 2010 5:57 pm

Per you definitions, WS-SRX1 is not a COBOL-table variable so why do yo use the subscript (WS-FACT)? What is the WS-STRX has?
Anuj
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

Re: soc7 help

Postby Robert Sample » Fri Feb 26, 2010 6:06 pm

WS-NEW-RX                   PIC X(12).           
WS-SRX  REDEFINES WS-NEW-RX     PIC S9(8)V9(3). 
Problem 1: your WS-NEW-RX is 12 bytes long. You redefine it as an 11-byte field. Any calculations you do with WS-SRX are, by definition, not going to include the entire value of WS-NEW-RX. The same applies to your WS-SRX1 field. USAGE DISPLAY fields such as you've defined overlay the sign on the last byte of the field, which means your value will be --odd -- to say the least.

Problem 2: the picture X fields may have any data -- numeric or not. Where is your logic to verify that the redefined fields actually have numbers in them before you attempt to use them for arithmetic?

Problem 3: as alluded, if WS-SRX1 is not part of a table, why are you subscripting it?

Problem 4: your code snippet references variables whose definition you did not provide (wuch as WS-FACT) -- why?
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post