Titus Information Systems, Inc.

COBOL Library

These routines are written for and compiled with the MicroFocus NetExpress COBOL compiler.  They are designed to assist the COBOL programmer with user data entry conversion and validation.  Following are the descriptions of these routines:

CONVI2EC – Convert Integer to Edited
This subroutine converts 32-bit integer to a null-terminated string in an edited format.  The linkage section is as follows:
        LINKAGE SECTION.
        01  INPUT-NUMBER        PIC S9(9) USAGE COMP-5.
        01  OUTPUT-STRING       PIC X(15).
        PROCEDURE DIVISION USING INPUT-NUMBER, OUTPUT-STRING.
FIXADR – Fix the address
This program fixes an address entered by a user into the seven-field "Titus" format described in the linkage section below.  There are two options based on the specified function key, and the program will set the RETURN-CODE to indicate the presence of any errors.  These are described as follows:
Function Key = 1: Validate and prepare address is parts.
Function Key = 2: Prepare address in one long line.
 
RETURN-CODE = 0: No Errors
RETURN-CODE = 1: Invalid Function Key
RETURN-CODE = 2: Illegal Street Direction
RETURN-CODE = 3: Street Name is Missing
RETURN-CODE = 4: Street Line is Too Long
RETURN-CODE = 5: City is Missing
RETURN-CODE = 6: State is Invalid
RETURN-CODE = 7: Zip Code is missing

The linkage section is as follows:
        LINKAGE SECTION.
        01  FUNCTION-KEY                PIC S9999 USAGE COMP-5.
        01  INPUT-ADDRESS.
            03  INPUT-STREET            PIC X(32).
            03  INPUT-DIRECT            PIC XX.
            03  INPUT-STNUMB            PIC 9(6).
            03  INPUT-APT               PIC X(32).
            03  INPUT-CITY              PIC X(20).
            03  INPUT-STATE             PIC XX.
            03  INPUT-ZIP-CODE          PIC X(10).
        01  FULL-ADDRESS.
            03  ADDRESS-LENGTH          PIC S9999 USAGE COMP-5.
            03  FULL-AREA.
                05  FULL-STNUMB         PIC Z(6).
                05  FILLER              PIC X.
                05  FULL-DIRECT         PIC XX.
                    88  VALID-DIRECT    VALUE 'N.' 'S.' 'E.' 'W.',
                        'NE' 'NW' 'SE' 'SW' '  '.
                05  FILLER              PIC X.
                05  FULL-STREET         PIC X(32).
                05  FULL-C1             PIC XXXX.
                05  FULL-APT            PIC X(32).
                05  FULL-C2             PIC XXXX.
                05  FULL-CITY           PIC X(20).
                05  FULL-C3             PIC XXXX.
                05  FULL-STATE          PIC XX.
                05  FULL-SPACES         PIC XX.
                05  FULL-ZIP-CODE       PIC X(10).
        01  PART-ADDRESS                REDEFINES FULL-ADDRESS.
            03  PART-ONE.
                05  PART-ONE-LENGTH     PIC S9999 USAGE COMP-5.
                05  PART-ONE-AREA.
                    07  PART-STNUMB     PIC Z(6).
                    07  FILLER          PIC X.
                    07  PART-DIRECT     PIC XXX.
                    07  PART-STREET     PIC X(32).
            03  PART-TWO.
                05  PART-TWO-LENGTH     PIC S9999 USAGE COMP-5.
                05  PART-APT            PIC X(42).
            03  PART-THREE.
                05  PART-THREE-LENGTH   PIC S9999 USAGE COMP-5.
                05  PART-THREE-AREA.
                    07  PART-CITY       PIC X(20).
                    07  PART-C3         PIC XXXX.
                    07  PART-STATE      PIC XX.
                    07  PART-SPACES     PIC XX.
                    07  PART-ZIP-CODE   PIC X(14).
        PROCEDURE DIVISION USING FUNCTION-KEY,
            INPUT-ADDRESS, FULL-ADDRESS.
