Global Command Selection : A B C D E F G I L M N O P R S U V W X

Detail Command Selection : ABORT_EXIT - ALIAS - ALPHA - ATTRIBUTE - ASCII - BITOFF - BITON - CALL - CASE - CDATE - CHAR - CHECK-INPUT - COMMIT - CONV - CTIME - DEFINE - DISABLE - DSEL - DSELF - EBCDIC - ENABLE - EXIT - EXTERN - FLD - FNEXIT - FOR - FRAC - GETLPSEQ - GLOBAL_LSCALL - GMSG - IF - IN-ALPHA - IN-RANGE - INDEX - INT - ISNULL - LEN - LINK - LINK-CRT - LOOPEXIT - LOOPNEXT - LSCALL - LSEXIT - MAX - MEAN - MIN - MSG - NUMERIC - ORD - PARMS - PFKEYCAP - PFKEYUSAGE - PIC - PRECISION - REM - RETRY_READ - RETURN - ROLLBACK - ROUND - SEL-ONLY - SEL-PARTIAL - SEL-RANGE - SETNULL - SET_RECORD_FOR_DELETE - SET_RPTOPT - STEP - SUBSTR - SUPPRESS_RETRY - SYSF - SYSTEM - SYSTEM-CRT - UMSG - VERT-TOT - WHILE - WIDEPIC - WIDEVAL - WINLOCATE - XFER - XFERIN

This FAQ is copyright protected 1997 Omega Consultancy & Software - All rights reserved - This page / document can't be copied or multiplied whiteout written permission of Omega Consultancy & Software. This FAQ is part of our PRO-IV training program


Command: < ABORT_EXIT > ABORT_EXIT specifies that an EOD or CANCEL exit is not to be taken

Syntax: ABORT_EXIT

Description:
This command tells the system to ignore the EOD and the CANCEL keys. After one of these keys is pressed PRO-IV will return to the last input field.

Remarks:
To be used only in the EOD/CANCEL Logic of an LS. This Procedure is supported in version(s): 3.0

Example:
IF $WRITE = 'N' THEN ABORT_EXIT() ENDIF


Command: < ALIAS > ALIAS changes the physical file name (Alternate) for a file

Syntax: ALIAS(filename,alternate-file)

Remarks:
This command allows you to change the physical filename at runtime. It is not possible to issue more than one alias command for one file during the execution of a function.

Example:
ALIAS("FUNCTDEF","\BOOT\FUNCTDEF.PRO")
ALIAS('CUSTOMER',$CUSTOMER_FILE)


Command: < ALPHA > ALPHA converts data form either numeric or wide to alphanumeric

Syntax: ALPHA(operand)

