You are here: Development Standards > Routines > General Routines > GENPC.PUB

# GENPC.PUB

GENPC.PUB is a public program that converts dates to periods, and vice versa.

`0100 ENTER FILE[ALL],SELECTION,DATE$,O9$,BEGDATE,ENDDATE,PERIOD,PPY,YEAR,APP$,LOCKFLAG,INVALIDYEAR,RMPH$,RMPL$,MSG$`

Variable | Description
FILE[ALL] | Standard file array
SELECTION | Determines the task GENPC.PUB is to perform: 0 = Return the period conversion table for the current company in O9$ 1 = Return the period corresponding to the date provided 2 = Return the starting and ending dates for the period provided
DATE$ | The date for which the period is determined (SELECTION = 1)
O9$ | The period conversion table for this company, for a specific year
BEGDATE | GENOPEN.PUB and the CALLing program share the current command, in case the user aborts processing
ENDDATE | The ending date of the period provided (if SELECTION = 2)
PERIOD | The period to be converted (if SELECTION = 1 or SELECTION = 2), or the period corresponding to the date supplied
PPY | Number of periods in the company’s fiscal year
YEAR | The current year a given period is in. Can bet set or returned based on which GENPC call is used.
APP$ | Application ID to check period locking for. Defaults to STBL("MENUAPP") if not set.
LOCKFLAG | Returns 1 if the current period/year being checked is locked
INVALIDYEAR | Returns 1 if the year for the given period is not set up and is estimated
RMPH$ | String template for RMPHx file
RMPL$ | String template for RMPLx file
MSG$ | Return message if errors are found in period calculation, or if a given period is locked.

Exit Points | Explanation
EXIT | GENPC.PUB normally exits with no error.
EXIT ERR | An error is returned if an error occurred.

The GENPC.PUB program automatically reads the RMTB file to find the period conversion table if O9$ is blank. You do not need to open any table files to use GENPC.

For backwards compatibility, GENPCOLD.PUB is included with Resource Manager. This should be used only when working with prior versions, such as data file conversion.