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

Numeric field containing spaces


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

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Thu Mar 31, 2005 5:35 pm
Reply with quote

hi all,
can a numeric value hold spaces...the declaration of the variable is
03 TWA-NUM1 PIC 9(07).

This is LS variable and it is not being initialized with any value and no value is passes as the program associate with it, which is a CICS program and from CICS region this program is acting as direct function call program.Please give me reply as soon as possible...as while this is being populated into another numeric variable it passes spaces...
Back to top
View user's profile Send private message
knd_r
Currently Banned

New User


Joined: 18 Mar 2005
Posts: 48

PostPosted: Thu Mar 31, 2005 6:56 pm
Reply with quote

hi,

i think numeric data items cannot hold spaces

regards,
sudarsan
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Thu Mar 31, 2005 6:59 pm
Reply with quote

sorry...as i m getting the situation where it is holding spaces at run time and due to that it is not abending at all..
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Apr 01, 2005 5:31 am
Reply with quote

Hi KK,

Yes, the field CAN contain spaces. How they got there is another ques. What is your REAL ques?

P.S. what is an LS Variable?
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Fri Apr 01, 2005 10:03 am
Reply with quote

hi MM,
With LS variable i mean to say Linkage Section variable.Sorry for inconvinience...
The question i am getting OC7 due to following peice of code:

IF VAR1 = VAR2
<PERFORM SOME OPERATION>
ELSE
<PERFORM SOME OTHER OPERATION>
END-IF

Now VAR1 and VAR2 both are PIC 9(07). VAR2 is being populated from one LS variable which is also having the same picture clause i.e. PIC 9(07). As the LS variable somehow contains SPACE and it is being passed to VAR2 down the line of execution. As far as i know it should give OC7 while executing the given IF condition, but it is not abending there. Now as the IF cindition satisfy the comparision hence it is performing the operation. Due the performed operation one another variable VAR3 is getting SPACE which is off PIC 9(03) COMP-3.

IF VAR3 GREATER THAN ZEROES -- ABEND Line
and in this line it is giving OC7.

My question is why it is not abended in first IF comparision when both the variable VAR1 and VAR2 are spaces. Is this due the presence of COMP-3 in the declartion of VAR3 which is giving abend.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Apr 02, 2005 8:20 am
Reply with quote

One explanation is that the PIC 9 fields are defined w/o signs. An A/N compare was probably generated and no conversion was attempted. The comp-3 IF will result in data conversion and decimal arith will be generated to do the IF. If the data is not numeric an 0C7 will result.

If I were you I'd display each field, both the comp-3 and the display numeric fields. DISPLAY the dn fields like this:

DISPLAY '>' VAR1(1:) '<'.

This will force the DISPLAY of the field as PIX X not PIC 9. The brackets make it easy to see where the field begins and ends.

You may have to redefine the comp-3s to PIC X and DISPLAY the PIC X field.

Use SDSF to view the displays, but use SE not S. Then enter HEX ON in the cmd line. See what shows up.

Another approach is to re-compile with NOOFF,LIST and see what code is generated for the IF stmts.

HTH
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top