Example:
$VALUE = ALPHA(#VALUE)

See also: ALPHAVAL NUMERIC CONV

Command: < ALPHAVAL > ALPHAVAL Converts data from either wide or mixed to alphanumeric

Syntax: string = ALPHAVAL(operand)

Remarks:
Gives you the single byte equivalent of any characters encoded in the operand. This Alpha Function is supported in version(s): 3.0

Example:
$ALPHA = ALPHAVAL(!WIDE_STRING)

See also: ALPHA NUMERIC CONV


Command: < ASCII > ASCII returns the ASCII equivalent of an EBCDIC String

Syntax: string = ASCII(operand)

Example:
$ASCII = ASCII($EBCDIC)

See also: EBCDIC


Command: < ATTRIBUTE > ATTRIBUTE changes the display attributes of a field

Syntax: ATTRIBUTE(attribute-no)

Description:
In $SYSDEF you can define up to 10 different attribute sets per palette. The first 4 used by the system, the others can be user defined.
Palette: 1 = Field 2 = Display Only Fields 3 = Current Input Field 4 = Format 5-10 User Defined

Remarks:
ATTRIBUTE can only be used in Field Display LOGIC. This Procedure is supported in version(s): 3.0

Example:
ATTRIBUTE(4)

* This sets the attributes for a field to that of the * screen format.



Command: < BITOFF > BITOFF Returns TRUE if the flag is turned off.

Syntax: BITOFF(flag)

Description:
Is used to test kernel status flags and processing options.

Remarks:
There are a number of system flags: &#@BIT0-63, &#@NO-ECHO,&#@EMODE, &#@EUROF, ea. For a Complete list see the process control options section. Flags can be turned off and on with the DISABLE and ENABLE commands.

Example:
IF BITOFF(&#@EUROF) THEN UMSG('System Date display is set to US format MM/DD/YY') ELSE UMSG('System Date display is set to EUROPEAN format') ENDIF

See also: BITON DISABLE ENABLE


Command: < BITON > BITON returns TRUE if the flag is turned on.

Syntax: BITON(flag)

Description:
used to test the status of a process control option.

Remarks:
There are a number of control options: &#@BIT0-63,&#@EMODE, &#@EUROF, ea. For a Complete list see the process control options section. Flags can be turned off and on with the DISABLE and ENABLE commands

Example:
IF BITOFF(&#@EUROF) THEN UMSG('System Date display is set to US format MM/DD/YY') ELSE UMSG('System Date display is set to EUROPEAN format') ENDIF

See also: BITOFF DISABLE ENABLE



Command: < CALL > CALL calls a subroutine defined within the current logic

Syntax: CALL(step-number)

Remarks:
CALL is the equivalent of the BASIC GOSUB command. It is recommended that all called steps end with a RETURN statement for readability.

Example:
#I = 0 WHILE #I < 10 CALL(1) ENDWHILE EXIT 1 #I += 1 RETURN

See also: STEP


Command: < CASE > CASE used to handle a group of related conditions.

Syntax: CASE selector WHEN case-list : block of statements {OTHERWISE : block of statements} ENDCASE

Description:
CASE is typically used when there are more then 2 values on which specific actions need to be taken.

Example:
CASE TYPE WHEN 'A' : #MAX = 10 #MIN = 5 WHEN 'B' : #MAX = 15 #MIN = 7 OTHERWISE: #MAX = 0 #MIN = 0 ENDCASE *this case statement sets variables #MAX,#MIN for each TYPE

See also: IF FOR WHILE


Command: < CDATE > CDATE converts dates from alphanumeric to numeric or vice-versa

Syntax: numeric = CDATE(alpha-date{,mask}) alpha = CDATE(numeric-date{,mask})

Remarks:
The values for MASK: D The Full name for the day of the week (SUNDAY) DD The 2-digit day of month (01 to 31) DDD The 3-character name for the day of the week (SUN) M The Full name for the month (JANUARY) MM The 2-digit month number (01 to 12) MMM The 3-character name for the month (JAN) YY The last to digits of the year (PRO-IV assumes 19 as the first 2-digits) YYYY The Year from 1800 to 2199

Example:
#DATE1 = 67630 $DATE2 = '19850227' $DATE3 = '02/28/85'

* FORMAT ESULT $DATE = CDATE(#DATE1) 850301' #DATE = CDATE($DATE2) 7628 $DATE = CDATE(#DATE1,"M DD,YYYY") 'MARCH 01,1985' #DATE = CDATE($DATE3,'MM/DD/YY') 67629

See also: CTIME PIC CONV


Command: < CHAR > CHAR returns a single character for numeric values 0 to 255

Syntax: string = CHAR(operand)

Description:
This command is used to convert a numeric to either it's ASCII or EBCDIC value.

Example:
$C = CHAR(111) * sets $C to 'A'

See also: ORD


Command: < CHECK-INPUT > CHECK-INPUT postpones the processing of certain function keys.

Syntax: CHECK-INPUT

Description:
CHECK-INPUT allows you to test for entry of certain functions keys e.g.:the arrow-keys, the tab-keys, the mode-keys, next, previous and cancel/end of data.

Remarks:
Only valid as the first statement of a general check logic! This Procedure is supported in version(s): 2.0

Example:
CHECK-INPUT IF @FNKEY = 10 THEN MSG 3 ENDIF

* This logic checks if the user pressed the cancel key, if so then message 3 is displayed


Command: < COMMIT > COMMIT requests an immediate commit of the database

Syntax: #status = COMMIT()

Description:
A SQL Transaction Processing command

Remarks:
COMMIT is only effective for previously written records, not for records that are currently being processed. If commit fails then PRO-IV attempts to rollback and will link to @RFUNCT. This Numeric Function is supported in version(s): 3.0

Example:
IF $WRITE = 'Y' THEN #ST = COMMIT() ENDIF
* If $WRITE = 'Y' a COMMIT is issued.

See also: ROLLBACK


Command: < CONV > CONV converts data from numeric to alpha or vice versa

Syntax: ret = CONV(operand)

Description:
This routine converts with no editing. If editing is required then use PIC.

Remarks:
If you convert alpha strings to numerics then keep in mind that the string may not contain any alpha characters, so no leading spaces.

Example:
$A = CONV(123) * sets $A to '123'
#N = CONV('111') * sets #N to 111

See also: PIC CDATE CTIME WIDEVAL WIDEPIC


Command: < CTIME > CTIME converts between alphanumeric and numeric time

Syntax: ret = CTIME(operand)

Description:
PRO-IV stores time in two forms: alphanumeric HHMMSS where HH is hours, MM is minutes, SS is seconds.
Numeric time is represented as a fraction of the day e.g.: 12:00 pm is .5.

Example:
#DATE.TIME = 67628.5 $TIME1 = '085624' #TIME1 = .1225

* FORMAT RESULT #TIME = CTIME($TIME1) .3725 $TIME = CTIME(#TIME1) '025624' $TIME = CTIME(FRAC(#DATE.TIME)) '120000'

See also: CDATE PIC CONV



Command: < DEFINE > DEFINE declares scratch arrays or to change a variables length

Syntax: DEFINE scratch-var({array-size},max-length)

Remarks:
DEFINE statements can only be used in logic id 000 or at the start of global logic. Do not include a sign when defining numerics. All defined numerics are automatically signed.

Example:
DEFINE $TYPES(5,1) * Defines a array of 5 types containing 1 character
DEFINE #TOTAL(10,11.2) * Defines a array of 10 totals with 11-digits before and * 2-digits after the decimal point

See also: EXTERN


Command: < DISABLE > DISABLE turns a kernel status flag off

Syntax: DISABLE(flag)

Description:
Is used to turn kernel status flags off.

Remarks:
There are a number of system flags: &#@BIT0-63, &#@NO-ECHO,&#@EMODE, &#@EUROF, ea. For a complete list see the process control options section To enquire on the status of flags use the commands: BITON and BITOFF.

Example:
DISABLE(&#@EUROF) UMSG('System Date display is set to US format MM/DD/YY') ENABLE(&#@EUROF) UMSG('System Date display is set to EUROPEAN format')

See also: BITON BITOFF ENABLE


Command: < DSEL > DSEL skips the current record and proceeds with the next

Syntax: DSEL

Description:
DSEL stops processing of the current iteration of an LS/LR/LU. Processing will continue with the next record from the primary file. No records are updated after a DSEL is issued.

Remarks:
Use only in file, sort/select, or control break logic Do not use in primary file logic and in before write logic. Use DSEL in sort/select logic to filter out records not to be selected for processing. Use DSEL in control break logic to suppress the printing of associated control break headers.

Example:
IF $STATUS = 'ERROR' THEN DSEL ENDIF

See also: DSELF SEL-ONLY SEL-RANGE SEL-PARTIAL


Command: < DSELF > DSELF prevents the read or write to a file in a logical screen, report or update

Syntax: DSELF

Description:
In contrast to DSEL only the current file is dselected.

Remarks:
Use DSELF only in file logic. Do not use DSELF in the before read and the after read no-error logic on the primary file!

Example:
IF KEY = '' THEN DSELF ENDIF

* Do not read the file if the key is empty.

See also: DSEL SEL-ONLY SEL-RANGE SEL-PARTIAL



Command: < EBCDIC > EBCDIC returns the EBCDIC equivalent of an ASCII String

Syntax: ebcdic = EBCDIC(operand)

Example:
$EBCDIC = EBCDIC($ASCII)

See also: ASCII


Command: < ENABLE > ENABLE turns a process control flag on

Syntax: ENABLE(flag)

Description:
Is used to turn a process control flag on.

Remarks:
There are a number of system flags: &#@BIT0-63, &#@NO-ECHO,&#@EMODE, &#@EUROF, ea. For a Complete list see the process control options section To enquire on the status of flags use the commands: BITON and BITOFF.

Example:
DISABLE(&#@EUROF) UMSG('System Date display is set to US format MM/DD/YY') ENABLE(&#@EUROF) UMSG('System Date display is set to EUROPEAN format')

See also: BITON BITOFF DISABLE


Command: < EXIT > EXIT exits the current logic routine

Syntax: EXIT

Example:
IF $CONT # 'Y' THEN EXIT ENDIF #I = 1 $A = 'A'

See also: LSEXIT FNEXIT


Command: < EXTERN > EXTERN Share scratch variables between functions and global logics

Syntax: EXTERN(var1{,var2,...,varn})

Remarks:
File variables are automatically shared between functions and global logics. Scratch arrays can also shared from PRO-IV 2.0 and on. This Procedure is supported in version(s): 1.5

Example:
EXTERN(#MAXIMUM,#AMOUNTS())

* shares #MAXIMUM with a calling function * shares the scratch array #AMOUNTS with the calling function

See also: DEFINE PARMS



Command: < FLD > FLD Is used to jump to the specified field in screens & reports

Syntax: FLD(dest-field{,skip{,backtab}})

Remarks:
Should only be used in field and file logic. You are not allowed to jump to a fld defined that is part of another logical screen. The skip and backtab options are supported from PRO-IV 3.0

Example:
IF $INPUT = 'N' THEN FLD 5 ENDIF


Command: < FNEXIT > FNEXIT exits the function and links to @LFUNCT.

Syntax: FNEXIT

Remarks:
After FNEXIT the function out logic is processed. Do not use FNEXIT in the function out Logic!!

Example:
IF $STOP = 'Y' THEN @LFUNCT = '@MAIN' FNEXIT ENDIF

* sets the system variable @LFUNCT and exits the function.

See also: EXIT LSEXIT


Command: < FOR > FOR used to execute a block of statements a number of times

Syntax: FOR variable = begin TO end BY increment statement-block ENDFOR FOR variable = begin DOWNTO end BY decrement statement-block ENDFOR

Example:
FOR #COUNTER = 1 TO 15 #TOTAL += #AMOUNT(#COUNTER) ENDFOR

* this logic sums a array of 15 amounts

See also: CASE IF WHILE


Command: < FRAC > FRAC returns the fractional part of a numeric value

Syntax: ret = FRAC(operand)

Remarks:
The value returned has the same precision and sign as the operand.

Example:
#FLOAT = 345.12345 #FRACT = FRAC(#FLOAT)

* sets #FRACT to .12345

See also: INT ROUND PRECISION MEAN



Command: < GETLPSEQ > GETLPSEQ returns the last sequence number for autosequenced files

Syntax: last_seq = GETLPSEQ(filename)

Remarks:
The file must be referenced in the function. PRO-IV versions 1.5,2.0,2.2 require that the file is referenced in the LS/LR/LU from which you are executing the command.

Example:
@FUN = 'TEST' @LGID = '001' #LAST_SEQ = GETLPSEQ("LOGIC") @LGSQ = PIC(#LAST_SEQ + 1,'999')

* This logic finds the last line for logic id 001 of * function TEST and then adds a record.


Command: < GLOBAL_LSCALL > GLOBAL_LSCALL invokes a global screen, report or update function

Syntax: GLOBAL_LSCALL(global_fun,window_parm)

Remarks:
Both parameters should not be enclosed in quotes.

Example:
GLOBAL_LSCALL(W_LOGIC,L001)

* Calls global function W_LOGIC with parameter set L001. * The parameters are defined by entering WI in the logic step field.

See also: LSCALL WINOPEN WINLOCATE WINSIZE PAGESIZE MAXPAGE


Command: < GMSG > GMSG displays a Global Error Message

Syntax: GMSG(operand)

Remarks:
Global Messages are displayed on the last line of the Screen.

0 The order of priority of message output is: 1 GMSG global messages 2 MSG messages 3 File error messages 4 Default system messages

This procedure is supported in version(s): 3.0

Example:
IF $INPUT # 'Y','N' THEN GMSG(ENTER_YN) ENDIF

* Prints a message if the input is not equal to either 'Y' * or 'N'.

See also: MSG UMSG



Command: < IF > IF tests for a condition and continues accordingly

Syntax: IF expression {THEN block of statements} {ELSE block of statements} ENDIF

Remarks:
A semi-colon(;) maybe used in place of ENDIF. A THEN and/or a ELSE block must be present.

Example:
IF $PROCESSED = 'Y' THEN $STATUS = 'PROCESSED' ELSE $STATUS = 'NOT PROCESSED' ENDIF

See also: FOR WHILE CASE


Command: < IN-ALPHA > IN-ALPHA tests whether a value is contained within a string

Syntax: IF value IN-ALPHA 'string' THEN statement;

Remarks:
This command is more or less equivalent with the more common INDEX command. The difference is that INDEX will return the start position of the searched value within the string.

Example:
IF $MODE IN-ALPHA 'ACDL' THEN UMSG('VALID MODE') ENDIF

* The message is printed if $MODE has one of the following * values: 'A','C','D','L','C','CD','DL','ACD','CDL','ACDL'

See also: INDEX IN-RANGE


Command: < IN-RANGE > IN-RANGE tests whether a value is within the limits of a string

Syntax: IF value IN-RANGE 'low-limit','high-limit' THEN statement;

Example:
IF $CHAR IN-RANGE 'A','Z' THEN UMSG('VALID CHARACTER') ENDIF

* This logic is equivalent to: IF $CHAR >= 'A' AND $CHAR <= 'Z' THEN UMSG('VALID CHARACTER') ENDIF

See also: INDEX IN-ALPHA


Command: < INDEX > INDEX returns the start position of a string within another

Syntax: position = INDEX(searched-str,find-string)

Remarks:
INDEX returns 0 if the string to look for is not found.

Example:
$STRING = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' $LOOKFOR = 'FGH' #POSITION = INDEX($STRING,$LOOKFOR)

* sets #POSITION to 7

See also: IN-RANGE IN-ALPHA


Command: < INT > INT returns the integer part of a numeric

Syntax: integer = INT(numeric)

Remarks:
The value returned has the same sign as the numeric

Example:
#NUM = 123.678 #I = INT(#NUM)

* sets #I to 123

See also: IN-RANGE IN-ALPHA


Command: < ISNULL > ISNULL tests for null data in the data buffers

Syntax: ISNULL(variable1{,..,variable})

Description:

All variables passed to ISNULL are tested for null data. If any of the variables have null data then the function returns true otherwise it returns false.

Remarks:
This Boolean is supported in version(s): 3.0

Example:
IF ISNULL(ITEM) THEN UMSG('NULL DATA FOR ITEM') ENDIF

* tests if ITEM has null data

See also: SETNULL



Command: < LEN > LEN returns the length of a string

Syntax: length = LEN(string)

Example:
$S = 'abcde' #L = LEN($S)

* sets #L to 5


Command: < LINK > LINK calls a linked in external procedural language routine

Syntax: LINK(3gl_routine)

Description:
You can link 3-gl procedures with the PRO-IV kernel. On the distribution disks there are 2 files: extsub.c and cstubs.c that provide templates for the linking of C routines with PRO-IV. See the PRO-IV environment guide for more detials.

Remarks:
Link does not restore the PRO-IV screen after it has run nor does it reset the terminal characteristics when the 3-gl routine is run. If this is required then use LINK-CRT instead.

Example:
LINK("hello_world") * runs a linked 3-gl routine named "hello_world"

LINK("calc_chk_sum","parm1","parm2") * runs a routine: calc_chk_cum and passes 2 parameters * parm1 and parm2. These are passed by reference to the * 3-gl routine.

See also: LINK-CRT SYSTEM SYSTEM-CRT XFER XFERIN


Command: < LINK-CRT > LINK-CRT calls a linked in external procedural language routine

Syntax: LINK(3gl_routine)

Description:
You can link 3-gl procedures with the PRO-IV kernel. On the distribution disks there are 2 files: extsub.c and cstubs.c that provide templates for the linking of C routines with PRO-IV. See the PRO-IV environment guide for more detials.

Remarks:
Link-CRT restores the PRO-IV screen after it has run and it resets the terminal characteristics before the 3-gl routine is run. If this is not required then use LINK instead.

Example:
LINK-CRT("hello_world") * runs a linked 3-gl routine named "hello_world"

LINK-CRT("calc_chk_sum","parm1","parm2") * runs a routine: calc_chk_cum and passes 2 parameters * parm1 and parm2. These are passed by reference to the * 3-gl routine.

See also: LINK SYSTEM SYSTEM-CRT XFER XFERIN


Command: < LOOPEXIT > LOOPEXIT exits the a FOR or WHILE loop

Syntax: LOOPEXIT

Example:
FOR #I = 1 TO 10 IF ACTION(#I) = '' THEN LOOPEXIT; ENDFOR

* Tests elements of the array ACTION till a empty one is * encountered.

See also: FOR WHILE


Command: < LOOPNEXT > LOOPNEXT continues with the next iteration in a FOR or WHILE loop

Syntax: LOOPNEXT

Example:
FOR #I = 1 TO 10 IF ACTION(#I) = '' THEN LOOPNEXT; #F += 1 ENDFOR

* This logic counts the number elements from the array * ACTION that are not empty.

See also: FOR WHILE


Command: < LSCALL > LSCALL invokes a logical screen, report or update

Syntax: LSCALL(ls_no)

Example:
LSCALL(5) * calls logical screen 5

See also: GLOBALLSCALL WINOPEN WINLOCATE WINSIZE PAGESIZE MAXPAGE


Command: < LSEXIT > LSEXIT exits the logical screen

Syntax: LSEXIT

Remarks:
After LSEXIT the Logical Screen out logic is processed. Do not use LSEXIT in the Logical Screen exit Logic!

Example:
IF $STOP = 'Y' THEN FNEXIT ENDIF

See also: EXIT FNEXIT



Command: < MAX > MAX returns the highest value in a series of operands

Syntax: maximum = MAX(operand1,operand2,...,operandn)

Example:
#A = 5 #B = 7 #M = MAX(#A,#B) * sets #M to 7

See also: MIN MEAN


Command: < MEAN > MEAN returns the average value of a series of operands

Syntax: average = MEAN(operand1,operand2,...,operandn)

Example:
#A = 5 #B = 7 #C = 12 #M = MEAN(#A,#B,#C) * sets #M to 8

See also: MAX MIN


Command: < MIN > MIN returns the lowest value in a series of operands

Syntax: minimum = MIN(operand1,operand2,...,operandn)

Example:
#A = 5 #B = 7 #M = MIN(#A,#B) * sets #M to 5

See also: MAX MEAN


Command: < MSG > MSG displays a Error Message

Syntax: MSG(operand)

Remarks:
Messages are displayed on the last line of the Screen. The order of priority of message output is: 1 GMSG Global messages 2 MSG messages 3 File Error Messages 4 Default System Messages This Procedure is supported in version(s): 3.0

Example:
IF $INPUT # 'Y','N' THEN MSG(1) ENDIF

* Prints a message if the input is not equal to either 'Y' * or 'N'.

See also: GMSG UMSG



Command: < NUMERIC > NUMERIC converts data from either alphanumeric or wide to numeric

Syntax: num = NUMERIC(operand)

Example:
#VAL = NUMERIC($VALUE)

See also: ALPHA NUMERIC CONV



Command: < ORD > ORD returns the numeric value for ASCII/EBCDIC characters

Syntax: ORD(operand)

Description:
This command returns the numeric value for either a ASCII or EBCDIC character.

Example:
#C = ORD('A') sets #C to 111

See also: CHAR



Command: < PARMS > PARMS declares all parameters passed to a global logic

Syntax: PARMS(operand1,...,operandn)

Remarks:
Parameters are passed by reference (pointers) whereby the memory address is passed rather than copies of the parameters. Therefore if you change the value of a parameter, you are changing the original value. File variables are available in a global logic. A whole array is passed to the global logic if you do not type a element number but just type ().

Example:
PARMS(#P1,$P2)

See also: EXTERN DEFINE


Command: < PFKEYCAP > PFKEYCAP returns the keycap text for one of the user def. Fnkeys

Syntax: PFKEYCAP(fnkey_no)

Description:
The user defined function keys can be setup in $CRT, the terminal characteristics screen. You can define up to 10 user defined keys. When defining keys you also add a text, for example:
if you want key 1 to be control-F1 then enter in the text field CRTL-F1. This text can be retrieved with PFKEYCAP(1). Together with PFKEYUSAGE, that gets the text from the function key definition screen (window on FNKEY in the logical screen editor for screens), you are able to provide customized help message.

Example:
* Define in $CRT fnkey 1 as CTRL-F1 * Setup an action in the logical screen editor and add * a text "Main Menu"

$K = PKKEYCAP(1) $U = PFKEYUSAGE(1) UMSG($K + ' ' + $U)

* Displayed will be "CTRL-F1 Main Menu"

See also: PFKEYUSAGE


Command: < PFKEYUSAGE > PFKEYUSAGE returns the usage text for one of the user def. Fnkeys

Syntax: usage_str = PFKEYUSAGE(fnkey_no)

Description:
The user defined function keys can be setup in $CRT, the terminal characteristics screen. You can define up to 10 user defined keys. When defining the keys you also define a text, for Example:
if you want key 1 to be control-F1 then enter in the text field CRTL-F1. This text can be retrieved with PFKEYCAP(1). Together with PFKEYUSAGE, that gets the text from the function key definition screen (window on FNKEY in the logical screen editor for screens), you are able to provide customized help message for your users.

Example:
* Define in $CRT fnkey 1 as CTRL-F1 * Setup an action in the logical screen editor and add

$K = PKKEYCAP(1) $U = PFKEYUSAGE(1) UMSG($K + ' ' + $U)

* Displayed will be "CTRL-F1 Main Menu"

See also: PFKEYCAP


Command: < PIC > PIC converts data from numeric or alpha to alpha with editing

Syntax: PIC(operand,mask)

Description:
This routine converts with editing. If editing is not required then use CONV. In a numeric mask: 'Z' zero supression character '9' represents the position of a digit

In a alphanumeric mask: 'X' left justify character 'Y' right justify character

Remarks:
The 'X' and the 'Y' are mutually exclusive a single mask.

Example:
COMMAND - RESULT $A = PIC(123.5-,'ZZ99.99-') - ' 123.50-' $A = PIC('ABCD','X-X-X-X-X') - 'A-B-C-D- ' $A = PIC('ABCD','XXX') - 'BCD' $A = PIC('ABCD','YYY') - 'ABC'

See also: CONV CDATE


Command: < PRECISION > PRECISION sets the rounding factor for arithmetic operations

Syntax: PRECISION(decimals)

Remarks:
The default precision for arithmetic operation in PRO-IV is 6. After a PRECISION command is issued, rounding is in effect for the duration of the logic routine or until another PRECISION command is issued.

Example:
#A = 1.25 #B = 2.75 #C = #A * #B PRECISION(2) #D = #A * #B

* sets #C to 3.475 * sets #D to 3.44

See also: ROUND



Command: < REM > REM returns the remainder of a division operation.

Syntax: remainder = REM(operand1,operand2)

Description:
The value returned is the remainder of operand1 divided by operand2.

Example:
#A = 23 #B = 4 #C = 17 #I = REM(#A,#B) #X = REM(#C,#B)

* sets #I to 3 * sets #X to 1


Command: < RETRY_READ > RETRY_READ PRO-IV will keep on trying to read a record that is locked

Syntax: RETRY_READ()

Description:
If PRO-IV attempts to read a locked record and this is on the first (primary) file in a logical screen then PRO-IV will return to the last input field (the read field). This command tells the system to continue trying a set the lock.

Remarks:
This command can only used in Lock Logic. This procedure is supported in version(s): 3.0

Example:
#I += 1 IF #I < 5 THEN RETRY_READ() ELSE SUPPRESS_RETRY() ENDIF

* The system will try to read a record 5 times, if it * stays locked then the system will abort trying.

See also: SUPPRESS-RETRY


Command: < RETURN > RETURN ends a called step, and ends a global logic

Syntax: RETURN{(value)}

Remarks:
If RETURN is used to mark the end of a called step in logic then no parameter is allowed. When you use RETURN in a global logic, add a parameter to pass a value back to the calling logic.

Example:
CALL(1) 1 IF A = B THEN C = B; RETURN

* RETURN used in a called step

A PARMS($B) IF $B = 'A' THEN $R = $B ELSE $R = ''; RETURN($R)

* Return used to return a alphanumeric variable. * the call in logic: $A = GLOGIC($C)


Command: < ROLLBACK > ROLLBACK requests an immediate rollback of the database

Syntax: #status = ROLLBACK()

Description:
A SQL Transaction Processing command

Remarks:
There are a few implications of as forced rollback, such as loss of fetch currency and release of locks, therefore use this command only if you cannot rely on the implicit rollbacks used by PRO-IV.

Example:
IF $WRITE = 'N' THEN #ST = ROLLBACK() ENDIF

* If $WRITE = 'N' a ROLLBACK is issued.

See also: COMMIT


Command: < ROUND > ROUND rounds a number to to a specified number of decimal places

Syntax: rounded = ROUND(value,decimals)

Remarks:
If you have a lot of rounding operations to the same number of decimals then consider to use PRECISION instead of ROUND

Example:
#A = 1.25 #B = 2.75 #C = #A * #B #D = ROUND(#A * #B,2)

* sets #C to 3.475 * sets #D to 3.44

See also: PRECISION



Command: < SEL-ONLY > SEL-ONLY is used to select records from the primary file is a LS

Syntax: SEL-ONLY(operand)

Description:
SEL-ONLY is used to select records with a key that exactly matches the operand. If the operand is not the first key field, all key fields that precede the operand must also be initialized.

Remarks:
SEL-ONLY can only be used in default logic of an LS/LR/LU SEL-ONLY can not be used on files te have no key, like sequential or binary files.

Example:
* To access a file with one key field: CODE CODE = '1000' SEL-ONLY(CODE)

* To access a file with two keys

TYPE = 'A' CODE = '500' SEL-ONLY(CODE)

* this will read all records with the key 'A500'

See also: SEL-RANGE SEL-PARTIAL


Command: < SEL-PARTIAL > SEL-PARTIAL is used to select records from the primary file is a LS

Syntax: SEL-PARTIAL(operand)

Description:
SEL-PARTIAL is used to select records with a key that matches the operand for the length of the operand. If a key field is 5 bytes long and you are looking for records that start with 'AA' then set the key field to 'AA' and use SEL-PARTIAL to select all records starting with 'AA'.

Remarks:
SEL-PARTIAL can only be used in default logic of an LS/LR/LU. SEL-PARTIAL can not be used on files te have no key, like sequential or binary files. For multiple field key files, if the operand is not the first key, all key fields that precede the operand must also be initialized.

Example:
* To access a file with one key field: CODE of 4 bytes

CODE = '10' SEL-PARTIAL(CODE)

* Selects all records with a key that starts with '10'

TYPE = 'A' CODE = '5' SEL-PARTIAL(CODE)

* this will read all records with the key 'A5'

See also: SEL-ONLY SEL-RANGE


Command: < SEL-RANGE > SEL-RANGE is used to select records from the primary file is a LS

Syntax: SEL-RANGE(operand)

Description:
SEL-RANGE is used to select a range of records from the primary file. You have to initialise all key variables to the lower limit of the range. After that set-up a scratch variable where you concatenate all keys and define the upper limit of the range. You then issue a SEL-RANGE command and as operand you use the upper limit. PRO-IV will process all records from the lower through the upper limit.

Remarks:
SEL-RANGE can only be used in default logic of an LS/LR/LU. SEL-RANGE can not be used on files to have No key, like sequential or binary files. If the primary file is a company division file, the first 3 bytes of the operand must be set to the company code (@COMP). On SQL systems SEL-RANGE will behave differently from ISAM systems. All keys evaluated separate not concatenated. To undo this set environment variable: SET_AGGREGATE_KEY

Example:
* To access a file with one key field: CODE and to select a range of records with keys between 1000 and 2000

CODE = '1000' $END = '2000' SEL-RANGE($END)

* Select records from a multiple key file with CO/DIV = 'Y'

TYPE = 'A' CODE = '500' $END = @COMP(1,3) + 'B' + '700' SEL-RANGE($END)

* this will read all records with the key A500 thru B700

See also: SELRANGE SELPARTIAL


Command: < SETNULL > SETNULL sets data buffers to as null value

Syntax: SETNULL(variable1{,..,variable})

Description:
All variables passed to SETNULL are set to a null data state.

Remarks:
This Boolean is supported in version(s): 3.0

Example:
SETNULL(ITEM)

* sets ITEM to a null data state

See also: ISNULL


Command: < SET_RECORD_FOR_DELETE > SET_RECORD_FOR_DELETE changes the mode for "M" and "R" file modes to delete

Syntax: SET_RECORD_FOR_DELETE

Description:
This command changes the write mode for files in 'M' and 'R' mode from change to delete.

Remarks:
Use this command only in Before Write Logic of a file in 'M' or 'R' mode.


Command: < SET_RPTOPT > SET_RPTOPT changes report spooler options at runtime

Syntax: SET_RPTOPT(operand1,operand2,operand3)

Description:
Valid device types are: 1 Spooled - logical device 6 Attached printer 2 Spooled - file 7 Undefined 3 Spooled - physical device 8 File 4 for future use 9 Physical Device 5 CRT

Remarks:
Use SET_RPTOPT only in function logic in of a Report. SET_RPTOPT overrides options entered in $SPOOL. SET_RPTOPT options are overwritten by @RPTOPT settings.

Example:
SET_RPTOPT("printfile","8","")

* sends report output to the file "printfile"


Command: < STEP > STEP calls a logic line with the specified step-number

Syntax: STEP(step-number)

Remarks:
STEP is the equivalent of the BASIC GOTO command It is recommended that all called steps end with a RETURN statement for readability.

Example:
IF $OK = 'Y' THEN STEP 1 ENDIF EXIT UMSG('THIS MESSAGE IS PRINTED WHEN $OK = "Y"')

See also: CALL


Command: < SUBSTR > SUBSTR retrieves a portion of a string

Syntax: SUBSTR(string,start,end) or string(start,end)

Description:
There are two ways you can retrieve a portion of a string: - via the SUBSTR command - via In-line substringing


Command: < SUPPRESS_RETRY > SUPPRESS_RETRY PRO-IV will stop trying to read a record that is locked

Syntax: SUPPRESS_RETRY()

Description:
PRO-IV attempts to read a locked record on a secondary file read in a logical screen, it will keep on trying to obtain a lock. The command tells PRO-IV to stop trying.

Remarks:
This command can only used in Lock Logic. This Procedure is supported in version(s): 3.0

Example:
#I += 1 IF #I < 5 THEN RETRY_READ() ELSE SUPPRESS_RETRY() ENDIF

* The system will try to read a record 5 times, if it * stays locked then the system will abort trying.

See also: RETRY_READ


Command: < SYSF > SYSF sends a command directly to the PRO-IV kernel

Syntax: SYSF(operand1{,...,operandn})

Description:
This command can be used to issue operating system specific commands. It can be used create, delete or check files.

Remarks:
Use this command carrefully and do not expect any support from MDIS since they consider this command as a unsupported feature.

Example:
SYSF(&#@CREATE,"new_file.pro",8,1530)

* Creates a file on disk with a key of 8 bytes and a record * length of 1530, so the maximum size is set to 192 MB.

SYSF(&#@DELETE,"old_file.pro")

* Deletes file "old_file.pro" from disk

SYSF(&#@CHKFILE,"customer.pro",#EXIST)

* Checks whether a file exists, if so then #EXIST is set to * 0 otherwise #EXIST contains a error code


Command: < SYSTEM > SYSTEM calls another program, executes a OS command

Syntax: exit_status = SYSTEM(command)

Description:
You can run any command as if you where at the operating system prompt. After the command has finished control is passed back to PRO-IV. If you want to execute the command without passing control back to PRO-IV, so exit PRO-IV, then use XFER.

Remarks:
SYSTEM does not restore the PRO-IV screen after it has run and it does not reset the terminal characteristics before 3-gl routine is run. If this is required then use SYSTEM-CRT instead.

Example:
#ST = SYSTEM("dir/p") * Displays a direcory listing in a MSDOS environment
#ST = SYSTEM('copy file1.pro file2.pro') * copies file1.pro to file2.pro in a MSDOS environment

See also: SYSTEM-CRT LINK LINK-CRT XFER XFERIN


Command: < SYSTEM-CRT > SYSTEM-CRT calls another program, executes a OS command

Syntax: exit_status = SYSTEM-CRT(command)

Description:
You can run any command as if you where at the operating system prompt. After the command has finished control is passed back to PRO-IV. If you want to execute the command without passing control back to PRO-IV, so exit PRO-IV, then use XFER.

Remarks:
SYSTEM-CRT restores the PRO-IV screen after it has run and it resets the terminal characteristics before 3-gl routine is run. If this is not required then use SYSTEM instead.

Example:
#ST = SYSTEM-CRT("dir/p") * Displays a directory listing in a MSDOS environment
#ST = SYSTEM-CRT('copy file1.pro file2.pro') * copies file1.pro to file2.pro in a MSDOS environment

See also: SYSTEM LINK LINK-CRT XFER XFERIN



Command: < UMSG > UMSG sends a message to the screen

Syntax: UMSG(operand1{,operand2})

Remarks:
The maximum length of the message is 80 characters.You are not allowed to include ESCAPE codes in a UMSG.

Example:
UMSG('A message") * Displays the message

UMSG("Another message",3) * Displays the message and waits for 3 seconds

UMSG("Press ENTER to continue",-1) * Displays the message and wait for the user to press the * ENTER key.

See also: MSG GMSG



Command: < VERT-TOT > VERT-TOT returns a VERT-TOT accumulated in a Report Field

Syntax: total = VERT-TOT(operand)

Remarks:
Use this command only in Control Break Logic

Example:
#TOTAL = VERT-TOT(INVOICE_TOTAL)

* sets #TOTAL to the sum of all INVOICE_TOTALS



Command: < WHILE > WHILE used to execute a block of statements a number of times

Syntax: WHILE condition statement-block ENDWHILE

Remarks:
The loop is executed while the condition is true.

Example:
#I = 0 WHILE (#I < 10) #I += 1 ENDWHILE

* the loop is executed 10 times

See also: CASE IF FOR


Command: < WIDEPIC > WIDEPIC converts date from numeric or wide to wide with editing

Syntax: WIDEPIC(operand,mask)

Description:
This routine converts with editing. If editing is not required then use CONV. Use the following mask: 'X' to left justify 'Y' to right justify

Remarks:
The 'X' and the 'Y' are mutually exclusive a single mask.

Example:
COMMAND - RESULT !A = WIDEPIC(123.5-,'XXXXXXX') - '123.5- ' !A = PIC(1234,'X-X-X-X-X') - '1-2-3-4- '

See also: CONV CDATE PIC WIDEVAL


Command: < WIDEVAL > WIDEVAL converts date from numeric or alphanumeric to wide

Syntax: wide = WIDEVAL(operand)

Remarks:
USE WIDEPIC if the numeric has a fractional part.

Example:
!A = WIDEVAL(123) !A = WIDEVAL('ABCD')

See also: CONV CDATE PIC WIDEPIC


Command: < WINLOCATE > WINLOCATE specifies the start row/col of LS

Syntax: WINLOCATE(ls_no,start_row,start_col)

Remarks:
If you set both start_row and start_col to 0 and issue a WINLOCATE command then PRO-IV will set start_row and start_col to the current values.

Example:
WINLOCATE(14,4,30)

* sets the start position of LS# 14 to row 4 and column 30

See also: WINOPEN LSCALL



Command: < XFER > XFER executes a OS command and exits PRO-IV

Syntax: exit_status = XFER(command)

Description:
You can run any command as if you where at the operating system prompt. When the program is called PRO-IV will abort control is passed to the called program. If you want to continue with PRO-IV after the program has been finished then use either SYSTEM or SYSTEM-CRT.

Remarks:
If the calling program does not exist or can be executed then PRO-IV is left in a undefined state!

Example:
#ST = XFER("wp")

* Starts wordperfect in a MSDOS environment.

See also: XFERIN LINK LINK-CRT SYSTEM SYSTEM-CRT


Command: < XFERIN > XFERIN Gets the parameters that are passed to PRO-IV

Syntax: XFERIN(var1,var2,..,varn)

Description:
You can only pass parameters to PRO-IV when a transparent logon is performed. You have set the transparent logon flag in the $OPR screen. The first two parameters passed to PRO-IV must be the operator code and the company code, then use either SYSTEM or SYSTEM-CRT.

Remarks:
There is no system variable telling you how many parameters where passed to PRO-IV.

Example:
XFERIN($P1,$P2)

* a the operating system command line like this: * pro SYS MDC parm1 parm2 * results in $P1 set to "parm1" and $P2 set to "parm2"

See also: XFER LINK LINK-CRT SYSTEM SYSTEM-CRT