Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Move LOW VALUES to COMP-3 Variable

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

New User


Joined: 24 Jan 2006
Posts: 12

PostPosted: Tue Apr 04, 2006 11:25 am    Post subject: Move LOW VALUES to COMP-3 Variable
Reply with quote

Hi,

CAN I MOVE LOWVALUES TO A COMP-3 VARIABLE.

Thanks
Madhu K
Back to top
View user's profile Send private message

harish_mf

New User


Joined: 31 Jul 2005
Posts: 18
Location: bangalore

PostPosted: Tue Apr 04, 2006 11:58 am    Post subject:
Reply with quote

i think its not possible, u may get some soc error.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Apr 04, 2006 2:44 pm    Post subject:
Reply with quote

u can move low values to comp-3.
Back to top
View user's profile Send private message
perez_a

New User


Joined: 02 Feb 2006
Posts: 25
Location: Italy

PostPosted: Tue Apr 04, 2006 5:08 pm    Post subject: Re: CAN I MOVE LOWVALUES TO A COMP-3 VARIABLE.
Reply with quote

I Madhu, U CAN MOVE LOW-VALUE TO A COM-3 VARIABLE.
BELOW I SEND U AN EXAMPLE.
BYE BYE.

WORKING-STORAGE SECTION.

01 NUMA PIC 9(05) COMP-3 VALUE 3.

PROCEDURE DIVISION.
MOVE LOW-VALUE TO NUMA
ADD 1 TO NUMA
DISPLAY 'NUMA ' NUMA
MOVE 3 TO NUMA
DISPLAY 'NUMA ' NUMA
--------------------------------------------------------------------
RESULT:

NUMA 00001
NUMA 00003
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 287
Location: Basel, Switzerland

PostPosted: Tue Apr 04, 2006 6:02 pm    Post subject:
Reply with quote

hy madhugoodboy,

if you have a comp-3 unsigned,
just move zero to the variable.
if you look at the hex-value,
it is low-value...

martin9

PS: madhu = honey??
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Tue Apr 04, 2006 6:21 pm    Post subject: Re: CAN I MOVE LOWVALUES TO A COMP-3 VARIABLE.
Reply with quote

yes..martin is spot on.
you can move low-values in comp3.
also for unsigned just move zeroes.

ap_mainframes
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Apr 04, 2006 7:13 pm    Post subject: Re: CAN I MOVE LOWVALUES TO A COMP-3 VARIABLE.
Reply with quote

Madhu K,

In response to perez_a. At least under the Enterprise Cobol 3.1.0 you cannot move low-values to a comp-3 field, and I believe this is not possible under any IBM Cobol compiler.

perez_a, What compiler version are you running under?

Code:


     005800 WORKING-STORAGE SECTION.                                           
     004515                                                                   
     002710 01 NUMA PIC 9(05) COMP-3 VALUE 3.                                 
     002800                                                                   
     015900 LINKAGE SECTION.                                                   
                                                                               
IBM ENTERPRISE COBOL FOR Z/OS AND OS/390 3.1.0     COBPTR    DATE 04/04/2006  T
 SL  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--
     041400 PROCEDURE DIVISION.                                               
     033300                                                                   
     042110     MOVE LOW-VALUE TO NUMA                                         
                                                                               
IGYPA3005-S "LOW-VALUE" AND "NUMA (PACKED INTEGER)" DID NOT FOLLOW THE "MOVE"              STATEMENT COMPATIBILITY RULES.  THE STATEMENT WAS DISCARDED.       
                                                                               
     042120     ADD 1 TO NUMA                                                 
     042130     DISPLAY 'NUMA ' NUMA                                           
     042140     MOVE 3 TO NUMA                                                 
     042150     DISPLAY 'NUMA ' NUMA                                           
     042130                                                                   
                MOVE 0           TO RETURN-CODE.   



And, in response to martin9. Moving zero (0) to an unsigned comp-3 field does not result in vow-values. It results in an unsigned comp-3 value x?00000F?. The redefines below is in place so there is no data conversion during the ?DISPLAY?.


