• Aucun résultat trouvé

RECORD PIC X(350)

Dans le document Application Programmer's Reference Manual (Page 106-113)

DCL 01 RECDS BASED (RECBAR), 02 RECORD CHAR(350)1

02 RECORD PIC X(350)

NOTE ESTABLISH FWA ADDRESSABILITY.

For PL/I:

%INCLUDE DFHTCADS;

02 KEYF CHAR(25);

%INCLUDE DFHFWADS;

02 RECORD CHAR (350) ;

KEYF=PARTNAME;

READREC:

DFHFC TYPE=GET,

DATASET =MASTER A, RDIDADR=KEYF, TYPOPER=UPDATE, INDEX=INDEXAB FWACBAR=TCAFC1A;

/*COPY SYMBOLIC STRG DEFN FOR TCA*I /*DEFINE KEY FIELD IN TWA*/

/*COPY SYMBOLIC STRG DEFN FOR FWA*/

I*DEFINE RECORD LAYOUT IN FWA*I

I*ASSIGN INDEX IDENT TO KEY FIELD*I GET RECORD FROM MASTER DATA SET * BY FIRST ACCESSING A CROSS-INDEX * DATA SET NAMED INDEXAB *

*

I*ESTABLISH lDDRESSABILITY FOR FWA*I

Chapter 3.2. File Control (DFHFC Macro Instruction) 95

Direct Update or Addition (TYPE=PUT).

The format of the DFHFC macro instruction to update or add single records to a data set is as follows:

DFHFC TYPE=PUT

[,RDIDADR=symbolic address]

[ ,SEGSET=YES]

[,TYPOPER={NEWRECIUPDATEIDELETE}] (See note)

[,ARGTYP={KEI.IRBA}] < - - - V S A M [ ,NORESP=symbolic address]

[,ERROR=symbolic address]

[,DUPREC=symbolic address]

(,INVREQ=symbolic address]

[,IOERROR=symbolic address]

[,NOSPACE=symbolic address]

[,NOTOPEN=symbolic address]

[,ILLOGIC=symbolic address] <---VSA!

Note: DELETE can be used only with a VSA! KSDS or RRDS

This macro instruction is used to:

update an existing record that has been retrieved through the DFHFC TYPE=GET,TYPOPER=UPDATE macro instruction

add a new record to an existing data set

update an existing record in a nonkeyed DAM data set without first reading the record for update

A DFHFC TYPE=PUT macro instruction must never be issued without first issuing a DFHFC TYPE=GET,TYPOPER=UPDATE or DFHFC TYPE=GETAREA macro instruction, because the results of such action are unpredictable.

When a VSAM key-sequenced or relative~record data set is being

processed, a DFHFC TYPE=PUT,TYPOPER=DELETE macro instruction can be used to delete a record previously retrieved by a DFHFC

TYPE=GET,TYPOPER=UPDATE macro instruction~

A file work area (FiA) is used to contain the record or segments to be written or updated. The first 16 bytes of the FiA form the CICS/VS system section, which is followed by the actual record or segments to be written to a data set.

CICS/VS performs the following services in response to a DFHFC TYPE=PUT macro instruction:

writes updated or new records in user-defined data sets

Acquires or locates the main storage and control blocks required to write the record

Releases all data set storage associated with the request to write

Packs a segmented record, depending on the data set organization and the operands included in this macro instruction

96 CICS/VS APRM (ML)

Before file services can be requested by means of the DFHFC TYPE=PUT macro instruction, the application program must include instructions that do the following:

RECORD LAYOUT FOLLOWS CONTROL FIELD AND HAS SAME BASE REGISTER

READ RECORD FOR UPDATE

ESTABLISH ADDRESSABILITY FOR FWA

PLACE FWA ADDRESS IN TCA

For COBOL:

NOTE ESTABLISH TCA ADDRESSABILITY.

READ RECORD FOR UPDATE *

NOTE ES'rABLISH FWA ADDRESSABILITY.

NOTE MOVE ADDRESS OF FWA TO TCA.

/*ESTABLISH ADDRESSABILITY FOR FWA*/

/*PLACE ADDR OF WORK AREA IN TCA*/

WRITE THE UPDATED RECORD *

Direct Deletion. VSAM Only (TYPE

=

DELETE)

The format of the DpHpC macro instruction to delete a record or group of records directly from a VSAM KSDS or RRDS is as follows:

DpHpC TYPE=DEL ETE

[,DATASET=symbolic name]

[,RDIDADR=symbolic address]

[ , ARGTYP=KEY ]

