IFDFLD (HLI function)

From m204wiki
Revision as of 21:14, 11 July 2016 by ELowell (talk | contribs)
Jump to navigation Jump to search

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

Summary

Description
The IFDFLD call (DEFINE FIELD) defines a new field for a Model 204 file.
Thread type
multiple cursor IFSTRT, single cursor IFSTRT
IFCALL function number
24

Syntax

IFDFLD(RETCODE,FIELD_DESC,FILE_SPEC)

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.
FIELD_DESC [I,c,r] The field description is a required input parameter that specifies the name of the new field and a list of its attributes. Specify the field as a character string using the following format:

fieldname [(attribute ...)];

where:

fieldname is required and specifies the name of the new field. The name must be unique within the context of the file where it will be stored.

Specify the name as a character string up to 255 characters in length. The name must begin with a letter and it can contain any alphanumeric character except the following:

  • At sign (@)
  • Pound sign (#)
  • Semi-colon (;)
  • Double question marks (??)
  • Question mark followed by a dollar sign (?$)
  • Question mark followed by an ampersand (?&)

For the detailed list of rules that apply to naming fields, see Field names.

attribute is optional and specifies a particular characteristic that controls how the field is used, stored, or accessed. You can specify more than one attribute, separating each by a comma or a blank.

The attributes that can be specified using the IFDFLD call are identical to those that are used with the DEFINE FIELD command. For more information, see Field descriptions and attributes.

Note: If no attributes are specified, Model 204 defines the field assigning all of the default attributes.

FILE_SPEC [I,s,o] The file specification is an optional input parameter for use only with a multiple cursor IFSTRT thread; it specifies the name of the Model 204 file that will contain the new field. Specify the name of the file as a short character string variable using the following format:

IN [FILE] filename

The specified file must be open on the thread, otherwise the call is unsuccessful and Model 204 returns a completion code equal to 4.

Usage notes

Use the IFDFLD call to define a new field in a Model 204 file. The IFDFLD call is valid on all types of IFSTRT threads. You can use the IFDFLD call once the Model 204 file has been initialized (using the IFINIT call).

When FOPT=X'10' and the date/time stamp feature is installed, the IFDFLD function is supported for DTS files.

Note: The file context can change on a multiple cursor thread and, if the file specification parameter (FILE_SPEC) is omitted, IFDFLD defines the field for the default file on the thread.

Note that certain types of fields must be defined using IFINIT rather than IFDFLD. You cannot use IFDFLD to define fields when:

  • Record security is defined using the field
  • The field is defined as a sort key
  • The field is used as a hash key

Note also that IFDFLD follows the same basic rules for specifying field attribute definitions as the Model 204 DEFINE FIELD command.

For more information, see Field descriptions and attributes.

Coding example (COBOL)

WORKING-STORAGE SECTION. 01 CALL-ARGS. 05 RETCODE PIC 9(5) COMP SYNC. 05 FIELDA PIC X(20) VALUE "FIELDA(BINARY KEY);". 05 FIELDB PIC X(32) VALUE "FIELDB(FEW-VALUED,CODED, RANGE);". . . . PROCEDURE DIVISION. . . . CALL "IFDFLD" USING RETCODE, FIELDA, FIELDB.