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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flat File Import

Status
Not open for further replies.

joecobol

Programmer
Joined
Feb 26, 2007
Messages
2
Location
US
I will be generating a flat text file that someone's cobol program will import.

in the FD they sent me, there is a PIC definition that I am not 100% sure about.

PIC S9(11)V9(02) SIGN IS LEADING SEPARATE CHARACTER.

if I am writing out the number -123.45

where does it expect the sign to be?

is it as follows:

-0000000012345

or

00000000-12345

Thank you in advance for help.
 
Just write the number out as -123.45. No need to pad with zeros etc. Cobol will do the rest.....

Have a good day,
RASI
 
Second thought,,,

Write it out as -12345

No need for the decimal, unless the programmer on the other end doesn't care. The PIC string will handle this also.

 
Hi,
If you were given a file spec that calls for that picture, I am pretty sure the Cobol user expects 14 character positions to be used with the first position as a sign and no decimal point.
 
I agree with mrregan - the programmer wants 14 characters
with the 1st or leading as the sign. Although why anyone
would want it that way is beyond me. If they left it as
a normal picture clause,without the "sign is leading seperate character", COBOL would handle it just as
Rasi suggests.
 
PIC S9(11)v99 sign leading separate

MUST be provided as follows:

For 123.45

+0000000012345

For a negative number (-123.45) it must be:
-0000000012345

Note the LACK of the decimal point - the V in the picture clause means "implied decimal". Sign Leading Separate gives you the - OR a + and it does NOT take up one of the numeric positions. The + and - are REQUIRED.
 
OK, I admit the advice I gave joecobol was in error because I didn't pay any attention to the "SIGN IS LEADING SEPARATE CHARACTER" requirement. (this was important)

But let me say this THANE, when you start using the words MUST and REQUIRED - Your answers can also be misleading...

Maybe your answer is just PLAIN Wrong also

Example, You wrote

MUST be provided as follows:

For 123.45

+0000000012345

For a negative number (-123.45) it must be:
-0000000012345

+ and - are REQUIRED.


The + is NOT required - The + is assumed, if not negative.

The
Negative number (-123.45) could also be written as

- 12345

the positive number as
12345.


It's amazing how we waste our time for no pay....

I remember now why i quit responding to questions because there seems to be no correct answer.

Back to my real job...



 
Uh...

AFAIK the +/- is required if you state sign leading separate.

This is DIFFERENT from specifying an edited numeric field.

Pic -99999999999.99 would give the results you indicate - a leading minus if negative, and a leading space if positive. Any COBOL that accepts a sign leading separate numeric field as input without a sign, (assuming there IS an S in the picture clause) is in error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top