IFCOUNT (HLI function)

From m204wiki
Jump to navigation Jump to search

The conventions used on this page are described in Function call notation conventions.

Summary

Description
The IFCOUNT call (COUNT) counts the number of records in a found set or list and returns the record count in an output parameter.
Thread type
multiple cursor IFSTRT, single cursor IFSTRT
IFCALL function number
14

Syntax

IFCOUNT|IFCNT(RETCODE,COUNT,SET_QUAL)

Compile-only form
Not available
Execute-only form
Not available

Specify the parameters in the syntax order shown above.

Parameter Description
RETCODE [O,i,r] The Model 204 return code is the required first parameter. The code is a binary integer value.
COUNT [O,i,r] The count parameter is a required parameter that specifies the location of the output parameter for the return count value. Specify an integer variable. Model 204 returns the record count as a fullword binary number.
SET_QUAL [I,c,r] The set qualifier is available only for use with a multiple cursor IFSTRT thread and it is required for specifying the record set or list whose records will be counted. Specify a character string using either one of the following formats:

{IN label | ON [LIST] listname}

where:

label is the name of a saved IFFIND, IFFNDX, IFFWOL, or IFFAC compilation from the previously compiled call that established the record set.

listname specifies the name of a list.

Note: The set qualifier is not a valid parameter for use with a single cursor IFSTRT thread.

Usage notes

Use the IFCOUNT call to count the records in a found set. IFCOUNT returns a value of 0 for a null set. You can use IFCOUNT after an IFFIND call having a completion code of 0 to check for a null set.

The IFCOUNT call is valid on all types of IFSTRT threads. You must specify the found set to be counted on a multiple cursor IFSTRT thread. On a single cursor IFSTRT thread, IFCOUNT returns the count for the set that is current.

Note: The count that is returned by the IFCOUNT call is written to the Model 204 audit trail if RK lines are written to the journal. For information about Model 204 journals and audit trails, see Tracking system activity.

Coding example (COBOL)

WORKING-STORAGE SECTION. 01 ARGS-FOR-CALL COMP SYNC. 05 RETCODE PIC 9(5). 05 COUNT PIC 9(5). . . . PROCEDURE DIVISION. . . . CALL "IFCOUNT" USING RETCODE, COUNT.