• Aucun résultat trouvé

KEYF CHAR(8);

Dans le document Application Programmer's Reference Manual (Page 120-124)

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

02 KEYF CHAR(8);

%INCLUDE DFHFWADS; • 02 RECORD CHAR (350) ; KEYF= 'JONES' ;

START:

DFHFC TYPE=SETL, DATASET=MASTER, RDIDADR=KEYF, NOTOPEN=ERROR FWACBAR=TCAFCAA;

ERROR:

108 CICS/VS APRM (ML)

NOTE DEFINE BASE REGISTER FOR FWA.

NOTE COpy SYMBOLIC STRG DEFN FOR TCA.

NOTE DEFINE KEY FIELD IN TWA.

NOTE COPY SYMBOLIC STRG DEFN FOR FiA.

NOTE DEFINE RECORD LAYOUT IN FWA.

NOTE ESTABLISH TCA ADDRESSABILITY.

INITIATE BROWSE

GO TO ERROR LABEL IF ERROR

/*COPY SYMBOLIC STRG DEFN FOR TCA*/

/*COPY SYMBOLIC 5TRGDEFN FOR FWA*/

/*DEFINE RECORD LAYOUT IN FWA*/

INITIATE BROWSE

GO TO ERROR LABEL IF ERROR

* *

*

* *

*

Forward Browse (TYPE=GETNEXT)

The format of the DFHFC macro instruction to retrieve the next record in ascending sequence during a browse operation is shown below.

~---r---r---'

DFHFC TYPE=GETNEXT

[ , SEGSET= {symbolic name I YES I ALL} ]

[,DUPKEY=symbolic address] <---VSAM & assembler [,NORESP=symbolic address]

[,ERROR=symbolic address]

[,SEGIDER=symbolic address]

[ ,NOTFND=symbolic address]

[,INVREQ=symbolic address]

[ ,IOERROR=symbolic address]

[,NOTOPEN=symnolic address]

[ ,ENDFILE=symbolic address]

[,ILLOGIC=symbolic address]

This instruction can also be used to perform skip-sequential processing upon a VSAM data set. After a DPHPC TYPE=SETL macro

instruction has been issued to initiate a browse operation, the next (or first) record in ascending sequence can be obtained by issuing the DPHPC TYPE=GETNEXT macro instruction. When the first GETNEXT request is

issued following a SETL request for an ISAM data set, CICS/VS acquires the first record with a key equal to or greater than the key presented by a previous SETL; for a DAM data set, CICS/VS acquires the first record specified by the user. Each subsequent GETNEXT request, whether for an ISAM or a DAM data set, causes CICS/VS to acquire the next record in ascending sequence. When ISAM is used, records that are flagged for deletion are presented to the application program, which must be able to recognize them.

When VSAM is used, a browse operation can be specified to begin at a particular relative byte location or with a record identified by a key.

In the former case, the first GETNEXT request retrieves that record.

Each succeeding GETNEXT retrieves the next record in ascending sequence.

If a key is specified for a VSAM data set, i t may be either specific or generic, and the application programmer can specify that the search begin (1) at a record having a key equal to the specific or generic key, or (2) at a record having a key equal to or greater than the specific or generic key. The effects of GETNEXT macro instructions are as described below.

Before issuing the DPHPC TYPE=GETNEXT macro instruction, the

application programmer must place the address of the PWA associated with the particular operation in TCAPCAA. If the application program has initiated multiple browse operations, i t must keep track of the PWA associated with each operation and refer to a specific PWA when

requiring services related to that browse. Similar requirements apply to the address of a specific VSWA in locate-mode processing of VSAM nonsegmented records.

CICS/VS performs the following services in response to a DPHPC TYPE=GETNEXT macro instruction referring to an ISAM, VSA!, or DAM data set:

1. Retrieves the next sequential record and places i t in the PWA specified by the user at TCAPCAA

Chapter 3.2. File Control (DPHFC Macro Instruction) 109

