Menu principal                 [Fechar]


CICS Manual do Usuário - FREEMAIN


Volta a página anterior

Volta ao Menu Principal


Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

FREEMAIN

Releases main storage acquired by a GETMAIN command.

Sintaxe:

Descrição:

FREEMAIN releases main storage that was previously acquired by a GETMAIN command that the application issued.
If the task that acquired (GETMAIN) does not release it, CICS releases the storage when the task terminates, unless the SHARED option was specified on the GETMAIN command.
In this case, the storage remains allocated until some other task issues a FREEMAIN to release it.

Opções:

    DATA(data-area)
  • Specifies the location of the main storage that is to be released.
  • This storage must have been acquired by a previous GETMAIN command.
  • The length of storage that is released is the length that is obtained by the GETMAIN, which is not necessarily the length of the specified data area.
  • For COBOL application programs, you must specify a data area that is located at the start of the storage that was acquired by the GETMAIN command; you do not specify the pointer reference that was set to the address of the acquired storage.
  • See API command argument values for further information.
  • In PL/I, the value in this option must be a data reference.
  • To specify a pointer value, you must use the DATAPOINTER option.
    DATAPOINTER(ptr-value)
  • Specifies the address of the main storage that is to be released.

  • This option is an alternative to the DATA option, and specifies, as a pointer value, the address (of the acquired main storage) that was returned in the pointer reference that is associated with the SET option of a previous GETMAIN command.

Examplos:

  1. For COBOL:
    
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  WS-WORKING-STORAGE.
               02  AREA-POINTER    USAGE IS POINTER.
    
           LINKAGE SECTION.
           01  LK-AREA             PIC X(100).
    
           PROCEDURE DIVISION.
    
               EXEC CICS 
                    GETMAIN
                    SET(AREA-POINTER)
                    LENGTH(100)
               END-EXEC.
    
               SET ADDRESS OF LK-AREA TO AREA-POINTER.
          
               EXEC CICS 
                    FREEMAIN
                    DATA(LK-AREA)
               END-EXEC.
    
               EXEC CICS 
                    RETURN
               END-EXEC.
    

  2. For C or C++:
    main()
    {
     char   *ptr;
     
     EXEC CICS ADDRESS EIB(dfheiptr);
     
     EXEC CICS GETMAIN SET(ptr) LENGTH(100);
     *(ptr+2) = 'a';
       .
     EXEC CICS FREEMAIN DATA(ptr);
     
     EXEC CICS RETURN;
    }
    
  3. For PL/I:
    BEGIN;
      DCL GOPTR POINTER;
      DCL GOTAREA CHAR(100) BASED(GOPTR);
      ...
    EXEC CICS GETMAIN SET(GOPTR)
                      LENGTH(100);
    GOTAREA = 'gostring';
     ...
    EXEC CICS FREEMAIN(GOPTR);
    END;
    

Condições:

    INVREQ
  • RESP2 values:
    • The storage taht is specified in the DATA option is not addressed by a pointer that was returned by a GETMAIN command (RESP2=1).
  • Ação pré-definida: Terminates the task abnormally.

Informações relacionadas


© Copyright IBM Corp.