Cobol Datatype PIC 9(003) vs PIC S9(3)



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

Cobol Datatype PIC 9(003) vs PIC S9(3)

Postby riship » Mon Nov 05, 2007 3:09 pm

Hi,
I would like to know if PIC 9(003) is represented/same as PIC S9(3)

Thanks in advance.

Regards,
Rishi.
riship
 
Posts: 1
Joined: Mon Nov 05, 2007 3:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Cobol Datatype

Postby CICS Guy » Mon Nov 05, 2007 4:03 pm

riship wrote:I would like to know if PIC 9(003) is represented/same as PIC S9(3)
Almost, the 'S' forces COBOL to deal with each just a little differentl.
If I recall correctly, when data is moved into the field without the sign, COBOL will insure the last byte (where the sign is stored) has a positive sign.
CICS Guy
 
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: Cobol Datatype PIC 9(003) vs PIC S9(3)

Postby dick scherrer » Tue Nov 06, 2007 4:14 am

Hello,

COBOL will insure the last byte (where the sign is stored) has a positive sign.
If the field is S9(3), cobol will generate a "C" sign. If the field is 9(3), cobol should generate an "F" sign. Both C and F are positive. A "D" sign is negative.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Cobol Datatype PIC 9(003) vs PIC S9(3)

Postby kanswa_boy » Wed Nov 07, 2007 11:02 am

hi ,
they both vil take 3 bytes.u knw the sign is store in 'sign trailing ' format it is by default.
lik d no. is -321 so it stores lik 32(-1) tat vil become 32J.
according to zoned decimal form +1=A
+2=B nd so on......
nd -1 =J
-2 =K
girish kanswa
FCIL INDIA
kanswa_boy
 
Posts: 7
Joined: Tue Nov 06, 2007 3:54 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post