CEE3USR—Set or query user area fields

CEE3USR sets or queries one of two 4-byte fields known as the user area fields. The user area fields are associated with an enclave and are maintained on an enclave basis. A user area field can be used by vendor or application programs to store a pointer to a global data area or to keep a recursion counter.

Be careful not to confuse the Language Environment user area fields with the PL/I user area. The PL/I user area is a 4-byte field in the PL/I TCA and can be accessed only through assembler language. The PL/I user area continues to be supported for compatibility.

Language Environment initializes both user area fields to X'00000000' during enclave initialization.
Read syntax diagramSkip visual syntax diagram
Syntax

>>-CEE3USR--(--function_code--,--field_number--,--field_value--->

>--,--fc--)----------------------------------------------------><

function_code (input)
A fullword binary integer representing the function performed:
1—SET
User area field according to the value specified in field_value.
2—QUERY
User area field; return current value in field_value.
field_number (input)
A fullword binary integer indicating the field to set or query. field_number must be specified as either 1 or 2.
field_value (input/output)
A fullword binary integer.

If function_code is specified as 1 (meaning SET user area field), field_value contains the value to be copied to the user area field.

If function_code is specified as 2 (meaning QUERY user area field), the value in the user area field is copied to field_value.

fc (output)
A 12-byte feedback code, optional in some languages, that indicates the result of this service. If you choose to omit this parameter, refer to Invoking callable services for the appropriate syntax to indicate that the feedback code was omitted.

The following symbolic conditions can result from this service:

Code Severity Message number Message text
CEE000 0 The service completed successfully.
CEE3PS 3 3900 The function code passed to CEE3USR was not 1 or 2.
CEE3PT 3 3901 The field number passed to CEE3USR was not 1 or 2.

Usage notes

  • z/OS UNIX consideration—CEE3USR applies to the enclave.