[,SRCHTYP={pKEQIGKEQ} ] [,NORESP=symbolic address]

[,ERROR=symbolic address]

[ ,DSIDER=symbolic address]

[,NOTPND=symbolic address]

[ ,INVREQ=symbolic address]

[,IOERROR=symbolic address]

[,NOTOPEN=symbolic address]

[,ILLOGIC=symbolic address]

DpHpC TYPE=DELETE can be used to perform the following functions on VSAM key-sequenced and relative-record data sets only.:

Delete a single record.

Delete a group of records that share the same partial key; that is where the first part of the keys is the same. This is called generic delete.

To delete a single record, the key must be placed in an area pointed to by the RDIDADR operand.

To delete a group of records with the same partial key, that is where the first part of the keys is the same, the partial key must be placed in an area pointed to by the RDIDADR operand. The binary length of the key must be placed in the first byte of the area pointed to by the RDIDADR operand. SRCHTYP=GKEQ must be specified.

Group deletes must not be attempted on data sets for which automatic logging has been specified, (DpHpCT TYPE=DATASET,LOG=YES). An attempt to do so will result in an invalid request condition.

Neither an pIOA nor an pWA is required for a delete operation.

Note that a DELRTE operation is an update operation, and therefore the control interval concerned is held under exclusive control.

Exclusive control is released either by successful completion of the DELETE operation, or failing this, by issuing a DpHpC TYPE=RELEASE macro.

Chapter 3.2. Pile Control (DpHpC Macro Instruction) 99

Obtain a File Work Area {TYPE

=

GET AREA)

The format of the DFHFC macro instruction to obtain a file work area (FiA) for the application program is as follows:

~---~---r---~

DFHFC TYPE=GETAREA

[,DATASET=symbolic name]

[ , INITIMG= {value I YES} ]

[,TYPOPER=MASSINSERT] <---VSAM [ , ARGTYP= {KEY I RBA} ] < VSAM [,NORESP=symbolic address]

[ ,ERROR=symbolic address]

[,DSIDER=symbolic address]

[,INVREQ=symbolic address]

[ ,NOTOPEN=symbolic address]

The new main storage area is a file work area (FiA) and can be obtained only by this macro. (A storage control DFHSC TYPE=GETMAIN request cannot be used for file operations~)

CICSjVS performs the following services in response to a DFHFC TYPE=GETAREA macro instruction:

1. Acquires main storage ~n FiA) for the creation of a new record 2. Includes and initializes the FWA control fields (a 16-byte prefix

to the FiA) required by file control

If several new records whose keys are in ascending sequence are to be added to a VSAM data set, the TYPOPER=MASSINSERT operand should be used, in which case, the FWA is retained and made available to the application program after each DFHFC TYPE=PUT macro instruction that adds a record to the data set. A mass insert operation is terminated by a DFHFC TYPE=RELEASE macro instruction. A lockout condition will occur if more than one transaction is simultaneously attempting to perform a mass insert to the same control interval of a protected data set. A lockout will occur also if a transaction uses keys that are not in ascending sequence.

In a DFHFC TYPE=GETAREA macro, the ARGTYP operand is only applicable when TYPOPER=MASSINSERT has been specified.

When the DFHFC TYPE=GETAREA macro instruction is used, the

application program must include instructions that do the following:

Symbolically define the FWA by (1) copying the appropriate CICS/VS system section storage definition (DFHFWADS), and (2) providing a storage definition for the user's section of the FiA.

o Establish addressaoility for the new FWA by specifying a symbolic base address for the FWA~ (The address of the area involved, returned by CICS/VS at TCAFCAA, must be placed in FWACBAR.)

The following examples show how to obtain an FWA, build a new record in the FiA, and write that record to a data set.

100 CICS/VS APRM (ML)

For Assembler language:

RECORD LAYOUT FOLLOWS CONTROL FIELD AND HAS SAME BASE REGISTER OBTAIN A FWA TO CREATE A NEW RECORD FOR A DATA SET

ESTABLISH ADDRESS ABILITY FOR FWA

PLACE ADDR OF NEW RECORD IN TCA

NOTE ESTABLISH TCA ADDRESSABILITY.

OBTAIN A FWA TO CREATE A NEW RECORD FOR A DATA SET

NOTE ESTABLISH PiA ADDRESSABILITY.

NOTE ADDRESS OF NEW RECORD TO TCA.

WRITE THE NEW RECORD

*

* *

Chapter 3.2. File Control (DFHFC Macro Instruction) 101

Dans le document Application Programmer's Reference Manual (Page 106-113)