FXNA$O – Fix the Name
This program fixes names entered with title codes for two individuals, normally husband and wife.  The linkage section is as follows:
        LINKAGE SECTION.
        01  FIXED-NAME-AREA.
            03  FN-ERROR                PIC S9999 USAGE COMP-5.
                88  FN-GOOD-CALL        VALUE ZERO.
                88  FN-ERROR-TITLE-ONE  VALUE 1.
                88  FN-ERROR-TITLE-TWO  VALUE 2.
                88  FN-ERROR-LENGTH     VALUE 3.
                88  FN-ERROR-LAST       VALUE 4.
            03  FN-FIELD                PIC S9999 USAGE COMP-5.
            03  FN-OUTPUT-FLAG          PIC X.
                88  FN-OUTPUT-LAST      VALUE 'L', 'A', 'N', 'P'.
                88  FN-OUTPUT-FIRST     VALUE 'F', 'A', 'N'.
                88  FN-OUTPUT-TITLE     VALUE 'T', 'A', 'P'.
            03  FN-ORDER-FLAG           PIC X.
                88  FN-ORDER-LASTFIRST  VALUE 'L', 'U'.
                88  FN-ORDER-FIRSTLAST  VALUE 'F'.
                88  FN-ORDER-LASTUPPER  VALUE 'U'.
            03  FN-LENGTH-FLAG          PIC X.
                88  FN-LENGTH-LABEL     VALUE 'L'.
                88  FN-LENGTH-FULL      VALUE 'F'.
                88  FN-LENGTH-GIVEN     VALUE 'G'.
            03  FN-CASE-FLAG            PIC X.
                88  FN-CASE-UPPER       VALUE 'U'.
                88  FN-CASE-LOWER       VALUE 'L'.
                88  FN-CASE-CONDITIONAL VALUE 'C'.
            03  FN-OTHER-FLAGS          PIC X(5).
            03  FN-LENGTH               PIC S9999 USAGE COMP-5.
            03  FN-NAME.
                05  FN-LAST-FIRST       PIC X(16).
                05  FN-LAST-COMMA       PIC XXXX.
                05  FN-TITLE-AREA.
                    07  FN-TITLE-ONE    PIC X(5).
                    07  FN-TITLE-TWO    PIC X(10).
                05  FN-FIRST-NAME       PIC X(21).
                05  FN-LAST-NAME        PIC X(16).
        01  INPUT-NAME-AREA.
            03  NA-LAST-NAME            PIC X(16).
            03  NA-FIRST-NAME           PIC X(20).
            03  NA-TITLE-ONE            PIC X.
            03  NA-TITLE-TWO            PIC X.
        PROCEDURE DIVISION USING FIXED-NAME-AREA, INPUT-NAME-AREA.
FXNM$O – Fix the Name
This program fixes a name entered with a title code, a suffix code, and a preferred name.  The linkage section is as follows:
        LINKAGE SECTION.
        01  FIXED-NAME-AREA.
            03  FN-ERROR                PIC S9999 USAGE COMP-5.
                88  FN-GOOD-CALL        VALUE ZERO.
                88  FN-ERROR-TITLE      VALUE 1.
                88  FN-ERROR-SUFFIX     VALUE 2.
                88  FN-ERROR-LENGTH     VALUE 3.
                88  FN-ERROR-WIFE       VALUE 4.
                88  FN-ERROR-LAST       VALUE 5.
            03  FN-FIELD                PIC S9999 USAGE COMP-5.
            03  FN-WIFE-FLAG            PIC X.
            03  FN-WIFE-PREFERRED       PIC X(10).
            03  FN-OUTPUT-FLAG          PIC X.
                88  FN-OUTPUT-LAST      VALUE 'L', 'A', 'J', 'U', 'Q',
                               'D', 'E', 'B', 'R', 'K', 'M', 'V', 'N'.
                88  FN-OUTPUT-FIRST     VALUE 'F', 'A', 'J', 'I', 'N',
                                              'B', 'C', 'D', 'V'.
                88  FN-OUTPUT-TITLE     VALUE 'T', 'A', 'J', 'I', 'Q',
                                         'R', 'K', 'M', 'O', 'B', 'C'.
                88  FN-OUTPUT-SUFFIX    VALUE 'S', 'A', 'J', 'U', 'R',
                                              'K', 'D'.
                88  FN-OUTPUT-PREFERRED VALUE 'P', 'A', 'K', 'M', 'O',
                                              'B', 'C', 'V', 'E'.
            03  FN-ORDER-FLAG           PIC X.
                88  FN-ORDER-LASTFIRST  VALUE 'L', 'U'.
                88  FN-ORDER-FIRSTLAST  VALUE 'F'.
                88  FN-ORDER-LASTUPPER  VALUE 'U'.
            03  FN-LENGTH-FLAG          PIC X.
                88  FN-LENGTH-LABEL     VALUE 'L'.
                88  FN-LENGTH-FULL      VALUE 'F'.
                88  FN-LENGTH-GIVEN     VALUE 'G'.
            03  FN-CASE-FLAG            PIC X.
                88  FN-CASE-UPPER       VALUE 'U'.
                88  FN-CASE-LOWER       VALUE 'L'.
                88  FN-CASE-CONDITIONAL VALUE 'C'.
            03  FN-OTHER-FLAGS          PIC X(5).
            03  FN-LENGTH               PIC S9999 USAGE COMP-5.
            03  FN-NAME.
                05  FN-LAST-FIRST       PIC X(16).
                05  FN-LAST-COMMA       PIC XXXX.
                05  FN-TITLE-AREA.
                    07  FN-TITLE        PIC X(5).
                    07  FN-WIFE-TITLE   PIC X(10).
                05  FN-FIRST-NAME       PIC X(21).
                05  FN-PREFERRED-AREA.
                    07  FN-PREF-OPEN    PIC X.
                    07  FN-PREFERRED    PIC X(20).
                    07  FN-PREF-AND     PIC X(5).
                    07  FN-PREF-WIFE    PIC X(10).
                    07  FN-PREF-CLOSE   PIC XXXX.
                05  FN-LAST-NAME        PIC X(16).
                05  FN-SUFFIX           PIC X(10).
        01  INPUT-NAME-AREA.
            03  NA-LAST-NAME            PIC X(16).
            03  NA-FIRST-NAME           PIC X(20).
            03  NA-TITLE                PIC X.
            03  NA-SUFFIX               PIC X.
            03  NA-PREFERRED            PIC X(10).
        PROCEDURE DIVISION USING FIXED-NAME-AREA, INPUT-NAME-AREA.
