Format Telephone Number, Extension, and Type |
Last Revised: 09/16/10 |
This program is a P type routine used with CDS037, CDS038, CDW038 to format telephone numbers. This routine uses input fields of a phone number, optional extension, and type of phone number, and returns a single field, suitable for display or printing.
CDS469 is typically used within DISP$ as in CDS469.PHONE1, CDS469.CONPHONE, CDS469.ALTPHONE, etc, however it could also be called by an application program:
CALL "CDS469", Y$, REC$, S469$
REC$
must contain one or more fields that include the word PHONE such as PHONE,
ALTPHONE, CONPHONE, PHONE1. If the field is 13 characters long, then
it is assumed that the phone number is contained in the first 12 characters,
and the type of phone# is contained in the 13th character. If the
phone number field is not 13 characters long, then the phone type will be
derived from a separate field that has the corresponding field name such as TYPE,
ALTTYPE, CONTYPE, PHONE1TYPE etc.
Repeating input fields are supported, i.e., PHONE[3]. If the phone is a repeating field, the type must repeat with the same number of elements. If there is also a separate field in the input record for extension, then it should be named EXT, ALTEXT, CONEXT, PHONE1EXT, etc. If present, the extension does not have to have the same repeat as the phone number and type.
The phone number may be 12 to 21 characters long. The type must be 1 character long, but the output will have the type decoded. The extension may be any length, but is typically 5 characters.
Note that unlike most other external routines called by CDS037 and CDS038, this program needs to generate the output template based on the phone numbers present in the input record. One call to CDS469 formats all phone numbers in the record so that it can be used in CDS037 and CDS038 applications.
The output template does not use a repeating field since the extension may not be present for each phone number.
See CDS468 for an entry routine for telephone numbers with type and extension as well as a list of supported phone type codes.
Example with repeating fields |
Input fields (REC$)
|
Output fields (S469$) |
PHONE1:C(33),PHONE2:C(26),PHONE3:C(26)
|
Example including 13 character input where 13th character contains type of phone# |
Input fields (REC$)
|
Output fields (S469$) |
PHONE:C(12),ALTPHONE:C(17)
|