9.192 SET_FILE_ATTRIBUTE

Note: Built-In Function Rules     Usage Options

Sets a file's database attributes.

An edit session must be commenced by using the START_FILE_EDIT Built-In Function prior to using this Built-In Function.

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

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Attribute to set

1

256

 

 

 

 

 

Valid attributes . . .

I/O module:

'IOMODULE=YES' 'IOMODULE=NO '

IBM i High Speed Table:

'OS400HST=YES' 'OS400HST=NO '

 

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Return code (OK, ER)

In case of "ER" return code error message(s) are issued automatically.

2

2

 

 

 

Note: Currently this Built-In Function can only be used to determine whether or not a file will have an I/O module.

Example

A LANSA function to emulate the 'File definition Menu' has been written. When a certain option is taken the user can decide to set a file attribute. IE Do you want an I/O module (Yes/No) ?

********** Define arguments and lists

DEFINE     FIELD(#FILNAM) TYPE(*CHAR) LENGTH(10)

DEFINE     FIELD(#LIBNAM) TYPE(*CHAR) LENGTH(10)

DEFINE     FIELD(#YESNO) TYPE(*CHAR) LENGTH(32) LABEL('I/O Module')

DEFINE     FIELD(#RETCOD) TYPE(*CHAR) LENGTH(2)

BEGIN_LOOP

********** Request File and library name and I/O module attribute

REQUEST    FIELDS(#FILNAM #LIBNAM #YESNO)

**********

USE        BUILTIN(START_FILE_EDIT) WITH_ARGS(#FILNAM #LIBNAM 'DEM') TO_GET(#RETCODE)

IF         COND('#YESNO *EQ YES')

USE        BUILTIN(SET_FILE_ATTRIBUTE) WITH_ARGS('''IOMODULE=YES''') TO_GET(#RETCOD)

ELSE

USE        BUILTIN(SET_FILE_ATTRIBUTE) WITH_ARGS('''IOMODULE=NO ''') TO_GET(#RETCOD)

ENDIF

USE        BUILTIN(END_FILE_EDIT) WITH_ARGS('Y') TO_GET(#RETCOD)

********** Submit job to make file operational

USE        BUILTIN(MAKE_FILE_OPERATIONL) WITH_ARGS(#FILNAM #LIBNAM) 

           TO_GET(#RETCOD)

**********

END_LOOP