PCODE Statements

The syntax of the PCODE entries is as follows:

label  PCODE  length,unit,offset,flag,base,type 
label
Identifier on the first PCODE entry for a format. This should be specified starting in column 1.
PCODE
Macro name for defining a pseudo-code entry. It must be preceded by a space. Typically, it starts in column 10.
length
Required. Length of the field represented in this entry specified in terms of the underlying data type. Character fields are in bytes, decimal fields are in half-bytes, binary fields are in bits. Free-form are indicated by 0.
unit
Required. Unit of measure specified in the field. This must be CENTURY, YEAR, MONTH, MONTHSTR, DAY, or JDAY.
offset
Optional. Offset for the start of the value. This is the number of digits to skip from the end of the previous component to the start of this one.
flag
Special processing flag defined as one of the following:
WINDOW
Force the use of Pivot Year window.
SIGN_FLAG
Number is signed (valid for decimal and binary data). The sign is treated as a flag, which is copied from the input to the output field.
SIGN_VALUE
Number is signed. The sign is recognized as the sign for the number. This is useful if the number represents a number of days since some base date and there are dates prior to the base date.
COMP2
Number is in 2's complement.
COMP9
Number is in 9's complement.
COMP10
Number is in 10's complement.
base
If you need to specify multiple values, use the plus sign “+”, between them (for example, WINDOW+SIGN).

Base year or Lilian day number. This value is added to the date prior to aging and subtracted from the aged date prior to writing the output.

The Lilian day for a specific date can be determined using the Optim™ Date Calculator.

type
Override data type for BIN, CHAR, or DEC. This is useful when a component of the format is not the same type as the overall FORMAT.

Julian Dates

Note that a date format can have both a Julian day specification and a month and day specification.

On input, the Julian day takes precedence. On output, both are generated from the aged date. Therefore, a format such as YYYYMMDDJJJ is processed properly.

Explicit vs Relative

A distinction is made between processing an explicit date and a date relative to some base date.

When processing an explicit date, defaults are provided for the unspecified units to determine the date to be aged.

The defaults are:

Year: Current® year

Month: January

Day: 1

The value for year can be overridden with an absolute value in FOP9SAPF.

Modifying PCODE

The PCODE statements are provided in the FOP9SAPF member. Within the member, comments indicate logical locations for inserting additional PCODE statements to handle site-specific requirements.

Examples

The following examples demonstrate the PCODE statement.

Adding the field specifications for the D1900, BINPACK and YYYYMMDD9 formats.

Find the following comments in the FOP9SAPF member:


*-------------------------------------------------------
*  INSERT SITE SPECIFIC PCODE ENTRIES BELOW HERE       
*-------------------------------------------------------

Insert the following entries after these comments:


D_D1900                  PCODE 
5,DAY,,SIGN,115861
*
B_BINPACK                   PCODE 7,YEAR
                  PCODE 4,MONTH
                  PCODE 5,DAY
*
B_YYYYMMDD9                    PCODE  4,YEAR,,COMP         
                               PCODE  2,MONTH,,COMP9
                  PCODE  2,DAY,,COMP9
  1. The first PCODE will create an entry for a 5 decimal digit field that has a decimal sign after the number. The base date represented by this format is Lilian date 115861, which is January 1, 1900.
  2. The next PCODE specifications define a date that is made up of three binary fields represented by 7, 4, and 5 bits respectively.
  3. The last set of PCODE specifications map the three individual date components after the date has been converted to unpacked decimal digits. The COMP9 flag identifies that the components are in 9's complement.