[Migrated content. Thread originally posted on 26 September 2006]
Hi,As a self-taught Cobol programmer, I occasionally come up against weird behaviours for which I cannot understand and find myself having to workaround.
Currently I'm trying to create a file where the keyfield is as follows:
03 S2-KEY.
05 S2-VAPC USAGE IS SIGNED-INT.
05 S2-BOM PIC X(10).
What I expect to happen is that when I read the file back, the most negative values appear at the start of the file, e.g. sequence would be -12, -5, 10 , 8. However, with the above the negative values appear after the positives in the sequence most to least negative. e.g. 8, 10, -12, -5
03 S2-KEY.
05 S2-VAPC PIC S999V999.
05 S2-BOM PIC X(10).
With the above it treats all S2-VAPC as alphanumeric, ignoring the sign, i.e. sequence can be -5, 8, 10, -12 etc.
Obviously I can workaround this issue by using the first key format and reading negative values before starting the file from the beginning to read the positive values.
What is the BEST way to acheive my desired result?
(Running AcuCobol 6.2 on SCO UNIX btw.)



