MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Linkage section signed number passing

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
pkarthik@email.com
Beginner


Joined: 29 Mar 2005
Posts: 34
Topics: 18
Location: Canada

PostPosted: Thu Jun 08, 2006 9:41 am    Post subject: Linkage section signed number passing Reply with quote

HI ,
I PASSEd a signed Numeric data as Parm parameter.But in Cobol i got data as positive numerals.So my question is can we pass signed numeric data as parm parameter.
_________________
For any type of complex problems there will be multiple easiest solutions
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Thu Jun 08, 2006 10:05 am    Post subject: Reply with quote

pkarthik@email.com,

Yes can pass negative numbers via parm.

Code:

LINKAGE SECTION.                                   
                                                   
01 PARM-AREA.                                     
   05 PARM-LENGTH           PIC S9(4) COMP.       
   05 L-PARM-NUM            PIC S9(09).           
                                                   
PROCEDURE DIVISION USING PARM-AREA.               
                                                   
     IF L-PARM-NUM < 0                             
        DISPLAY 'THE PASSED NUMBER IS NEGATIVE'   
     END-IF                                       


In the JCL

Code:

//STEP0300 EXEC PGM=your cbl pgm,PARM='00000023M/'


00000023M = -234

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pkarthik@email.com
Beginner


Joined: 29 Mar 2005
Posts: 34
Topics: 18
Location: Canada

PostPosted: Thu Jun 08, 2006 10:26 pm    Post subject: Reply with quote

Thanks kolusu for your timely help.
_________________
For any type of complex problems there will be multiple easiest solutions
Back to top
View user's profile Send private message Send e-mail
pkarthik@email.com
Beginner


Joined: 29 Mar 2005
Posts: 34
Topics: 18
Location: Canada

PostPosted: Thu Jun 08, 2006 10:28 pm    Post subject: Reply with quote

Could you please expalin me how come 23M=-234.
_________________
For any type of complex problems there will be multiple easiest solutions
Back to top
View user's profile Send private message Send e-mail
ayashp
Beginner


Joined: 20 Dec 2005
Posts: 9
Topics: 3

PostPosted: Fri Jun 09, 2006 12:54 am    Post subject: Reply with quote

Hi Karthik,

I think when we say -234, then the sign bit is stored in the rightmost zoned bit position. So in 00000023M , M represents 4 with a signed bit stored in it. This is because u are defining the variable as S9(09) which means that the identified will take 9 bytes and no extra byte is reserverd for the sign bit and the sign bit is stored as I mentioned above.

Kolusu, hope I m correct. If not, then please correct me where I am wrong. Hope this helps.

Cheers,
Ayash
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Fri Jun 09, 2006 1:46 am    Post subject: Reply with quote

ayashp & pkarthik,

Please use this sheet to refer.

Code:

**********************************************************************
*  VALUES:                                                           *
*      1 = A          -1 = J     EXAMPLES:  NUMBER    REPRESENTATION *
*      2 = B          -2 = K                  10        00000001{    *
*      3 = C          -3 = L                 105        00000010E    *
*      4 = D          -4 = M                   0        00000000{    *
*      5 = E          -5 = N                -234        00000023M    *
*      6 = F          -6 = O                 -30        00000003}    *
*      7 = G          -7 = P                                         *
*      8 = H          -8 = Q                                         *
*      9 = I          -9 = R                                         *
*      0 = {          -0 = }                                         *
**********************************************************************


+---------------------------------------------------------------+
| Last Character  will be      |                                |
| represented as below for..   | 0  1  2  3  4  5  6  7  8  9   |
+---------------------------------------------------------------+
| If the Number is +ve         | {  A  B  C  D  E  F  G  H  I   |
+---------------------------------------------------------------+
| If the Number is -ve         | }  J  K  L  M  N  O  P  Q  R   |
+---------------------------------------------------------------+

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Fri Jun 09, 2006 8:28 am    Post subject: Reply with quote

Quote:

Could you please expalin me how come 23M=-234.


Ayash and shekhar already explained it. Here is a link which explains the same but in detail


http://mvsforums.com/helpboards/viewtopic.php?p=29744#29744

http://www.mvsforums.com/helpboards/viewtopic.php?p=13822#13822

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group