2. P1aces the identification (key, block identification, or the like) of the record just retrieved into the record identification field specified in the DFHFC TYPE=SETL request initiating the browse If the user issues a DFHFC TYPE=GET,TYPOPER=UPDATE request on the record returned in response to a DFHFC TYPE=GETNEXT request, the address of the record identification field can be specified in the DFHFC

TYPE=GET request.

The first DFHFC TYPE=GETNEXT macro instruction referring to a VSAM data set retrieves the record located in response to the DFHFC TYPE=SETL instruction initiating the browse. On a subsequent GETNEXT, CICS/VS checks the contents of the record 'identification field set aside for records of the data set. If this field contains the identification of the record previously received, CICS/VS retrieves the next logical record in sequence and places the identification of that record in the record identification field. Sequential retrieval such as described above for ISAM and DAM data 'sets then occurs.

It is possible, however, when using VSAM data sets, for the application programmer to utilize a skip-sequential processing

capability. All that is needed is to place the identification of the next record desired into the record identification field prior to issuing a GETNEXT request. If, upon checking this field, CICS/VS determines that its contents have been changed by the application

program, CICS/VS accesses the record having the identification currently stored in the record identification field. This record need not be the next sequential record in the data set. This skip-sequential processing capability is available only for VSAM data sets.

When VSAM skip-sequential processing is used, the record

identification placed in the record identification field before issuing the GETNEXT request must be of the same form as that specified in the SETL or last RESETL request for this browse operation. That is, if the SETL or last RESETL specified a generic key, then the new record

identification must be a generic key. It need not be the same length as that specified in the SETL or last RESETL. If the SETL or last RESETL specified an RBA, the new identification must be an RBA. Note that if the SETL or last RESETL specified an equal search (FKEQ'or GKEQ), a GETNEXT request using skip-sequential processing may result in a NOTFND

(record not found) condition.

In addition, CICS/VS can perform the following services, depending on the operands included in the DFHFC TYPE=GETNEXT macro instruction.

1. Present the user with segments as specified in the GETNEXT request.

2. Present the user with segments as specified in the SETL request if no segment set is specified in the GETNEXT request.

3. If the FWA is not large enough to process a segment set specified in the GETNEXT request, dispose of the old FWA and acquire a new one large enough to process the new request.

If the NOTFND condition occurs during a browse operation, the

application program must issue either a RESETL macro to reset the browse or an ESETL macro to terminate the browse. Both these macros are

discussed later in this chapter.

The following examples show how to initiate a browse operation and retrieve selected segments from successive records of the data set.

110 CICS/VS APaM (ML)

For Assembl er lalliluaqe:

KEYF FWACBAR RECORDA

INITIAL

COpy DFHTCADS DS 8X

EQU 7

COpy DFHFWADS DS OCL350

~

J

C:SECT

MVC KEYF (8) ,=8X' 00' DFHFC TYPE=SETL,

DATASET=MASTER, SEGSET=A,

RDIDADR=KEYF

L FWACBAR,TCAFCAA

~

ST FWACB AR, TCAFCAA DFHFC TYPE=GETNEXT L FWACBAR,TCAFCAA

ST FWACBAR,TCAFCAA DFHFC TYPE=GETNEXT,

SEGSET=B

L FWACBAR,TCAFCAA

COpy TCA SYMBOLIC STRG DEFN DEFINE KEY FIELD IN TWA ASSIGN FWA BASE REGISTER

COpy CICS/VS CONTROL SECTION OF FWA DEFINE RECORD LAYOUT IN FWA.

START AT BEGINNING OF DATA SET INITIATE BROWSE

SET DEFAULT SEGMENT SET ESTABLISH FiA BASE REGISTER

RESTORE FWA ADDRESS

GET NEXT SEQUENTIAL RECORD

·ASSURE ADDRESS ABILITY IF SEGMENTED

RESTORE FWA ADDRESS GET NEXT RECORD WITH SEGMENT B

ASSURE ADDRESSABILITY IF SEGMENTED

* *

*

*

Chapter 3.2. File Control (DFHFC Macro Instruction) 111

For COBOL:

02 FiACBAR PIC S9(8) COMP.

01 DFHTCADS COpy DFHTCADS.

Dans le document Application Programmer's Reference Manual (Page 120-124)