• Aucun résultat trouvé

copies the symbol~c storage definition for the SAA. This storage definition should pregede the definition of user storage acquired

Dans le document Program Product (Page 60-65)

through the DFHSC TYPE=GETMAIN,CIASS=USER macro

instruction~

. The following is an example of ,the coding

r~quired

to define the record(s)

in the SAA: "

01 DFHSAADS COpy DFHS~ADS.

02 NAME PICTURE X(20).

02 SAAREC PICTURE X(lO).

The user must code the statement MOVE TCASCSA TO SAACBAR.

prior to any reference to theSAA following a DFHSC macro instruction in the Procedure Division to establish addressability for the SAA.

JOURNAL CONTROL AREA (JCA) The statement

01 DFHJCADS COpy DFHJCADS.

copies the symbolic storage definition for the CICS/VS control section of the journal control area (JCA) and must be present in all programs requesting journal services. (See "Journal services" in Chapter 6.)

A JCA is acquired dynamica~ly by means of a DFHJC TYPE=GETJCA macro instruction. Addressability to the JCA is provided automatically through the macro expansion, which loads the address of the area into JCABAR.

ADDITIONAL GUIDELINES

If the ANS COBOL programmer wishes to access a series of chained storage are~s (each area contains a pointer to the next area in the chain), he must establish addressability to each new storage area in the chain by inserting a paragraph name immediately following any MOVE statement that establishes addressability. For example:

LINKAGE SECTION.

01 DFHBLLDS COPY DFHBLLDS.

02 USERPTR PICTURE S9(8) USAGE IS COMPUTATIONAL.

01 DFHTCACS COPY DFHTCAD5.

02 TWAFIELD PICTURE X(4).

01 USERAREA.

02 FIELD PICTURE X(4).

02 NEXTAREA PICTURE 59(8) USAGE IS COMPUTATIONAL.

PROCEDURE DIVISION.

MOVE NEXTAREA TO U5ERPTR.

ANYNAME.

Chapter 4. Copying storage Definitions - AN5 COBOL 45

MOVE FIELD TO TWAFIELD.

In this example, storage areas mapped or defined by USERAREA are chained. The first MOVE instruction establishes addressability to the next area in the chain. The second MOVE instruction moves data from the newly addressed area, but only because the paragraph name precedes the second MOVE instruction; in the absence of the paragraph name, data is moved from the previously addressed area rather than from the new area. Note that a paragraph name is not needed if addressability to an area is obtained through a field in some other area (for example, the TCA) •

If the object of an OCCURS DEPENDING ON clause is defined in the linkage section, s~ecial consideration is required to ensure that the correct value is used at all times. In the following example,

FIELD-COUNTER is defined in the linkage section. The MOVE FIELD-COUNTER TO FIELD-COUNTER statement is needed to ensure that unpredictable

results do not occur when referencing DATA.

LINKAGE SECTION.

01 DFHFWADS COpy CFSFWACS.

02 FIELD-COUNTER PIC 9(4) USAGE IS COMPUTATIONAL.

02 FIELDS PIC X(5) OCCURS 1 TO 5 TIMES DEPENDING ON FIELD-COUNTER.

02 DATA PIC X(20).

PROCEDURE DIVISION.

DFHFC TYPE=GET, etc.

MOVE TCAFCAA TO FWACBAR.

MOVE FIELD-COUNTER TO FIELD-COVNTER.

MOVE DATA 'IO TM-FIELD.

The MOVE statement referring to FIELD-COUNTER causes ANS COBOL to reestablish the value i t uses to compute the current number of

occurrences of FIELDS and ensures that i t can correctly determine the displacement of DATA.

If an area greater than 4095 bytes is defined in the linkage section, special considerations arise: An additional 02-level statement under DFHBLLDS and an ADD statement following the MOVE statement to establish addressability to the area are required for each additional 4096 bytes.

For example, if a file work area (FWA) exceeds 4095 bytes, the following code can be used.

LINKAGE SECTION.

01 DFHBLLDS COpy DFHBLLDS.

02 FWACBAR PICTURE S9(8) USAGE IS COMPUTATIONAL.

02 FWABR1 PICTURE S9(8) USAGE IS COMPUTATIONAL.

01 DFHFWADS COPY DFHFwADS.

02 FIELD1 PICTURE X(4000) • 02 FIELD2 PICTURE X(1000).

02 FIELD3 PICTURE X(400).

PROCEDURE DIVISION.

DFHFC TYPE =GET ,

*

MOVE TCAFCAA TO FW]\CBAR.

ADD 4096 TO FWACEAR GIVING FWABR1.

If an application program is to be compiled for execution under CICS/OS/VS using the full ANS COBOL V4 Compiler (5734-CB2) , the OS/VS COBOL Compiler (5740-CB1) , or the DOS/VS COBOL Compiler (5746-CB1) with the optimization (OPT) feature, a special compiler control statement must be inserted at appropriate places within the program to ensure addressability to a particular area defined in the Linkage section.

This control statement has the form:

SERVICE RELOAD fieldname.

where fieldname is the symbolic name of a specific storage area, and is also defined in an 01-level statement in the linkage section. The first four statements of the Procedure Division must be

SERVICE RELOAD DFHBLLDS.

SERVICE RELOAD DFHCSACS.

MOVE CSAOPFLA TO CSAOPEAR.

SERVICE RELOAD CSAOPFL.

Statements such as

or

MOVE TCAFCAAA TO TCTTEAR.

SERVICE RELOAD DFHTCTTE.

SUBTRACT 8 FROM TCASCSA GIVING TSIOABAR.

SERVICE RELOAD DFHTSICA.

can be used to establish addressability for a particular storage area.

(Note that the SERVICE RELOAC statement must be used following each statement which modifies addressability to an area defined in the

linkage section, that is, whenever an address is moved to a f1eld named in an 02-level statement under 01 DFHBLLDS or the address in the

02-level statement is changed in any way.)

To establish addressability to the TeA, the following statements must be coded:

MOVE CSACDTA TO TCACBAR.

SERVICE RELOAD DFHTCA.

Note that the RELOAD statement specifies DFHTCA, not DFHTCADS.

Certain ANS COBOL features cannot be used in an application program to be run under CICS/vS. Generally, these features are replaced by CICS/vS services. They are identified under "Restrictions" in the first chapter of this manual.

Chapter 4. Copying storage Definitions - ANS COBOL 47

EXAMPLE OF CICS/VS ANS COBOL APPLICATION PROGRAM

02 SAVE-LENGTH PICTURE S9(8) USAGE IS COMPUTATIONAL.

02 SAVE-MESSAGE PICTURE X(32).

MOVE TIOAMSG TO SAVE-MESSAGE.

DFHSC TYPE=GETMAIN,

MOVE SAVE-MESSAGE TO TIOAMSG.

MOVE SAVE-LENGTH TO TIOATDL.

Copies symbolic storage definition for BLL;

contains addresses of CICS/VS storage areas.

Adds addresses for TCTTE and TIOA (required for statements 14 and 15).

Copies symbolic storage definition for CSA.

Copies symbolic storage definitions for TeA

* *

*

12-13

14 15 16 17 18-21

22 23

24

25 26 27

28-31

32

33

33 35 36 37

38

Dans le document Program Product (Page 60-65)