Operating System - OpenVMS
1828582 Members
2528 Online
109982 Solutions
New Discussion

Migrating Alpha indexed file to IA64 with member-alignment

 
SOLVED
Go to solution
Rajesh Karelia
Frequent Advisor

Migrating Alpha indexed file to IA64 with member-alignment

Hi,

We are running on OpenVMS v7.3-2 on Alpha platform and we are migrating our application to IA64 with member-alignment for better performance.

We have certain Indexed RMS files which need to be made compliant with member-alignment on IA64.

On Alpha, the record size is 2263 and the same structure with member-alignment on IA64 becomes 2268 bytes long. The C structure is:

struct OTCefi_data
{
long serial_no;
char rsc_name[OTC_RSC_NAME_CHARS];
char rep_ascii_date[OTC_RSC_ASCII_DATE_CHARS];
char exch[OTC_EXCH_CHARS];
char res_no[OTC_RES_NO_CHARS];
char efi_rep_type[OTC_REP_TYPE_CHARS + 1];
long rep_date[2];
short customer_type;
char customer_name[OTC_RSC_CUS_NAME_CHARS + 1];
char toggle[1];
char report_type;
char fault_status;
char translation[CFMS_EFI_TRANSLATE_CHARS];

union
{
struct CFMSsysx_efidata_st sysx;
struct CFMSaxe10_efidata_st axe10;
struct CFMSnsm_efidata_st nsm;
struct CFMSimux_efidata_st imux;
struct CFMSaxe10_nsm_efidata_st axe10_nsm;
} details;

union
{
long escpriority_bitmask ;
struct escpriority_bitfield_st escpriority_bits ;
} escpriority ;

long unsol ;
char symptom [CFMS_EFI_SYMPTOM_CHARS + 1] ;
char supp_data [OTC_HEX_DATA_CHARS + 1] ;
char exch_nni [EAR_NNI_LEN + 1] ;
char resource_type [CFMS_EFI_RESOURCE_CHARS +1] ;
char section [CFMS_EFI_SECTION_CHARS +1] ;
char sub_fault [CFMS_EFI_SUB_FAULT_CHARS +1] ;
char uas [CFMS_EFI_UAS_CHARS +1] ;
char uasr [CFMS_EFI_UASR_CHARS +1] ;
char uasb [CFMS_EFI_UASB_CHARS +1] ;
char direction [CFMS_EFI_DIR_CHARS +1] ;
struct affected_customer_st affected_customers[CFMS_EFI_MAX_CUSTOMERS];
};




Could someone please tell me how to port the RMS file from Alpha to IA64?

Many Thanks
Rajesh
4 REPLIES 4
Steven Schweda
Honored Contributor

Re: Migrating Alpha indexed file to IA64 with member-alignment

> Could someone please tell me how to port
> the RMS file from Alpha to IA64?

What does that mean?

You could write a program which included both
an old structure and a new, member-aligned
structure, and read records from an old file
with the old structure, move the data to a
new structure, and write the data to a new
file from there.

If you need to create a new, member-aligned
structure, it might help to reorder its
members to make them naturally aligned.
Richard Whalen
Honored Contributor

Re: Migrating Alpha indexed file to IA64 with member-alignment

struct OTCefi_data
{
long serial_no;
char rsc_name[OTC_RSC_NAME_CHARS];
char rep_ascii_date[OTC_RSC_ASCII_DATE_CHARS];
char exch[OTC_EXCH_CHARS];
char res_no[OTC_RES_NO_CHARS];
char efi_rep_type[OTC_REP_TYPE_CHARS + 1];
long rep_date[2];
short customer_type;
char customer_name[OTC_RSC_CUS_NAME_CHARS + 1];
char toggle[1];
char report_type;
char fault_status;
char translation[CFMS_EFI_TRANSLATE_CHARS];


You don't give the values for the lengths of those constant strings, but I would bet that some space is being added before the rep_date field to align that. I don't know whether the compiler is making it longword or quadword aligned. Other fields that could have bytes added before them are: details, escpriority and the array of affected_customers (structure).

I would second the recommendation of the first reply: Write a program that has the old, unaligned record structure and the new, aligned record structure and use it to convert the data. Reorganizing the fields in the record would be something to investigate as it could make it such that each record only grows by one byte instead of five.
Hein van den Heuvel
Honored Contributor
Solution

Re: Migrating Alpha indexed file to IA64 with member-alignment

While it is of course advisable to have the longs and dates in that record aligned. but it should have been done right from the get-go. Which field(s) is/are currently not alinged? Just the 'unsol'?

Is this caused by alignment or by a short/long changing size?

It would not APPEAR to be such a big deal in this case. It's just a few, not an array full. It is access with lots of overhead around it (SYS$GET) so your final field access will be a minor step, and most importantly the compile knows and will simply put in the right stuff to prevent unaligned access.

You are possibly burning more cycles investigating then you can ever save running. Just 'pack' the field back to get the 2263 length overall, and be happy?
Add some pragma's to help if need be?

#pragma nostandard /* variant struct */
#pragma nomember_alignment


If you really want to align/resize the fields, then you'll just have to write a program. No tool will do this for you.
Basically a get + put loop. After the get, memcpy the record in chunks to the output buffer skipping (zeroing?) the added space.
I suggest you make the output simple sequential and load with CONVER/FDL back into an indexed file.

Good luck!
Hein.

Robert Gezelter
Honored Contributor

Re: Migrating Alpha indexed file to IA64 with member-alignment

Rajesh,

As has been noted, the simplest way to do this is to write a program (on either the Alpha or the IA64 system) that does the equivalent of a move corresponding from the old format to the new format.

Personally, I after doing that, I would seriously consider recompiling the Alpha applications to use the new format. Then you can still run on both architectures.

- Bob Gezelter, http://www.rlgsc.com