Examples

  1. Following is an example of CEE3USR called by C/C++.
    /*Module/File Name: EDC3USR   */
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <leawi.h>
    #include <ceeedcct.h>
    
    typedef struct {
       int value1,value2,value3;
       char slot1_80¨;
    } info_struct;
    
    int main (void) {
    
       _INT4 function_code, field_number, field_value;
       _FEEDBACK fc;
       info_struct *info;
    
       info = (info_struct *)malloc(sizeof(info_struct));
      /* .
         .
         . */
       /* Set User field 1 to point to info_struct */
       function_code = 1;
       field_number = 1;
       field_value = (int)info;
    
       CEE3USR(&function_code,&field_number,&field_value,&fc);
       if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
          printf("CEE3USR failed with message number %d\n",
                 fc.tok_msgno);
          exit(2999);
       }
      /* .
         .
         . */
       /* get the value of field 2 */
       function_code = 2;
       field_number = 1;
    
       CEE3USR(&function_code,&field_number,&field_value,&fc);
       if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
          printf("CEE3USR failed with message number %d\n",
                 fc.tok_msgno);
          exit(2999);
       }
      /* .
         .
         . */
    }
  2. Following is an example of CEE3USR called by COBOL.
    CBL LIB,QUOTE
          *Module/File Name: IGZT3USR
          *************************************************
          **                                             **
          ** CBL3USR - Call CEE3USR to set or query user **
          **           area fields                       **
          **                                             **
          ** In this example, CEE3USR is called twice:   **
          ** once to set the value of a user area, and   **
          ** once to query it.                           **
          **                                             **
          *************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. CBL3USR.
    
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  FUNCODE                 PIC S9(9) BINARY.
           01  FIELDNO                 PIC S9(9) BINARY.
           01  INVALUE                 PIC S9(9) BINARY.
           01  FC.
               02  Condition-Token-Value.
               COPY  CEEIGZCT.
                   03  Case-1-Condition-ID.
                       04  Severity    PIC S9(4) BINARY.
                       04  Msg-No      PIC S9(4) BINARY.
                   03  Case-2-Condition-ID
                             REDEFINES Case-1-Condition-ID.
                       04  Class-Code  PIC S9(4) BINARY.
                       04  Cause-Code  PIC S9(4) BINARY.
                   03  Case-Sev-Ctl    PIC X.
                   03  Facility-ID     PIC XXX.
               02  I-S-Info            PIC S9(9) BINARY. 
           PROCEDURE DIVISION.
    
          *************************************************
          ** Specify 1 for SET function.
          ** Specify field number 1 to set the value field
          **     number 1.
          ** Specify 23 to make the value of field number 1
          **     equal to 23.
          *************************************************
           PARA-3USRSET.
               MOVE 1  TO FUNCODE.
               MOVE 1  TO FIELDNO.
               MOVE 23 TO INVALUE.
               CALL "CEE3USR" USING FUNCODE, FIELDNO,
                                    INVALUE, FC.
               IF NOT CEE000 of FC  THEN
                   DISPLAY "CEE3USR failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.  
          *************************************************
          ** Specify 2 for QUERY function.
          ** Specify field number 1 to query the value
          **     of field number 1.
          *************************************************
           PARA-3USRQRY.
               MOVE 2 TO FUNCODE.
               MOVE 1 TO FIELDNO.
               CALL "CEE3USR" USING FUNCODE, FIELDNO,
                                    INVALUE, FC.
               IF CEE000 of FC  THEN
                   DISPLAY "User Area field " FIELDNO
                       " is: " INVALUE
               ELSE
                   DISPLAY "CEE3USR failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.
    
               GOBACK.
  3. Following is an example of CEE3USR called by PL/I.
    *PROCESS MACRO;
     /* Module/File Name: IBM3USR                        */
     /****************************************************/
     /**                                                **/
     /** Function: CEE3USR - set/query user area fields **/
     /**                                                **/
     /** In this example, CEE3USR is called twice: once **/
     /** to set the value of a user area, and once to   **/
     /** query it.                                      **/
     /****************************************************/
     PLI3USR: PROC OPTIONS(MAIN);
    
        %INCLUDE  CEEIBMAW;
        %INCLUDE  CEEIBMCT;
    
        DCL FUNCODE   REAL FIXED BINARY(31,0);
        DCL FIELDNO   REAL FIXED BINARY(31,0);
        DCL OUTVALUE  REAL FIXED BINARY(31,0);
        DCL INVALUE   REAL FIXED BINARY(31,0);
        DCL 01 FC,                     /* Feedback token */
               03 MsgSev    REAL FIXED BINARY(15,0),
               03 MsgNo     REAL FIXED BINARY(15,0),
               03 Flags,
                  05 Case      BIT(2),
                  05 Severity  BIT(3),
                  05 Control   BIT(3),
               03 FacID     CHAR(3),      /* Facility ID */
               03 ISI   /* Instance-Specific Information */
                            REAL FIXED BINARY(31,0);
    
        FUNCODE = 1; /* Specify 1 for the set function   */
        FIELDNO = 1; /* Specify field 1 of two           */
        INVALUE = 5; /* Value to put in field 1          */
        /* Call CEE3USR to set user field 1 to 5         */
        CALL CEE3USR ( FUNCODE, FIELDNO, INVALUE, FC );
        IF  FBCHECK( FC, CEE000)  THEN  DO;
           PUT SKIP LIST( 'LE/370 User field ' || FIELDNO
              || ' has been set to ' || INVALUE );
           END;
        ELSE  DO;
           DISPLAY( 'CEE3USR failed with msg '
              || FC.MsgNo );
           STOP;
           END;
    
        /* Call CEE3USR to query the value of field 1    */
    
        FUNCODE = 2; /* Specify 2 for query function     */
        FIELDNO = 1; /* Specify field 1 of two           */
    
        CALL CEE3USR ( FUNCODE, FIELDNO, OUTVALUE, FC );
        IF  FBCHECK( FC, CEE000)  THEN  DO;
           PUT SKIP LIST( 'LE/370 User field ' || FIELDNO
              || ' is currently set to ' || OUTVALUE );
           END;
        ELSE  DO;
           DISPLAY( 'CEE3USR failed with msg '
              || FC.MsgNo );
           STOP;
           END;
    
     END PLI3USR;