IFSTRT (IFAM2/IFAM4) (HLI function)

From m204wiki
Revision as of 23:17, 15 September 2016 by ELowell (talk | contribs) (→‎Syntax)
Jump to navigation Jump to search

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

Summary

Description
The form of the IFSTRT call (START THREAD) that starts an IFAM2 or IFAM4 thread connection to Model 204 performs the following actions:
  • Allocates a thread, making it currently active in the job
  • Returns the thread identifier for use by IFDTHRD or IFSTHRD
  • Specifies the calling protocol to be used for the host language
  • Performs a user login
  • Establishes either a single cursor or a multiple cursor type thread
  • For a single cursor thread, determines whether retrieval or updating privileges are allowed
Thread type
multiple cursor IFSTRT, single cursor IFSTRT
IFCALL function number
1

Syntax

IFSTRT(RETCODE,LANG_IND,LOGIN,THRD_TYP,THRD_ID)

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.
LANG_IND [I,i,r] The language indicator is a required input parameter that establishes the calling sequence convention to be used corresponding to the host language. The indicator specifies the format of parameters that are passed in subsequent calls.

Specify one of the following integer values:

1 = PL/1 F-level, and BAL languages
2 = COBOL, FORTRAN, and BAL languages
3 = PL/1 with +Optimizer/Checkout compilers, VS/FORTRAN, and BAL languages

Note: Any convention may be specified for use with the BAL language, and the BAL programmer must adhere to the convention that is specified when coding parameters.

LOGIN

[I,c,r] The login information is a required parameter that supplies a valid Model 204 user ID and password that permit entry to the system. Specify the login as a character string using the following format:

userid [account]; password[:new password]; (This method of changing a password is supported in version 7.6 and earlier)

where:

userid is a character string that identifies the user who is logging into Model 204.

account is an optional character string that supplies an account under which the user is logging into Model 204.

password is a character string that allows the specified user to access Model 204.

new password is an optional character string that changes the login password for the specified user, for future logins. (Supported in Model 204 version 7.6 and earlier; see Changing a login password for details.)

Certain restrictions apply to login entries when using a security subsystem, such as Security Server (formerly RACF), to perform login validation. For details, see the topic for your security interface.

For a description of the login command, see LOGIN or LOGON command.

THRD_TYP [I,i,r] The thread type indicator is a required parameter that specifies the type of IFSTRT thread to be allocated. Specify one of the following integer values:

0 = Single cursor thread with read-only privileges
1 = Single cursor thread with update privileges
2 = Multiple cursor thread

Note: The 0(read) and 1 (update) settings are valid for a single cursor IFSTRT thread which can be used in an multithreaded application.

A thread type indicator of 0 allows a single cursor IFSTRT thread to be used only for retrieval, regardless of the file or group password that is used in a particular call. File updating by passing data from a retrieval-only Host Language Interface thread to an update thread can lead to logical inconsistencies.

To prevent inconsistencies, start the thread as an update thread (1) and use a retrieval-only password to open a file. This provides share-mode (SHR) enqueuing and prevents updating from the thread. Files that are opened this way are also prevented from being marked physically inconsistent with a user restart or system crash.

THRD_ID [O,i,r] The thread identifier is a required output parameter. Specify an integer variable. Model 204 returns a value that may be referenced using the IFDTHRD and IFSTHRD calls for thread switching in multithreaded applications.

Usage notes

Use the IFSTRT call to establish a connection to the Host Language Interface Model 204 service program. For an IFAM2 connection, IFSTRT assumes a default channel name of IFAMPROD.

Note that an IFAM2 or IFAM4 job can be multithreaded. You can call IFSTRT more than once in a job to establish multiple threads, but only one IFSTRT thread is currently active and, for single cursor IFSTRT threads, each thread has its own current file or group, current record set, and current record. You can start single cursor and multiple cursor IFSTRT threads in the same job.

The IFSTRT protocol allows applications written in a host language to process against the Model 204 database using a particular class of HLI calls. See HLI: Function summary for an overview of IFSTRT calls.

On a single cursor IFSTRT thread, IFSTRT together with IFFNSH initiates CPSORT checkpointing.

Changing a login password

Changing a login password by specifying password:new password is supported in Model 204 version 7.5 or earlier, and in Model 204 version 7.6 if the PWDCOLON parameter is not set (see PWDCOLON for details).

As of Model 204 version 7.7, colons are always allowed in login passwords, so a colon is not recognized as a delimiter between passwords. Use the LOGINCP command to change your password.

Completion return code (RETCODE)

If the IFSTRT call is unsuccessful, Model 204 returns an error code for any of the following error conditions:

Code Error condition
4 No IFSTRT thread was started; do not attempt to issue any other HLI calls. The HLI program code should check the return code from IFSTRT and continue processing only if the call was successful; for a return code of 4, either reissue IFSTRT until it is successful or stop job processing and give an error message.
90 A Model 204 is not yet available for user processing. Recovery might still be in progress. (Action: Call IFSTRT again.)
100 LOGIN failed.
400 Invalid language code (LANG_IND).

Coding example (COBOL)

This COBOL coding example specifies the following IFSTRT parameters:

  • COBOL calling convention (language indicator is 2)
  • Login account name USERABC
  • Login password ECP
  • Single cursor thread with read-only access (thread type is 0)

WORKING-STORAGE SECTION. 01 LOGIN-INFO. 05 LOGIN PIC X(12) VALUE 'USERABC;ECP;'. 01 CALL-PARMS COMP SYNC. 05 RETCODE PIC 9(5). 05 LANG-IND PIC 9(5) VALUE 2. 05 MODE PIC 9(5) VALUE 0. 05 THRD-NO PIC 9(5). . . . PROCEDURE DIVISION. INITIALIZATION. OPEN OUTPUT... CALL "IFSTRT" USING RETCODE, LANG-IND, LOGIN, MODE, THRD-NO. IF RETCODE IS NOT EQUAL TO ZERO GO TO ERROR-ROUTINE. . . .