Code:

  000019         005800 WORKING-STORAGE SECTION.                     
  000020**       004515                                               
  000021**       002710 01 NUMA PIC 9(05) COMP-3 VALUE 3.             
  000022         002720 01 NUMX REDEFINES NUMA PIC X(3).             
                                                                     
  000023         002800                                               
  000024         015900 LINKAGE SECTION.                             
SARPAGE 20                                                           
PP 5655-G53 IBM ENTERPRISE COBOL FOR Z/OS AND OS/390 3.1.0     COBPTR
  LINEID  PL SL  ----+-*A-1-B--+----2----+----3----+----4----+----5---
  000026         041400 PROCEDURE DIVISION.                           
  000027**       033300                                               
  000028         042110     MOVE 0         TO NUMA                   
  000029         042120     DISPLAY 'NUMX = ' NUMX.                   
  000030         042130                                               
  000031                    MOVE 0           TO RETURN-CODE.         
  000032         042140                                               
  000033**       006731     GOBACK.                                   
  000034         006732                                               

Result of running the above code.

Code:

.NUMX = ...       
0DEDE474000       
154470E000F       


One way to get low-values to a comp-3 field is to redefine it as above and move low values to the ?PIC X? field. But, this does not satisfy your question.

Another way is if the COMP-3 is defined as an elemental item, then you can move ?LOW-VALUES? to the group item (that is defined by default as ?PIC X?) example below

Code:


.  000019         005800 WORKING-STORAGE SECTION.                               
.  000020**       004515                                                       
.  000021**       002701 01  WS-GROUP1.                                         
.  000022         002710     05 NUMA                PIC 9(05) COMP-3 VALUE 3.   
.  000023         002720     05 NUMX REDEFINES NUMA PIC X(3).                   
.                                                                               
.  000024         002800                                                       
.  000025         015900 LINKAGE SECTION.                                       
.SARPAGE 20                                                                     
.PP 5655-G53 IBM ENTERPRISE COBOL FOR Z/OS AND OS/390 3.1.0     COBPTR    DATE 0
.  LINEID  PL SL  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6--
.  000027         041400 PROCEDURE DIVISION.                                   
.  000028**       033300                                                       
.  000029         042110     MOVE LOW-VALUES         TO WS-GROUP1.             
.  000030         042120     DISPLAY 'NUMX = ' NUMX.                           
.  000031         042130                                                       
.  000032                    MOVE 0           TO RETURN-CODE.                   
.  000033         042140                                                       
.  000034**       006731     GOBACK.                                           
.  000035         006732   



Result of running the above code

Code:


.NUMX = ...
0DEDE474000
154470E0000



Dave
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 287
Location: Basel, Switzerland

PostPosted: Tue Apr 04, 2006 7:28 pm    Post subject:
Reply with quote

hy alll,

yeah i was not completely right,
i just forgot, that on an odd-length comp-3 field
the compiler will use one half-byte more to get an even-length
field. try it with pic 9(06) comp-3 or if you just use the initial
value of that field, which is low-values.

but it's very right, with redefining the comp-3
is probably the easiest way.... s.above

martin9
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Apr 05, 2006 5:22 am    Post subject:
Reply with quote

Every comp-3 field in mainframe IBM COBOL has a sign nibble (4 bits), whether it's positive (C), negative (D) or unsigned (F) regardless of its length.
Back to top
View user's profile Send private message
madhugoodboy

New User


Joined: 24 Jan 2006
Posts: 12

PostPosted: Wed Apr 05, 2006 11:02 am    Post subject: Re: CAN I MOVE LOWVALUES TO A COMP-3 VARIABLE.
Reply with quote

Thanks all,

Now it has been confirmed that we can move the low values to comp-3 variable.


Regards
Madhu
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 287
Location: Basel, Switzerland

PostPosted: Wed Apr 05, 2006 2:17 pm    Post subject:
Reply with quote

hy madhugoodboy,

but do not use it.
move some zeros as value, it's the better way
and you will be always on the sure side....

martin9
Back to top
View user's profile Send private message
harish_mf

New User


Joined: 31 Jul 2005
Posts: 18
Location: bangalore

PostPosted: Thu Jul 27, 2006 2:46 pm    Post subject:
Reply with quote

Hi,

How to display comp-3 variables
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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us