PL1 Functions
PL1 Functions
AREA -- Attribute
Reserves storage (in bytes) for the area. Default size is 1000 bytes.
>>--AREA----------------------------------------------------------------><
+-(--*--)-------------------------------------
+-(--expression-----------------------------)-+
+-REFER--(--variable--)-+
Example: DECLARE MC AREA(4095);
ASSEMBLER (ASM) -- Option of OPTIONS Attribute
Specifies that entry point is in an assembler routine.
Example: DECLARE ENTB ENTRY OPTIONS(ASM);
ATTENTION (ATTN) -- Condition
Occurs in conversational mode when programmer causes an attention interruption from the
terminal or when
SIGNAL ATTENTION is executed.
>>--ATTENTION-----------------------------------------------------------><
Example: ON ATTENTION CALL ATTPACK;
BACKWARDS -- Attribute
Causes the (implied) RECORD SEQUENTIAL INPUT tape file to be accessed in reverse order.
>>--BACKWARDS-----------------------------------------------------------><
Example: DECLARE TAPE FILE INPUT BACKWARDS...;
BASED -- Attribute
Specifies that the actual area of storage is identified by locator values. A based variable can be
used to refer
to variables of any storage class; it can also control its own storage by means of ALLOCATE and
FREE
statements.
>>--BASED---------------------------------------------------------------><
+-(--locator-reference--)-+
Example: DECLARE REC CHAR(30) BASED(P);
+-,--y-+
Example: CALL BC(SUBSTR(CHAR(B3,10),10,1));
>>--DATAFIELD-----------------------------------------------------------><
+-(--)-+
Example: ON NAME(INFILE) PUT SKIP
EDIT('UNKNOWN:', DATAFIELD) (A);
LABEL -- Attribute
Specifies an identifier as label variable. Optimization is aided by including a list of label
constants that the
variable can take as values.
>>--LABEL---------------------------------------------------------------><
<-,--------------+
+-(----label-constant----)-+
Example: DECLARE DOG LABEL (D1,D2);
LOCATE -- Statement
Causes allocation of a based variable in an output buffer and transmission of previous output
buffer, if
necessary.
>>--LOCATE--based-variable--FILE--(--file-reference--)------------------->
>-------------------------------------------------------------------;---><
+-SET--(--pointer-reference--)-+ +-KEYFROM--(--expression--)-+
Example: LOCATE RECORD SET(Q) FILE(PATIENT);
NAME -- Condition
Raised during a data-directed GET FILE statement when an invalid identifier occurs in the data
stream.
>>--NAME--(--file-reference--)------------------------------------------><
Example: ON NAME(INFILE) PUT SKIP
EDIT('UNKNOWN:', DATAFIELD)(A);
OFFSET -- Attribute
Specifies that the variable identifies a location relative to the start of an area.
>>--OFFSET--------------------------------------------------------------><
+-(--area-variable--)-+
Example: DECLARE DATA AREA(50),
(L1,L2) OFFSET(DATA);
RECORD -- Condition
Raised if size of record and variable do not correspond.
>>--RECORD--(--file-reference--)----------------------------------------><
Example: ON RECORD(NEWINFO) BEGIN;
...END;
RETURN -- Statement
Terminates execution of its procedure. For a function procedure, an expression must be
included.
>>--RETURN------------------------;-------------------------------------><
+-(--expression--)-+
Example: RETURN;
RETURN(2*P+Q);
RETURNS -- Attribute/Option of PROCEDURE or ENTRY Statement
Specifies data attributes of a returned value.
<-----------+
>>--RETURNS--(----attribute----)----------------------------------------><
Example: DECLARE A ENTRY RETURNS(FIXED);
F:PROCEDURE RETURNS(FIXED);
SAMEKEY -- Built-In Function
Returns '1'B if record accessed on a VSAM data set is followed by another record with the same
key.
>>--SAMEKEY--(--x--)----------------------------------------------------><
Example: IF SAMEKEY(INFILE) THEN ...;
Example: ON SIZE P = Q;
STATIC -- Attribute
Specifies storage is allocated before execution and remains allocated throughout execution.
>>--STATIC--------------------------------------------------------------><
Example: DECLARE TABLE (6,6) STATIC;
TASK -- Attribute
Specifies that identifier is task name and can be used to determine or modify relative priority of
task, using
PRIORITY built-in function/pseudovariable.
>>--TASK----------------------------------------------------------------><
Example: DECLARE TX TASK;
PRIORITY(TX)=1;
>>--TASK----------------------------------------------------------------><
+-(--task-reference--)-+
Example: CALL PROCA TASK(T1);
TITLE -- Option of OPEN Statement
Identifies data set associated with a file.
Example: OPEN FILE(W) TITLE('SUPER');
TRANSLATE -- Built-In Function
Translates source string x according to replacement string y and z. If z is omitted, string
containing all
possible characters (in ascending order) is assumed.
>>--TRANSLATE--(--x--,--y------------)----------------------------------><
+-,--z-+
Example: W = TRANSLATE (W,NEWCHARS,OLDCHARS);
TRANSMIT -- Condition
Raised by a permanent I/O transmission error.
>>--TRANSMIT--(--file-reference--)--------------------------------------><
Example: ON TRANSMIT (PAYROLL)...;
>>--UNDEFINEDFILE--(--file-reference--)---------------------------------><
Example: ON UNDF(MASTER) GO TO STOPRUN;
UPDATE -- Attribute
Specifies that file is used for both input and output.
+-INPUT--+
>>--+-OUTPUT-+----------------------------------------------------------><
+-UPDATE-+
Example: DECLARE F FILE UPDATE...;
VARIABLE -- Attribute
Identifies associated item to be a variable. Can be specified only for file, entry, or label
variables.
>>--VARIABLE------------------------------------------------------------><
Example: DECLARE G FILE VARIABLE;