FXNV$O – Fix the Name
This program fixes a single name entered with a title code.  The linkage section is as follows:
        LINKAGE SECTION.
        01  FIXED-NAME-AREA.
            03  FN-ERROR                PIC S9999 USAGE COMP-5.
                88  FN-GOOD-CALL        VALUE ZERO.
                88  FN-ERROR-TITLE      VALUE 1.
                88  FN-ERROR-LENGTH     VALUE 2.
                88  FN-ERROR-LAST       VALUE 3.
            03  FN-FIELD                PIC S9999 USAGE COMP-5.
            03  FN-OUTPUT-FLAG          PIC X.
                88  FN-OUTPUT-LAST      VALUE 'L', 'A', 'N', 'R'.
                88  FN-OUTPUT-FIRST     VALUE 'F', 'A', 'N', 'I'.
                88  FN-OUTPUT-TITLE     VALUE 'T', 'A', 'R', 'I'.
            03  FN-ORDER-FLAG           PIC X.
                88  FN-ORDER-LASTFIRST  VALUE 'L', 'U'.
                88  FN-ORDER-FIRSTLAST  VALUE 'F'.
                88  FN-ORDER-LASTUPPER  VALUE 'U'.
            03  FN-LENGTH-FLAG          PIC X.
                88  FN-LENGTH-LABEL     VALUE 'L'.
                88  FN-LENGTH-FULL      VALUE 'F'.
                88  FN-LENGTH-GIVEN     VALUE 'G'.
            03  FN-CASE-FLAG            PIC X.
                88  FN-CASE-UPPER       VALUE 'U'.
                88  FN-CASE-LOWER       VALUE 'L'.
                88  FN-CASE-CONDITIONAL VALUE 'C'.
            03  FN-OTHER-FLAGS          PIC X(5).
            03  FN-LENGTH               PIC S9999 USAGE COMP-5.
            03  FN-NAME.
                05  FN-LAST-FIRST       PIC X(20).
                05  FN-LAST-COMMA       PIC XXXX.
                05  FN-TITLE            PIC X(5).
                05  FN-FIRST-NAME       PIC X(16).
                05  FN-LAST-NAME        PIC X(20).
        01  INPUT-NAME-AREA.
            03  NA-LAST-NAME            PIC X(20).
            03  NA-FIRST-NAME           PIC X(15).
            03  NA-TITLE                PIC X.
        PROCEDURE DIVISION USING FIXED-NAME-AREA, INPUT-NAME-AREA.
SETRETCD – Set the RETURN-CODE
This routine sets the return code using the two-character I/O FILE-STATUS.  The linkage section is as follows:
        LINKAGE SECTION.
        01  FUNCTION-RETURN     PIC S9999 USAGE COMP-5.
        01  FILE-STATUS         PIC XX.
        PROCEDURE DIVISION USING FUNCTION-RETURN, FILE-STATUS.
VALDIREC – Validate the Direction
This routine validates street directions.  If invalid, DIRECT-VALID is set to -1.  If valid, DIRECT-DESC is set to a character description of the street direction.  If DIRECT-CODE is a valid single character, a period is appended to it.

The valid street directions are as follows:
(blank) - (no direction) E. -East N. -North
NE -Northeast NW -Northwest S. -South
SE -Southeast SW -Southwest W. -West

The linkage section is as follows:
        01  DIRECT-ARGUMENT-AREA.
            03  DIRECT-CODE      PIC XX.
            03  DIRECT-DESC.
                05  DIRECT-VALID PIC S9999 USAGE COMP-5.
                05  FILLER       PIC X(8).
        PROCEDURE DIVISION USING DIRECT-ARGUMENT-AREA.
