CEE3PR2—Query parameter string long

CEE3PR2 queries and returns to the calling routine the parameter string and its associated length specified at invocation of the program. The returned parameter string contains only program arguments. If no program arguments are available, a blank string is returned.
Read syntax diagramSkip visual syntax diagram
Syntax

>>-CEE3PR2--(--int_parm_length--,--char_parm_string--,--fc--)--><

int_parm_length (input/output)
A fullword integer that indicates the length of the parameter string.
  • For input: If the value is less than or equal to 0, int_parm_length is a request for the length of the parameter string passed during program invocation. If the value is greater than 0, it is the actual size of the char_parm_string buffer passed by the caller.
  • For output: CEE3PR2 returns the actual length of the parameter string passed during program invocation for any case, regardless of the input value in the int_parm_length field.
char_parm_string (input/output)
  • For input: char_parm_string contains the address of a piece of storage that is obtained by the caller.
    Note: This storage is used as a varying string. It must be 2 bytes longer than the length of the parameter string passed during program invocation.
  • For output: The storage pointed to by this address contains a varying string that contains the parameter string passed during program invocation. The parameter string is truncated when the actual length of the parameter string passed during invocation exceeds int_parm_length minus 2.
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.
CEE3K3 1 3715 The parameter string returned from CEE3PR2 was truncated due to insufficient storage space for the string provided by the caller.

Usage notes

  • C/C++ consideration—C/C++ users can use the __osplist return a program argument longer than 80 characters.
  • z/OS® UNIX consideration—CEE3PR2 is allowed only in the initial thread.
  • CICS® consideration—CEE3PR2 always returns a blank string.

For more information

Examples

  1. Following an example of CEE3PR2 called by C/C++.
    /*Module/File Name: EDC3PR2    */
    /*********************************************************************/
    /*                                                                   */
    /* THIS EXAMPLE CALLS CEE3PR2 TO RETRIEVE THE PARAMETER STRING THAT  */
    /* WAS SPECIFIED AT THE INVOCATION OF THE PROGRAM AND ITS ASSOCIATED */
    /* LENGTH. BOTH THESE VALUES ARE THEN PRINTED.                       */
    /*                                                                   */
    /*********************************************************************/
    
    #include <stdio.h>
    #include <leawi.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ceeedcct.h>
    
    struct mystring{
        unsigned short int length;
        char           string[298];
    };
    typedef struct mystring mystring;
    
    int main() {
    
        int len;
    
        mystring parm;
        _FEEDBACK fc;
    
        /*Setting up the user defined space to store the retrieved string*/
        memset(&parm,0x00,sizeof(parm));
        len = sizeof(parm);
    
        /*Calling CEE3PR2 to retrieve the parameter string*/
        CEE3PR2(&len,&parm,&fc);
    
        if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
           printf("CEE3PR2 failed with message number %d\n", fc.tok_msgno);
        }
    
        printf("Length field of the string : %d \n",len);
        printf("Parameter String is: %s\n",parm.string);
    
        return 0;
    }
  2. Following is an example of CEE3PR2 called by COBOL.
    CBL LIB,QUOTE
          *************************************************
          *Module/File Name: IGZTPR2
          ************************************************
          **                                            **
          ** CBL3PR2 - Call CEE3PR2 to query the        **
          ** parameter string                           **
          **                                            **
          ** In this example, a call is made to         **
          ** CEE3PR2 to return the parameter string     **
          ** that was specified at invocation of the    **
          ** program. The string is then displayed.     **
          **                                            **
          ************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. CBL3PR2.
    
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01 PARMLEN                 PIC S9(9) BINARY.
           01 PARMSTR.
              02 STR1-LENGTH PIC S9(4) BINARY.
              02 STR1-STRING.
                 03 STR1-CHAR PIC X
                              OCCURS 0 TO 256 TIMES
                              DEPENDING ON STR1-LENGTH.
           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-SEV-CTL    PIC X.
                  03 FACILITY-ID     PIC XXX.
               02 I-S-INFO           PIC S9(9) BINARY.
    
           PROCEDURE DIVISION.
    
           PARA-CBL3PR2.
               MOVE 258 TO PARMLEN
               CALL "CEE3PR2" USING PARMLEN, PARMSTR, FC.
               IF CEE000 THEN
                   DISPLAY "Program arguments specified: ’"
                       STR1-STRING "’"
               ELSE
                   DISPLAY "CEE3PR2 FAILED WITH MSG "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.
               GOBACK. 
  3. Following is an example of CEE3PR2 called by PL/I.
    *PROCESS MACRO;
      /***************************************************/
      /*Module/File Name: IBM3PR2                                        */
      /*******************************************************************/
      /**                                                               **/
      /** Function: CEE3PR2 - Query Parameter String                    **/
      /**                                                               **/
      /** This example calls CEE3PR2 to retrieve the arguments passed   **/
      /** during the invocation of the program.                         **/
      /**                                                               **/
      /*******************************************************************/
    
      PLI3PR2: PROCEDURE OPTIONS (MAIN) REORDER;
    
        %INCLUDE CEEIBMAW;
        %INCLUDE CEEIBMCT;
    
        DCL SYSPRINT File Output Stream;
    
        DCL Parm_Len    FIXED BINARY(31,0),
            Parm_Str    CHAR(255) VARYING;
    
      /********************************************************/
      /* Declare a Language Environment Feedback token.       */
      /* 12 Total bytes of storage.                           */
      /********************************************************/
        Declare 01 LE_Feedback_Code,
                  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),
                  03 ISI          REAL FIXED BINARY(31,0);  
    
      /********************************************************/
      /* Local declares needed for Messaging Callable Services*/
      /********************************************************/
        Declare  Msg_String       CHAR(255) VARYING;
        Declare  Output           PICTURE ’99999’;
    
        Msg_dest = 2;
    
        Parm_Len = 255; /********************************************************/
      /* Call CEE3PR2 to get the parameter string             */
      /********************************************************/
    
        CALL CEE3PR2(Parm_Len,Parm_Str,LE_Feedback_Code);
    
        If ^ FBCHECK(LE_Feedback_Code, CEE000) Then Do;
          Msg_String = ’Truncation occured’;
          Call CEEMOUT(Msg_String,Msg_Dest,LE_Feedback_Code);
        End;
        Else Do;
          /******************************************************/
          /* Output the result.                                 */
          /******************************************************/
          MsgString = ’The returned parameter string is: ’;