9 125 GET_PROCESS_LIST

LANSA Technical

9.125 GET_PROCESS_LIST

Þ Note: Built-In Function Rules.

Retrieves a list of processes and their descriptions from the LANSA internal database and returns them to the calling RDML function in a variable length, working list

Þ This is a Specialized Built-In Function for use in a Development Environment only.

For use with

LANSA for i

YES

Visual LANSA for Windows

YES

Visual LANSA for Linux

NO

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Positioning process value. The returned list starts with the first process from the dictionary whose name is greater than the value passed in this argument.

1

10

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

L

Req

Working list to contain Process information.

List must not be more than:
32767 entries in Windows
9999 entries on IBM i.

The calling RDML function must provide a working list with an aggregate entry length of exactly 60 bytes.

Each returned list entry is formatted as follows:

From - To   Description

1 - 10   Process name

11 - 50   Description

51 - 60   <<future expansion>>

60

60

 

 

2

A

Opt

Last process in returned list Typically this value is used as the positioning argument on a subsequent calls to this Built-In Function.

1

10

 

 

3

A

Opt

Return code.

OK = list returned partially or completely filled with process details. No more processes exist beyond those returned in the list.

OV = list returned completely filled, but more processes than could fit in the list exist. Typically used to indicate "more" processes in page at a time style list displays.

NR = list was returned empty. Last process in the list is returned as blanks.

2

2

 

 

 

 

Example

A program can be created, using this function, to compile a series of processes in an overnight job.

FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#STARTPRC) REFFLD(#PROCESS) DESC('Start Search with:')
DEFINE FIELD(#LASTPRC) REFFLD(#PROCESS) DESC('Last retrieved:')
DEFINE FIELD(#SPARE) REFFLD(#PROCESS)
OVERRIDE FIELD(#STD_INSTR) COLHDG('Name (Description)')
OVERRIDE FIELD(#STD_CMPAR) DESC('Return Code (OV,OK or NR)')
DEF_LIST NAME(#PRCLST) FIELDS(#PROCESS #PARTDESC #SPARE) TYPE(*WORKING) ENTRYS(14)
DEF_LIST NAME(#BRWLST) FIELDS((#STD_INSTR *NOID))

CHANGE FIELD(#LASTPRC #STD_CMPAR) TO(*BLANKS)

BEGIN_LOOP
REQUEST FIELDS(#STARTPRC #LASTPRC (#STD_CMPAR *OUT)) IDENTIFY(*DESC) BROWSELIST(#BRWLST)
IF COND('#lastprc *ne #blanks')
CHANGE FIELD(#STARTPRC) TO(#lastprc)
ENDIF
CLR_LIST NAMED(#PRCLST)
USE BUILTIN(GET_PROCESS_LIST) WITH_ARGS(#STARTPRC) TO_GET(#PRCLST #LASTPRC #STD_CMPAR)
CASE OF_FIELD(#STD_CMPAR)
WHEN VALUE_IS('= OV')
CLR_LIST NAMED(#BRWLST)
SELECTLIST NAMED(#PRCLST)
USE BUILTIN(BCONCAT) WITH_ARGS(#PROCESS '(' #PARTDESC ')') TO_GET(#STD_INSTR)
ADD_ENTRY TO_LIST(#BRWLST)
ENDSELECT
WHEN VALUE_IS('= OK')
MESSAGE MSGTXT('No more matching process names')
CHANGE FIELD(#LASTPRC) TO(#BLANKS)
WHEN VALUE_IS('= ER')
MESSAGE MSGTXT('No process names matching search')
ENDCASE
END_LOOP