VALPROPT – Validate the Print Option
This routine validates "Titus" print options.  If invalid, OPTION-VALID is set to -1.  If valid, OPTION-DESC is set to a character description of the print option.

The valid print options are as follows:
RS - Reset to switch settings -L - Set Form Length
6S - Six LPI single space 6D - Six LPI double space
8S - Eight LPI single space 8D - Eight LPI double space
PN - Pica Normal (10 CPI) PX - Pica Expanded (5 CPI)
EN - Elite Normal (12 CPI) EX - Elite Expanded (6 CPI)
CN - Compress Normal (17 CPI) CX - Compress Expand (8.5 CPI)
ON - Other Normal (20 CPI) OX - Other Expanded (10 CPI)
OP - Orientation Portrait OL - Orientation Landscape
TT - Tray selection Top TB - Tray selection Bottom
TD - Tray selection Duplex TE - Tray selection Envelope
LF - Landscape Format LL - Laser Label Format
BO - Bold Print LQ - Letter Quality Print
IT - Italic Print UL - Underline Print
DH - Double Height Print P1 - User-defined option 1
P2 - User-defined option 2 P3 - User-defined option 3
P4 - User-defined option 4 P5 - User-defined option 5
P6 - User-defined option 6 P7 - User-defined option 7
P8 - User-defined option 8 P9 - User-defined option 9
NE - No initial page eject EJ - Eject page at report end
PA - Pause at of each page NR - No RS at report end

The linkage section is as follows:
        LINKAGE SECTION.
        01  OPTION-ARGUMENT-AREA.
            03  OPTION-CODE      PIC XX.
            03  OPTION-DESC.
                05  OPTION-VALID PIC S9999 USAGE COMP-5.
                05  FILLER       PIC X(26).
        PROCEDURE DIVISION USING OPTION-ARGUMENT-AREA.
VALSTATE – Validate the State Code
This routine validates two-character, U.S.A. Postal Service state abbreviations.  If invalid, STATE-INDEX is set to -1.  If valid, STATE­DESC is set to a character description of the state, and STATE-INDEX is set to the index of the state.

The valid states, with the STATE-INDEX, STATE-CODE, and STATE-DESC, are as follows:
1: AK - Alaska 2: AL - Alabama 3: AR - Arkanses
4:AS - American Samoa: 5:AZ - Arizona 6:CA - California
7:CO - Colorado 8:CT - Connecticut 9:DC - District of Columbia
10:DE - Delaware 11:FL - Florida 12:FM - Federated States of Micronesia
13:FX - Foreign Address 14:GA - Georgia 15:GU - Guam
16:HI - Hawaii 17:IA - Iowa 18:ID - Idaho
19:IL - Illinois 20:IN - Indiana 21:KS - Kansas
22:KY - Kentucky 23:LA - Lousiana 24:MA - Massachusetts
25:MD - Maryland 26:ME - Maine 27:MH - Marshall Islands
28:MI - Michigan 29:MN - Minnesota 30:MO - Missouri
31:MP - Northern Mariana Islands 32:MS - Mississippi 33:MT - Montana
34:NC - North Carolina 35:ND - North Dakota 36:NE - Nebraska
37:NH - New Hampshire 38:NJ - New Jersey 39:NM - New Mexico
40:NV - Nevada 41:NY - New York 42:OH - Ohio
43:OK - Oklahoma 44:OR - Oregon 45:PA - Pennsylvania
46:PR - Puerto Rico 47:PW - Palau 48:RI - Rhode Island
49:SC - South Carolina 50:SD - South Dakota 51:TN - Tennessee
52:TX - Texas 53:UT - Utah 54:VA - Virginia
55:VI - Virgin Islands 56:VT - Vermont 57:WA - Washington
58:WI - Wisconsin 59:WV - West Virginia 60:WY - Wyoming
61:XX - Unknown Address

The linkage section is as follows:
        LINKAGE SECTION.
        01  STATE-ARGUMENT-AREA.
            03  STATE-CODE           PIC XX.
            03  STATE-DESC           PIC X(30).
            03  STATE-INDEX          PIC S9999 USAGE COMP-5.
        PROCEDURE DIVISION USING STATE-ARGUMENT-AREA.


[ Stand-alone Programs | Standard Library | Conversion Functions | Utility Functions | COBOL Functions ]
[ Windows NT Library | COBOL Interface | Command Prompt Abbreviations | Purchase Instructions ]

[ Home | Areas of Expertise | "We Do Windows" | Clients and Projects | Software Samples | Package Software Available ]
[ Contact Information | Business Software Philosophy | Church Software Philosophy ]
All contents of this web site are Copyright © Titus Information Systems, Inc., Phoenix, Arizona, U.S.A.