
SL File definitions
Started by Amy, Aug 16 2007 04:29 PM
4 replies to this topic
#1
Posted 16 August 2007 - 04:29 PM
Hi. I have a quick easy questions (I think!)
I have fields in my SL files I don't use and would like to rename them. If the new field or fields take up the same space I believe I will have no problems - is this true? If I have a field in the middle of a file that is alpha 6 can I rename it to two fields A2 and A4?
Thanks, Amy
I have fields in my SL files I don't use and would like to rename them. If the new field or fields take up the same space I believe I will have no problems - is this true? If I have a field in the middle of a file that is alpha 6 can I rename it to two fields A2 and A4?
Thanks, Amy
#3
Posted 16 August 2007 - 06:08 PM
Hi. I have a quick easy questions (I think!)
I have fields in my SL files I don't use and would like to rename them. If the new field or fields take up the same space I believe I will have no problems - is this true? If I have a field in the middle of a file that is alpha 6 can I rename it to two fields A2 and A4?
Thanks, Amy
Amy,
To avoid any possible problems, the best way of doing what you wish to do is to write a conversion update that will copy all your current data to a backup file. You would then make your changes to the master file and then run another update that would take the data you just created in your backup file and repopulate your master file. Then you'd have to regen all the functions that use your master file.
But why would you want to risk any problems? Are you running out of space on your system that prohibits you from adding the new fields at the end of the file?
AK
THE LIGHT AT THE END OF THE TUNNEL IS THE HEADLAMP OF THE TRAIN THAT'S ABOUT TO HIT YOU!!!
#4
Posted 17 August 2007 - 04:11 AM
PRO-Isam files do not fixed length records. They are variable length. A 6 char alpha is not simply 2 ,3 character alpha fields. There are field terminating characters embeded in the record which you don't see.
If you know you truly are not using fields you should not have any problem simply renaming it provided you keep the field type the same. You can change the length as well. We used to do this without a problem (we are now using SQL). You must regen your functions after you change the file definitions.
If you know you truly are not using fields you should not have any problem simply renaming it provided you keep the field type the same. You can change the length as well. We used to do this without a problem (we are now using SQL). You must regen your functions after you change the file definitions.
Edited by Lewis Mccabe, 17 August 2007 - 04:12 AM.
#5
Posted 17 August 2007 - 02:02 PM
There are three different ways ProIV accesses individual fields in files, this depends on the underlying file system. You will need to be very careful if you change file systems as certain Functions may not work correctly.
1) ProISAM type (this applies to ProIsam, but also other file systems that allow native ProIV e.g. variable length RMS on VMS. These access the fields by counting marker bytes stored in the record. This applies to all fields apart from the Key, this is stored as a fixed string (see below). When ProIV reads the record it assigns each field to the named variable in the file definition, checking the type as it does so. When it writes a record back it takes each field from the named variables and writes then in the order specified on the File definition (as it was when the Function was genned). ProIV is counting Fields not bytes, so changing an 8 character field into a 6 character and 2 character field will not work. If any previous data was on the file then ProIV would read the whole of the previous 8 characters into the 6 character field (and lose the last two characters) then read the whole of the next field on the file into the 2 character field.
2) Fixed String (this applies to keys in ProIsam and to BIN and SEQ files amongst others). The record is treated as a string of bytes. When ProIV reads a record it chops it up depending on the length specified for each field (according to the rules in the external type definition if relevant). ProIV is counting bytes not fields, so changing an 8 character field into a 6 character field and an eight character field will work.
3) SQL. Each field has a name (the Alternate Name or Name) and ProIV uses this to access the database. The physical sequence of fields is irrelevant. The number of fields is only relevant for matching the ProIV file definition to the underlying table or view.
If you want to make changes to records on a file you need to consider:
Are there any records already on the file - do they need converting?
Are there Functions already genned with previous versions of the file definition - they will need regenning (and sending to customers!!!!!)
Are there any other File Definitions that map to the same physical file - they need to be considered as well.
1) ProISAM type (this applies to ProIsam, but also other file systems that allow native ProIV e.g. variable length RMS on VMS. These access the fields by counting marker bytes stored in the record. This applies to all fields apart from the Key, this is stored as a fixed string (see below). When ProIV reads the record it assigns each field to the named variable in the file definition, checking the type as it does so. When it writes a record back it takes each field from the named variables and writes then in the order specified on the File definition (as it was when the Function was genned). ProIV is counting Fields not bytes, so changing an 8 character field into a 6 character and 2 character field will not work. If any previous data was on the file then ProIV would read the whole of the previous 8 characters into the 6 character field (and lose the last two characters) then read the whole of the next field on the file into the 2 character field.
2) Fixed String (this applies to keys in ProIsam and to BIN and SEQ files amongst others). The record is treated as a string of bytes. When ProIV reads a record it chops it up depending on the length specified for each field (according to the rules in the external type definition if relevant). ProIV is counting bytes not fields, so changing an 8 character field into a 6 character field and an eight character field will work.
3) SQL. Each field has a name (the Alternate Name or Name) and ProIV uses this to access the database. The physical sequence of fields is irrelevant. The number of fields is only relevant for matching the ProIV file definition to the underlying table or view.
If you want to make changes to records on a file you need to consider:
Are there any records already on the file - do they need converting?
Are there Functions already genned with previous versions of the file definition - they will need regenning (and sending to customers!!!!!)
Are there any other File Definitions that map to the same physical file - they need to be considered as well.
Reply to this topic

0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users