Understanding What Is Expanded
For the utility to recognize when it is appropriate to expand data, strict adherence to the PeopleSoft COBOL coding standards is required. The utility looks for certain code-style patterns to make these decisions.
The conversion utility expands all PIC X[(N)] data fields to triple their original size, with the following exceptions:
-
Exception 1: SQL buffer setup data.
-
Exception 2: Redefined character fields.
-
Exception 3: Fields that appear to be dates.
-
Exception 4: Arrays comprising a single character.
The utility also converts copybooks on the fly: the first time that a copybook is referenced inside a code module, it is expanded immediately.
The utility processes an entire set of COBOL modules in a single run. It maintains a record of what it has converted to avoid converting copybooks twice.
Note:
The COBOL conversion utility ensures that edited lines do not go past the 72nd column. If the conversion would normally cause a line to exceed that limitation, the utility removes some of the blank spaces between the field name and the PIC X string so that the line fits in the allowed area.
Exception 1: SQL Buffer Setup Data
SQL buffer setup data that refers to the numeric or date data types of SELECT-SETUP or BIND-SETUP is not expanded.
For the interface to PTPSQLRT, a COBOL program passes a SELECT list (SELECT-DATA) and a descriptor area (SELECT-SETUP). The program also passes similar data and setup areas for bind variables. The descriptors that are passed are always character-type data with embedded values that signal the actual data type and length of the data fields. Because these descriptors represent the lengths of the associated data fields in the corresponding SELECT-DATA and BIND-DATA structures, the utility adjusts only the length of the descriptors that are representing character-type data.
Example 1: In the following code, the select list contains two character fields (EMPLID and NAME), a small integer (EMPL_RCD), and a date (EFFDT):
SELECT-SETUP.
02 FILLER PIC X(60) VALUE ALL 'C'.
02 FILLER PIC X(2) VALUE ALL 'S'.
02 FILLER PIC X(10) VALUE ALL 'D'.
02 FILLER PIC X(90) VALUE ALL 'C'.
SELECT-DATA.
02 EMPLID PIC X(60).
02 EMPL_RCD PIC 99 COMP.
02 EFFDT PIC X(10).
02 NAME PIC X(90).
In Unicode, the only fields that should be expanded are the two character fields (EMPLID and NAME). Numeric data is never affected by Unicode, and (according to the PeopleTools definition), dates are not affected either: they are treated as numeric strings and cannot have special characters.
Thus, the utility converts this code as follows:
SELECT-SETUP.
02 FILLER PIC X(60) VALUE ALL ‘C’.
02 FILLER PIC X(2) VALUE ALL ‘S’.
02 FILLER PIC X(10) VALUE ALL ‘D’.
02 FILLER PIC X(90) VALUE ALL ‘C’.
SELECT-DATA.
02 EMPLID PIC X(60).
02 EMPL_RCD PIC 99 COMP.
02 EFFDT PIC X(10).
02 NAME PIC X(90).
Example 2: The following code represents non-Unicode COBOL (COBOL that has not yet been expanded):
01 I-ERRL.
05 SQL-STMT PIC X(18) VALUE
'INPXPROC_I_ERRL'.
05 BIND-SETUP.
10 FILLER PIC X(10) VALUE ALL 'C'.
10 FILLER PIC X(6) VALUE '0PPPPP'.
10 FILLER PIC X(4) VALUE ALL 'I'.
10 FILLER PIC X VALUE 'H'.
10 FILLER PIC X(18) VALUE ALL 'C'.
10 FILLER PIC X(4) VALUE ALL 'I'.
10 FILLER PIC X(4) VALUE ALL 'N'.
10 FILLER PIC X(30) VALUE ALL 'H'.
10 FILLER PIC X(30) VALUE ALL 'C'.
10 FILLER PIC X(30) VALUE ALL 'H'.
10 FILLER PIC X(10) VALUE ALL 'C'.
10 FILLER PIC X(6) VALUE '0PPPPP'.
10 FILLER PIC X(8) VALUE '0PPPPPPP'.
10 FILLER PIC X VALUE 'Z'.
05 BIND-DATA.
10 TSE-JOBID PIC X(10) VALUE SPACES.
10 TSE-PROC-INSTANCE PIC 9(10) VALUE ZERO COMP-3.
10 TSE-SET-NBR PIC 9(6) VALUE ZERO COMP.
10 TSE-EDIT-TYPE PIC X VALUE SPACE.
10 TSE-FIELDNAME PIC X(18) VALUE SPACES.
10 MESSAGE-SET-NBR PIC 9(5) VALUE ZERO COMP.
10 MESSAGE-NBR PIC 9(5) VALUE ZERO COMP.
10 MESSAGE-PARM PIC X(30) VALUE SPACES.
10 MESSAGE-PARM2 PIC X(30) VALUE SPACES.
10 MESSAGE-PARM3 PIC X(30) VALUE SPACES.
10 BUSINESS-UNIT PIC X(10) VALUE SPACES.
10 TRANSACTION-NBR PIC 9(10) VALUE ZERO COMP-3.
10 SEQ-NBR PIC 9(15) VALUE ZERO COMP-3.
10 FILLER PIC X VALUE 'Z'.
The utility converts this code as follows:
01 I-ERRL.
05 SQL-STMT PIC X(54) VALUE
'INPXPROC_I_ERRL'.
05 BIND-SETUP.
10 FILLER PIC X(30) VALUE ALL 'C'.
10 FILLER PIC X(6) VALUE '0PPPPP'.
10 FILLER PIC X(4) VALUE ALL 'I'.
10 FILLER PIC X(3) VALUE ALL 'H'.
10 FILLER PIC X(54) VALUE ALL 'C'.
10 FILLER PIC X(4) VALUE ALL 'I'.
10 FILLER PIC X(4) VALUE ALL 'N'.
10 FILLER PIC X(90) VALUE ALL 'H'.
10 FILLER PIC X(90) VALUE ALL 'C'.
10 FILLER PIC X(90) VALUE ALL 'H'.
10 FILLER PIC X(30) VALUE ALL 'C'.
10 FILLER PIC X(6) VALUE '0PPPPP'.
10 FILLER PIC X(8) VALUE '0PPPPPPP'.
10 FILLER PIC X VALUE 'Z'.
05 BIND-DATA.
10 TSE-JOBID PIC X(30) VALUE SPACES.
10 TSE-PROC-INSTANCE PIC 9(10) VALUE ZERO COMP-3.
10 TSE-SET-NBR PIC 9(6) VALUE ZERO COMP.
10 TSE-EDIT-TYPE PIC X(3) VALUE SPACES.
10 TSE-FIELDNAME PIC X(54) VALUE SPACES.
10 MESSAGE-SET-NBR PIC 9(5) VALUE ZERO COMP.
10 MESSAGE-NBR PIC 9(5) VALUE ZERO COMP.
10 MESSAGE-PARM PIC X(90) VALUE SPACES.
10 MESSAGE-PARM2 PIC X(90) VALUE SPACES.
10 MESSAGE-PARM3 PIC X(90) VALUE SPACES.
10 BUSINESS-UNIT PIC X(30) VALUE SPACES.
10 TRANSACTION-NBR PIC 9(10) VALUE ZERO COMP-3.
10 SEQ-NBR PIC 9(15) VALUE ZERO COMP-3.
10 FILLER PIC X VALUE 'Z'.
Exception 2: Redefined Character Fields
Character fields that are redefined to a numeric field (and group-level fields that contain such character fields) are not expanded. In instances where the redefined field is also redefined as a character field, the original character field and the redefinition that is a character field are expanded.
Example 1: In this example, the DB-PIC-PRECIS-CHAR is not expanded:
07 DB-PIC-PRECIS-CHAR PIC X(2).
07 DB-PIC-PRECIS-NUM REDEFINES
DB-PIC-PRECIS-CHAR PIC 9(2).
Example 2: In this example, the I-REMIT-ADDR-SEQ is not expanded:
02 I-REMIT-ADDR-SEQ PIC 9(04).
02 I-REMIT-ADDR-SEQ-C REDEFINES
I-REMIT-ADDR-SEQ PIC X(04).
Example 3: In this example, the original definition is a character-type field. Although some of the redefined fields are numeric fields, all of the character fields, including the original definition, are expanded.
02 MSGDATA1 PIC X(30) VALUE SPACES.
02 FILLER REDEFINES MSGDATA1.
03 MSGDATA1-INT PIC Z(9)9-.
03 INT-FILL1 PIC X(19).
02 FILLER REDEFINES MSGDATA1.
03 MSGDATA1-DOL PIC Z(9)9.99-.
03 DOL-FILL1 PIC X(16).
02 FILLER REDEFINES MSGDATA1.
03 MSGDATA1-DEC PIC Z(9)9.9(5)-.
03 DEC-FILL1 PIC X(13).
Exception 3: Fields That Appear to Be Dates
Fields and group-level fields that appear to be dates are not expanded, unless the EXPAND directive is specified for this field or group-level field.
The following table describes the criteria that are used to determine fields or group-level fields as dates:
| DATE Data Type | Field or Group-Level Field Name | Field Length or Total Length of a Group-Level Field* |
|---|---|---|
|
Date |
Contains -DT or DATE |
10 |
|
Time |
Contains -TM or TIME |
15 |
|
Date-Time |
Contains -DTTM, DATE, or TIME |
26 |
* When calculating the total length, the utility considers that a group-level field may contain REDEFINE fields. The length of the REDEFINE field is not included when determining the total length of the group field.
Example 1: The field in this example is not expanded:
10 START-DATE PIC X(10) VALUE SPACES.
Example 2: The fields in this example are not expanded:
02 W-EMP-BIRTHDATE.
03 YEAR PIC 9(4).
03 FILLER PIC X(1).
03 MONTH PIC 99.
03 FILLER PIC X(1).
03 DAYS PIC 99.
Example 3: The fields in this example are not expanded:
03 PAY-DATE-TIME.
04 PAY-DTTM-DATE PIC X(10).
04 PAY-DTTM-DELIM1 PIC X VALUE '-'.
04 PAY-DTTM-TIME PIC X(15).
Example 4: The fields in this example are not expanded:
05 BEGIN-DTTM-TIME.
07 SYS-HOUR PIC 99 VALUE ZERO.
07 FILLER PIC X VALUE SPACE.
07 SYS-MINUTE PIC 99 VALUE ZERO.
07 FILLER PIC X VALUE SPACE.
07 SYS-SECOND PIC 99 VALUE ZERO.
07 FILLER PIC X VALUE SPACE.
07 SYS-MICRO-SECOND PIC 9(6) VALUE ZERO.
Example 5: In this example, the group field contains REDEFINE fields. The conversion utility expands the fields because the group field meets the criteria for expansion: it has a total length of 10 and the field name includes the -DT string.
02 END-DT.
03 END-DT-YY PIC X(4).
03 END-DT-YY-NUM REDEFINES END-DT-YY
PIC 9999.
03 FILLER PIC X.
03 END-DT-MM PIC XX.
03 END-DT-MM-NUM REDEFINES END-DT-MM
PIC 99.
03 FILLER PIC X.
03 END-DT-DD PIC XX.
03 END-DT-DD-NUM REDEFINES END-DT-DD
PIC 99.
Exception 4: Arrays Comprising a Single Character
For arrays that comprise a single character, the PIC clause is expanded for character data, but the OCCURS clause is not expanded. However, if the data name ends with -POS, -CHAR, or -BYTE, the OCCURS clause is expanded, instead of the element size.
Example 1: In this example, the field is expanded:
01 CHAR-ARRAY PIC X OCCURS 80 TIMES.
Is expanded to:
01 CHAR-ARRAY PIC X(3) OCCURS 80 TIMES.
Example 2: In this example, the data name ends with -POS; therefore, the OCCURS clause is expanded, instead of the element size:
01 CHAR-POS PIC X OCCURS 80 TIMES.
Is expanded to:
01 CHAR-POS PIC X OCCURS 240 TIMES.