[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | FOCUS, from INFORMATION BUILDERS |
|
Moderator: | ZAYIUS::BROUILLETTE |
|
Created: | Thu Feb 19 1987 |
Last Modified: | Mon May 05 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 615 |
Total number of notes: | 1779 |
397.0. "String formats & single-field groups" by DUCK::FIDOT () Tue Feb 26 1991 09:48
I have a file containing information on Digital parts and want to
be able to let users report from it using TABLETALK under MRE.
What I currently have works but leaves the users confused as there
appear to be three fields containing the part number.
The first problem is the formatting of the PART_NUMBER field. It is held
as a 9-character string in the file, but needs to be output in 99-99999-99
format.
Can anyone let me know how to effect this within the part file's .MAS
file ?
The best that I have come up with is a new field PN using
DEFINE PN/A11=EDIT(PART_NUMBER.'99-99999-99'), but this leaves the user
the confusion of having two part number fields to handle. Is there any
way to omit the 9-character field ?
The second problem is that the part number is the primary key of the
file and has therefore been defined in the .MAS file using the GROUP
statement. Am I right in assuming that GROUPs must have at least one
FIELDNAME within it ?
This has led to the confusing situation of having the field PRIMARY_KEY
available for reporting in addition to the PART_NUMBER field, when they
are identical. Any pointers to changing the .MAS file will be
appreciated.
Terry
.MAS file follows :-
FILE=SCPPT ,SUFFIX=ISAM ,$
SEGMENT=ROOT ,$
GROUP =PRIMARY_KEY , ALIAS=KEY ,USAGE=A9 ,ACTUAL=A9 ,$
FIELDNAME=PART_NUMBER , ALIAS= ,USAGE=A9 ,ACTUAL=A9 ,$
FIELDNAME=PRODUCT_CODE, ALIAS=KEY1 ,USAGE=A4 ,ACTUAL=A4 ,FIELDTYPE=I ,$
FIELDNAME=SUPPLY_SRCE , ALIAS=KEY2 ,USAGE=A3 ,ACTUAL=A3 ,FIELDTYPE=I ,$
FIELDNAME=REPAIR_SRCE , ALIAS=KEY3 ,USAGE=A3 ,ACTUAL=A3 ,FIELDTYPE=I ,$
FIELDNAME=LEVEL_CODE , ALIAS=KEY4 ,USAGE=A1 ,ACTUAL=A1 ,FIELDTYPE=I ,$
FIELDNAME=STD_COST , ALIAS= ,USAGE=D10.2 ,ACTUAL=D8 ,$
FIELDNAME=RECENT_USE , ALIAS=KEY5 ,USAGE=A1 ,ACTUAL=A1 ,FIELDTYPE=I ,$
FIELDNAME=DLY_CONSUMPT, ALIAS= ,USAGE=D10.2 ,ACTUAL=D8 ,$
FIELDNAME=STOCK_ONHAND, ALIAS= ,USAGE=I4 ,ACTUAL=I4 ,$
FIELDNAME=OPEN_ORDERS , ALIAS= ,USAGE=I4 ,ACTUAL=I4 ,$
FIELDNAME=REC_WOH , ALIAS= ,USAGE=I4 ,ACTUAL=I4 ,$
DEFINE PN/A11=EDIT ( PART_NUMBER , '99-99999-99' ) ; $
T.R | Title | User | Personal Name | Date | Lines |
---|
397.1 | a solution ? | BIS1::SCHYNS | | Wed Feb 27 1991 07:36 | 53 |
| Two suggestions + a solution :
In your define statement, instead of using PN as the new field name why
don't you use PART_NUMBER which I guess will override the original
field.
DEFINE FILE ...
PART_NUMBER/A9=EDIT (PART_NUMBER,99-99999-99);
END
In relation to the second point (primary key), does it mind if you
simply edit the .MAS file and delete the GROUP line.
Last suggestion that could solve the user confusion but will make the
process a bit heavier :
let your .MAS file as it is now, define a new field as you have done it
and then run a simple request which will store the information tailored
as per your need in a new database :
DEFINE FILE ...
PN/A9=EDIT (PART_NUMBER,99-99999-99);
END
TABLE FILE ...
PRINT PN AND XXX AND YYY (let print what you see as typical
record containing only the needed
info)
BY PN NOPRINT (take a sorting field followed by
noprint since it is already menitonned
in the first line).
ON TABLE HOLD AS NEWDATABASE (max 8 character for the name.
Focus will generate the corresponding
MAS file and store the info in a .FTM
file).
END
VMS RENAME NEWDATABASE.FTM NEWDATABASE.DAT (when you exit focus,
normally are all .FTM files killed sothat you have to give another
extension if you want to keep it permanently).
FILEDEF NEWDATABSE DISK NEWDATABASE.DAT
The reference to the database is contained in the .MAS file. If
you don't exit focus, at the time you were creating the .FTM
database, FOCUS has made a link (FILEDEF) to the .FTM file. As
this last has been renamed, you have to recreate the link. Note
that it is sufficient to exit focus and enter again to delete the
link to the .FTM file and by default, a new link with the database
will be created with the right extension.
These explanations are only the reflect of my FOCUS understanding.
They are maybe too simplist, but I confirm you that it works.
Hoping this helps...
|
397.2 | Still not solved | DUCK::FIDOT | | Wed Feb 27 1991 08:53 | 49 |
| Thanks for your response, but I'm afraid that the suggestions don't
really help.
>> In your define statement, instead of using PN as the new field name why
>> don't you use PART_NUMBER which I guess will override the original
>> field.
Calling the new field PART_NUMBER instead of PN results in PART_NUMBER
being displayed twice in the list of fields in TABLETALK. However,
both PART_NUMBER fields are then displayed in the required 99-99999-99
format, presumably because TABLETALK cannot differentiate between the
two fields. So, there is slight success but it is still confusing to
the users who see two fields called PART_NUMBER.
>> In relation to the second point (primary key), does it mind if you
>> simply edit the .MAS file and delete the GROUP line.
Doing this results in the following error :-
(FOC1087) ISAM FILE MUST HAVE PROPERLY DEFINED KEYS : SCPPT
Chapter 3 , Section 6 ( on page 3-61 ) of the FOCUS Users Manual states
"RMS keyed fields may be described to FOCUS by supplying a SUFFIX of
ISAM, and a new attribute,GROUP, to designate the primary key."
and section 6.3 ( on the same page ) states "The primary key is defined
to FOCUS by means of the GROUP attribute in the Master Description
File. The GROUP declaration is followed by FIELD definitions for each
of the fields that it comprises. ( The GROUP attribute must be used,
even if only one FIELD is to be described for the GROUP )."
>> Last suggestion that could solve the user confusion but will make the
>> process a bit heavier :
>> let your .MAS file as it is now, define a new field as you have done it
>> and then run a simple request which will store the information tailored
>> as per your need in a new database :
I'm afraid that the third suggestion of reformatting the data into a
new database entails too much of an overhead for a simple report
formatting problem.
Thanks anyway - any other suggestions from anyone ?
Terry
|
397.3 | a rose by any other name smells as sweet | MILPND::MADDEN | | Tue Mar 05 1991 15:54 | 3 |
| What I would do is call the PART_NUMBER key field KEY_CODE,
DEFINE PART_NUMBER/A11 = EDIT(KEY_CODE,........), and tell
the users to ignore the KEY_CODE field.
|