Profound.js Reserved Words

Profound.js Reserved Words

All of the reserved words in this section are deprecated. They only ever return the current system date, not the job or session date. Use pjs.getCurrentJobDate() or pjs.getCurrentJobDateNumeric() instead (see the individual pages below for the recommended replacement for each reserved word).

Description

Profound.js provides a set of reserved words that mirror the date-related reserved words available in RPG (*DATE, *DAY, *MONTH, *YEAR, UDATE, UDAY, UMONTH, and UYEAR). They can be referenced directly by name inside a Profound.js module, just like a field defined with pjs.define().

Because an asterisk (*) is not valid in a JavaScript identifier, the RPG reserved words that begin with * are written with a leading underscore (_) in Profound.js.

  • For example: RPG *DATE becomes _date in Profound.js, while RPG UDATE stays udate.

Reserved Words

Reserved Word

RPG Equivalent

Returns

Recommended Replacement

Reserved Word

RPG Equivalent

Returns

Recommended Replacement

_date

*DATE

Current system date as an 8-digit number (MMDDYYYY by default).

pjs.getCurrentJobDateNumeric()

udate

UDATE

Current system date as a 6-digit number (MMDDYY by default).

pjs.getCurrentJobDateNumeric(6)

_day

*DAY

Current system day of the month (1-31).

pjs.getCurrentJobDate().extractDay()

uday

UDAY

Current system day of the month (1-31).

pjs.getCurrentJobDate().extractDay()

_month

*MONTH

Current system month (1-12).

pjs.getCurrentJobDate().extractMonth()

umonth

UMONTH

Current system month (1-12).

pjs.getCurrentJobDate().extractMonth()

_year

*YEAR

Current system year as a 4-digit number.

pjs.getCurrentJobDate().extractYear(4)

uyear

UYEAR

Current system year as a 2-digit number.

pjs.getCurrentJobDate().extractYear(2)

Job Date vs. System Date

In RPG there are two different dates:

  • Job date - Returned by *DATE, UDATE, and the related *DAY/UDAY, *MONTH/UMONTH, and *YEAR/UYEAR reserved words. The job date can differ from the system date (for example, after CHGJOB DATE(...)), and it does not change when a job runs past midnight.

  • System date - Returned by the %DATE() built-in function. It does change when a job runs past midnight.

The Profound.js reserved words listed above were originally documented as returning the job date; however, they have only ever returned the system date. The pjs.getCurrentJobDate() and pjs.getCurrentJobDateNumeric() APIs were added to return the true job or session date, and should be used in place of these reserved words.


Related Pages