View previous topic :: View next topic |
Author |
Message |
pkarthik@email.com Beginner

Joined: 29 Mar 2005 Posts: 34 Topics: 18 Location: Canada
|
Posted: Thu Jun 08, 2006 9:41 am Post subject: Linkage section signed number passing |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Thu Jun 08, 2006 10:05 am Post subject: |
|
|
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 |
|
 |
pkarthik@email.com Beginner

Joined: 29 Mar 2005 Posts: 34 Topics: 18 Location: Canada
|
Posted: Thu Jun 08, 2006 10:26 pm Post subject: |
|
|
Thanks kolusu for your timely help. _________________ For any type of complex problems there will be multiple easiest solutions |
|
Back to top |
|
 |
pkarthik@email.com Beginner

Joined: 29 Mar 2005 Posts: 34 Topics: 18 Location: Canada
|
Posted: Thu Jun 08, 2006 10:28 pm Post subject: |
|
|
Could you please expalin me how come 23M=-234. _________________ For any type of complex problems there will be multiple easiest solutions |
|
Back to top |
|
 |
ayashp Beginner

Joined: 20 Dec 2005 Posts: 9 Topics: 3
|
Posted: Fri Jun 09, 2006 12:54 am Post subject: |
|
|
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 |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Fri Jun 09, 2006 1:46 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
|
|