Skip to main content

[Migrated content. Thread originally posted on 10 August 2005]

Hi,

A customer recently found that keys conatining some special Swedish characters does not get "sorted" correctly when written to an indexed file.

I played around with the COLLATING SEQUENCE is statement of the SELECT clause and that works just fine.

One thing though. It seems that the collating sequence is written into the files header when the file is created. Thus one can't just add a COLLATING SEQUENCE to an existing indexed file. Even though this does not render an error message, the file is behaving as it was before.

What is the easiest way to change the collating sequence?
1, Create a new file and read all the the records from the old file and write them to the new one?

2, Convert in some other way with Acu utility?

Reason I ask is that the system contains about 100 indexed files and I need to provide a secure way of doing this without having to be there myself.

best regards,
Hans Jivesten

[Migrated content. Thread originally posted on 10 August 2005]

Hi,

A customer recently found that keys conatining some special Swedish characters does not get "sorted" correctly when written to an indexed file.

I played around with the COLLATING SEQUENCE is statement of the SELECT clause and that works just fine.

One thing though. It seems that the collating sequence is written into the files header when the file is created. Thus one can't just add a COLLATING SEQUENCE to an existing indexed file. Even though this does not render an error message, the file is behaving as it was before.

What is the easiest way to change the collating sequence?
1, Create a new file and read all the the records from the old file and write them to the new one?

2, Convert in some other way with Acu utility?

Reason I ask is that the system contains about 100 indexed files and I need to provide a secure way of doing this without having to be there myself.

best regards,
Hans Jivesten
Unfortunately, the problem is a bit more complicated than just the sequence of the files. You must also define the collating sequence inside the SPECIAL-NAMES Section for each program. This has to be compiled into each program because there is no runtime option for the collating sequence. (This would be a nice enhancement so one set of programs could work for multiple sets of collating sequences.)

Without this logic the simple comparisons no longer work as before. For example, a simple comparison like IF CUSTOMER-NAME > PREV-CUSTOMER-NAME might not give you the desired results if one of these fields has one of the special characters.

If you can afford to recomple your programs with the collating sequence and can time the conversion so that the new programs are available the same time as the converted files you might consider the following. It is a lot cleaner than writing code for all of your files.

============

You might consider using I$IO.

With this utility you can specify a colating sequence in the MAKE option when you create a file. You can also write a single program that will handle multiple files without having to include seperated FDs for each data file.

I would approach this in the following manner:

1) User C$RENAME to rename your original file so you will have a good backup.

2) Use the INFO option to find out all of the parameters for the existing file.

3) Use MAKE option (with the colating sequence option added) to create a new file.

4) OPEN both files and use the READ and NEXT to get records that can be written (WRITE) to the new file with the collating sequence.

5) At some point you can delete the original file.

At one time there was a COPY.CBL program floating around within the AcuCorp (or AcuCobol) world that was provided as a sample program that did everything except handle the collating sequence. You might be able to find a copy from the good people at AcuCorp support.

[Migrated content. Thread originally posted on 10 August 2005]

Hi,

A customer recently found that keys conatining some special Swedish characters does not get "sorted" correctly when written to an indexed file.

I played around with the COLLATING SEQUENCE is statement of the SELECT clause and that works just fine.

One thing though. It seems that the collating sequence is written into the files header when the file is created. Thus one can't just add a COLLATING SEQUENCE to an existing indexed file. Even though this does not render an error message, the file is behaving as it was before.

What is the easiest way to change the collating sequence?
1, Create a new file and read all the the records from the old file and write them to the new one?

2, Convert in some other way with Acu utility?

Reason I ask is that the system contains about 100 indexed files and I need to provide a secure way of doing this without having to be there myself.

best regards,
Hans Jivesten
Hi,

and thanks.

I've found another method that seems to work quite good.

1, Use vutil to unload the old file
2, Create the new file with the correct COLLATING SEQUENCE etc. Just Open and Close the file.
3, Use vutil to load the unloaded data into the newly created file

Seems to work quite good. But as you say, for all the programs to work I need to have an alphabet specified in each and every program.

br,
Hans Jivesten
JIKON Data
Sweden