Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sign Trailing Separate

Status
Not open for further replies.

HeavyC

Programmer
Nov 7, 2003
2
US
I have a question about the Sign Trailing Separate clause.

I currently have a flat file that I'm reading in. It stores the value of my number like this.

PIC 9(05)v99 (value of number)
PIC x(01) (sign for that number)

Can I read that into a Sign Trailing Separate or a Sign Trailing Field set up like this.

PIC S9(05)V99 Sign Trailing Separate or
PIC S9(05)V99 Sign Trailing

What's the difference between the two? This is driving me crazy right now.
 
This option is 1 of the best in cobol. It enables you to represent your numeric value as independant of hardware and character sets as possible.

When you have a field in cobol defines as:
Code:
pic s9(5)v9(2) sign trailing separate character value 12,34.
This will be represented as "0001234+" (8 characters).
This might look like a numeric-edited field in cobol, but it is not. It is numeric so you can do calculations with it.

The big advantage of this format is the potabililty. When this definintion is part of a record-layout or a MQ-buffer or whaterver, you do not have to worry about target- and source platform, ASCII or EBCDIC, big-endian or whatever. All cobol compilers will interpred the contents the same way.

Don't let this drive you crazy. Just use it!
 
Okay so can I read "1234567+" into S9(5)v99 SIGN TRAILING SEPARATE CHARACTER?
 
I would suggest an
Code:
IF
data-item-name
Code:
 NUMERIC
test before attempting to use the value in any arithmetic computations, however.

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top