Sie sind auf Seite 1von 12

CA-Easytrieve Frequently Asked Questions

I need to search a string for a specific character, and if the character is found, replace the found character with another character.
The following example program provides this logic:
*********************************************************************** * THIS IS AN EXAMPLE OF INSPECTING EVERY BYTE FOR A CHARACTER * * AND REPLACING THAT CHARACTER WITH A NEW CHARACTER IN A NEW FIELD * *********************************************************************** DEFINE FROM-FIELD W 15 A VALUE 'GOHN ' DEFINE FROM-FIELD-BYTE FROM-FIELD 1 A OCCURS 15 DEFINE FROM-SUB W 2 N *********************************************************************** * THE TO-FIELD ARRAY USES INDEXING * *********************************************************************** DEFINE TO-FIELD W 15 A DEFINE TO-FIELD-BYTE TO-FIELD 1 A OCCURS 15 INDEX TO-INDEX DEFINE FIND-FIELD W 1 A VALUE 'G' DEFINE CHANGE-TO W 1 A VALUE 'J' * JOB INPUT NULL MOVE ' ' TO TO-FIELD FILL ' ' FROM-SUB = 1 TO-INDEX = 0 * DO UNTIL FROM-SUB EQ 16 IF FROM-FIELD-BYTE (FROM-SUB) = FIND-FIELD TO-FIELD-BYTE (FROM-SUB) = CHANGE-TO ELSE TO-FIELD-BYTE = FROM-FIELD-BYTE (FROM-SUB) END-IF TO-INDEX = TO-INDEX + 1 FROM-SUB = FROM-SUB + 1 END-DO * DISPLAY 'RESULTS:' DISPLAY ' ' DISPLAY '**********************************************************' DISPLAY 'FROM-FIELD = ' FROM-FIELD DISPLAY '*************000000000111111******************************' DISPLAY ' 123456789012345******************************' DISPLAY '**********************************************************' DISPLAY 'TO-FIELD = ' TO-FIELD DISPLAY '*************000000000111111******************************' DISPLAY ' 123456789012345******************************' DISPLAY '**********************************************************' * STOP *

Running this program produces: RESULTS:


********************************************************** FROM-FIELD = GOHN *************000000000111111****************************** 123456789012345****************************** ********************************************************** TO-FIELD = JOHN *************000000000111111****************************** 123456789012345****************************** **********************************************************

How can I use EZT+ to get sub totals and a grand total on an amount field in a report?
Choose one or more non-quantitative fields that you want sub-totaled. Code a SEQUENCE statement followed by the field names of the fields you want sorted and totaled. Finally, code a CONTROL statement followed by the fields you want totaled.

How does CA-Easytrieve Plus handle EBCDIC data format files? Does it translate the files into ASCII and then generate reports? Does it need any other tool/utility for the translation?
CA-Easytrieve Plus reads, writes, and updates standard IBM flat files, VSAM, DB2, DATACOM, IDMS, SUPRA, and TOTAL files in EBCDIC format on the mainframe. It does the same for ASCII files under UNIX including ORACLE, INGRES, OPENINGRES, DB2, IDMS, and SYBASE. On the mainframe, CA-Easytrieve Plus handles EBCDIC files. On UNIX, it handles ASCII. To convert from EBCDIC to ASCII or from ASCII to EBCDIC you need a specific CA product -- CAEasytrieve/Toolkit. This product includes many ready-to-use macros including CONVEA and CONVAE. CONVEA and CONVAE convert EBCDIC to ASCII and ASCII to EBCDIC.

I receive the message: A004 CATASTROPHIC ERROR IN MODULE A140 04 136E. What would cause this error?
This is an indication that the EZTVFM file is out of space. Increase the EZTVFM space in the JCL. VFM space can not span packs. If more space is needed you will need to use WORK files. Using report WORK files means that spooling is done to the respective WORK file, not to the EZTVFM. For more information about EZTVFM, see Chapter 3 of the CA-Easytrieve Plus Installation Guide, refer to topic "OS/390 Operating System". For information on how to setup WORK files, see Chapter 11 of the CA-Easytrieve Plus Reference Guide, refer to topic "Report Work Files."

My CA-Easytrieve program is receiving an S0C7 abend. How do I find the statement that caused an S0C7 data exception in CA-Easytrieve?
An S0C7 data exception occurs in CA-Easytrieve programs when non-numeric data is placed in a numeric field. The following program contains a deliberate data exception:
1 PARM LINK(EZTEST10 R) DEBUG (STATE FLOW) 2 FILE PERSNL1 FB (150 1800) 3 NAME-LAST 17 8 A HEADING('LAST' 'NAME') 4 NAME-FIRST 25 8 A HEADING('FIRST' 'NAME') 5 PAY-GROSS 94 4 P 2 HEADING('GROSS' 'PAY') 6 * 7 WS-DATA-EXCEPTION W 5 A 8 WS-NUMBER WS-DATA-EXCEPTION 5 P 0 9 * 10 JOB INPUT PERSNL1 11 WS-DATA-EXCEPTION = ' ' 12 WS-NUMBER = WS-NUMBER + 1 13 PRINT RPT1 14 REPORT RPT1 LINESIZE 80 15 TITLE 01 'EZTEST10 - CONTROL BREAK ON DEPT' 16 LINE 01 PERSNL1:NAME-FIRST + PERSNL1:NAME-LAST + PERSNL1:NAME-LAST + PERSNL1:PAY-GROSS + WS-NUMBER

WS-DATA-EXCEPTION is a 5-byte alphabetic field that is redefined by the packed numeric field WSNUMBER. WS-DATA-EXCEPTION is set to 5 hex 40 blanks and then WS-NUMBER is computed by adding 1. This is a classic formula for an S0C7 data exception. If this happened to be a very large program with pages and pages of code you may need to review the following two methods to determine which instruction caused the S0C7. One method to discover the statement number and the statements that were executed prior to the S0C7 is to include in the PARM statement, the sub-parameter DEBUG (STATE FLOW). STATE saves the statement number of the statement currently being executed. The statement number is then printed in the associated abnormal termination messages. FLOW activates a trace of the statements being executed. The statement numbers are printed in the associated analysis report. STATE caused the following to print:
12 *******A006 PROGRAM INTERRUPT - CODE 7 (DATA EXCP)

This indicates that the error occurred at statement number 12 and that the error was an S0C7 data exception. FLOW caused the following to print:
FLOW TABLE - MAXIMUM ENTRIES 100 10 11 12

This indicates that statements 10, 11, and 12 were executed just prior to the S0C7. If the program abends and the PARM does not include DEBUG (STATE FLOW) you can do the following: Find the contents of register 3. Add hex 4E to the contents of register 3. The contents of register 3 plus hex 4E contains the statement number in hex. Convert the statement number in hex to decimal to find the problem statement in the compiled output listing. Register 3 in the sample program dump is 7D80, as the following illustrates:

R0 0000000C R1 00000006 R2 00007C95 R3 00007D80 R8 00000000 R9 000069B0 R10 80015636 R11 00008D70 Add 7D80 to hex 4E and you get 7DCE. Go to hex 7DCE in the dump 00007DC0 00009A8E 00010000 00000000 0000000C

The value at 7DCE is hex C. Convert hex C to decimal and you get 12. Statement 12 is the statement number that caused the S0C7 data exception. What do you do if you receive the message, " B070 VALUE NOT WITHIN ACCEPTABLE RANGE LINESIZE", when using CA-Endevor to manage CA-Easytrieve programs? If you check the CA-Easytrieve Plus Options Table, you will probably find that LINESIZE is set to the expected value of 132. Also, if you check the CA-Easytrieve program you will probably find that the LINESIZE is either not coded and thereby using the Options Table default of 132, or that LINESIZE is coded with an acceptable number from 80 to 132. If there does not seem to be a problem with the CA-Easytrieve Plus LINESIZE, try running the program outside of CA-Endevor to see if the program runs without error. If the program returns the expected output, then the problem is due to CA-Endevor's SYSPRINT record (which is overriding the LINESIZE). Talk to your CA-Endevor administrator so that he or she may correct the SYSPRINT record.

Do you have any performance/tuning tips?


General Performance Considerations: When accessing multiple files, put those files on different disk devices to avoid DASD arm contention. Use the highest priority when running the job. Do not run other programs that use the same resources at the same time. Use maximum file buffering. Use optimum blocking factors. For VSAM files that are also read by an online system, specify share options 2 or 4. Reorganize VSAM files so that they are not fragmented. If accessing a small number of records from a large file, read them with keys instead of sequentially. Use disk instead of tape whenever possible. Do not use the DEBUG parameters of COBOL (when calling subroutines). Break down huge datasets to smaller, logical datasets. Increase REGION size. CA-Easytrieve Plus Specific Considerations: Execute link-edited programs instead of compile and go. Produce multiple reports with a single pass of the dataset(s). Send reports to individual disk datasets to reduce VFM disk contention. Do not use the DEBUG parameters of CA-Easytrieve in production. Use binary searches (tables) instead of multiple nested IF statements. Use binary fields whenever possible to perform arithmetic operations. If a 4-byte binary field is not large enough use an 8-byte packed field. Use indexes instead of subscripts. If you must use a subscript define it as 2 bytes binary. When comparing fields or doing any arithmetic operation use fields that have the same data type, length and number of decimals. FILE BUFFERING The BUFNO parameter of the FILE statement establishes the number of input/output buffers allocated for the file. The default in EZT+ is two. Since minimizing the number of physical I/O operations is essential to maximizing performance, you should experiment with larger BUFNO values. Please note this value will only affect the buffering for sequentially organized files, such as QSAM. VSAM file buffers should be allocated in the JCL through the use of the AMP parameter or in the VSAM file definition. SORTING By default, the CA-Easytrieve Plus options table provides three dynamically allocated sortwork datasets. If you would like to increase this number or turn off this option to use your own SORTWK datasets from your JCL, use the WORK parameter on the PARM statement. PARM WORK 0 PARM WORK 5 this will turn off any dynamic allocation by EZT+ this will dynamically allocate 5 sortwork datasets

To change the CA-Easytrieve Plus options table to eliminate the need to code the PARM, change the NUMWORK parameter, for example: NUMWORK=0 this means you must always have SORTWORK DDs in your JCL

NUMWORK=5 this means you will always have five dynamically allocated sortwork datasets provided by CA-Easytrieve Plus. You will NOT use any of the SORTWORK DDs from the JCL.

Also, when implementing a SORT activity, you can use the BEFORE parameter to identify a procedure to pre-screen input records. Adding a SELECT clause can cut down the number of records used by the CAEasytrieve Plus program. VIRTUAL FILE MANAGER (VFM) The VFMSPAC parameter in the options table (which may be overridden with the VFM parameter in the PARM statement) could have an important role in determining execution time. EASYTRIEVE PLUS uses its virtual file manager (VFM) to allocate the temporary data sets required during processing. Whenever a programmer builds a temporary file within his program by specifying VIRTUAL in the FILE statement VFM resources are used. Additionally, EZT+ creates work files to hold report data whenever the SEQUENCE statement is specified in the report, or if multiple reports are generated from the same program. VFM space is 40% of the total region, or partition space for most EZT+ programs. Should a program exhaust the region memory specified by the above parameters, it will satisfy any additional requirements by acquiring DASD space via the EZTVFM dataset, specified in the JCL. Typically the EZTVFM dataset is allocated in cylinders or work DASD. In an MVS environment, you may specify UNIT=VIO on the EZTVFM DD statement instead of UNIT=DISK or UNIT=SYSDA. The use of VIO is quicker than DASD and the space it utilizes is not part of the region in which the program is running. In the case of multiple reports in the same program with a high volume of VFM usage, use of the FILE parameter of the REPORT statement is highly recommended. Since the EZTVFM data set used for the overflow of VFM is limited to one pack, contention for the space can be high when multiple reports are generated, causing performance degradation. The FILE parameter enables the programmer to specify separate work datasets to be used instead of the VFM area reducing the EZTVFM contention. When comparing fields or doing any arithmetic operation, use fields that have the same data type, length, and number of decimals.

How can I print detail fields from the previous record at control break time?
Use SUMCTL DTLCOPYALL on the report statement. Included are two programs. Program #1 lists the file in REGION BRANCH sequence. Program #2 lists the file in REGION BRANCH sequence and also displays a detail field from the record just prior to the break.
PROGRAM #1 7/01/99 11.45.47 PAGE 1 CA-EASYTRIEVE PLUS-6.2 9904

COMPUTER ASSOCIATES INTL. -FIELD INSTALLATION PROGRAMS AND ALL SUPPORTING MATERIALS COPYRIGHT (C) 1982, 1996 BY COMPUTER ASSOCIATES INTL. INC. 1 PARM LINK(EZTEST10 R) DEBUG (STATE FLOW) 2 FILE PERSNL1 FB (150 1800) 3 REGION 1 1 N 4 BRANCH 2 2 N 5 SSN 4 5 P MASK '999-99-9999' HEADING('SOCIAL' 'SECURITY' 'NUMBER') 6 EMP# 9 5 N HEADING('EMPLOYEE' 'NUMBER') 7 EMPNAME 17 16 A HEADING 'EMPLOYEE NAME' 8 NAME-LAST EMPNAME 8 A HEADING('LAST' 'NAME') 9 NAME-FIRST EMPNAME +8 8 A HEADING('FIRST' 'NAME') 10 ADDRESS 37 39 A 11 ADDR-STREET 37 20 A HEADING 'STREET' 12 ADDR-CITY 57 12 A HEADING 'CITY' 13 ADDR-STATE 69 2 A HEADING 'STATE' 14 ADDR-ZIP 71 5 N HEADING('ZIP' 'CODE') 15 PAY-NET 90 4 P 2 HEADING('NET' 'PAY') 16 PAY-GROSS 94 4 P 2 HEADING('GROSS' 'PAY' 17 DEPT 98 3 N 18 DATE-OF-BIRTH 103 6 N MASK( 'Z9/99/99') HEADING('DATE' 'OF' 'BIRTH') 19 TELEPHONE 117 10 N MASK '(999) 999-9999' HEADING('TELEPHONE' 'NUMBER') 20 SEX 127 1 N HEADING('SEX' 'CODE') 21 * 1 - FEMALE 22 * 2 - MALE 23 MARITAL-STAT 128 1 A HEADING('MARITAL' 'STATUS') 24 * M - MARRIED 25 * S - SINGLE 26 JOB-CATEGORY 132 2 N HEADING('JOB' 'CATEGORY') 27 SALARY-CODE 134 2 N HEADING('SALARY' 'CODE') 28 DATE-OF-HIRE 136 6 N MASK ( 'Z9/99/99') HEADING('DATE' 'OF' 'HIRE') 29 JOB INPUT PERSNL1 30 PRINT RPT1 31 REPORT RPT1 LINESIZE 80 32 SEQUENCE REGION BRANCH 33 TITLE 01 'EZTEST10 - SEQUENTIAL LIST REGION BRANCH NAME GROSS' 34 LINE 01 PERSNL1:REGION + PERSNL1:BRANCH + PERSNL1:NAME-LAST + PERSNL1:PAY-GROSS OPTIONS FOR THIS RUN ABEXIT SNAP DEBUG (FLOW FLOWSIZ 100 STATE FLDCHK NOXREF) LINK (EZTEST10 R) LIST (PARM FILE) PRESIZE 512 SORT (DEVICE SYSDA ALTSEQ NO MSG DEFAULT MEMORY MAX WORK 3) VFM ( 64) DFSMS/MVS V1 R4.0 BINDER 11:46:09 THURSDAY JULY 1, 1999 BATCH EMULATOR JOB(EZTEST1 ) STEP(LKED ) PGM= IEWL 7/01/99 EZTEST10 - SEQUENTIAL LIST REGION BRANCH NAME GROSS REGION 1 1 BRANCH 01 01 LAST NAME WIMN BRANDOW GROSS PAY 373.60 804.64 PAGE 1

759.20 554.40 146.16 344.80 445.50 283.92 396.68 492.26 360.80 242.40 243.20 135.85 13.80 386.40 220.80 292.00 295.20 279.36 197.60 253.26 736.00 313.60 1,004.00 313.60 310.40 174.15 315.20 250.40 310.40 313.60 324.00 628.00 329.00 386.40 376.00 365.60 282.40 399.20 460.80 183.75 121.95 712.80 804.80 424.00 125.00 591.20 7/01/99 11.45.51 CA-EASYTRIEVE PLUS-6.2 9904 PAGE 1 COMPUTER ASSOCIATES INTL. -FIELD INSTALLATION PROGRAMS AND ALL SUPPORTING MATERIALS COPYRIGHT (C) 1982, 1996 BY COMPUTER ASSOCIATES INTL. INC. FILE STATISTICS - CA-EASYTRIEVE PLUS 6.2 9904- 7/01/99-11.45-JSN00029 PERSNL1 48 INPUT SAM FIX BLK 150 1800 EZTR001 48 INPUT VFM FIX BLK 15 N/A

1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4

02 02 03 03 04 04 04 04 01 02 02 03 03 03 03 04 05 05 01 01 01 01 02 02 02 02 02 02 03 03 03 03 03 03 04 04 04 01 01 01 02 02 03 03 03 04

BERG NAGLE CORNING MANHART ARNOLD LARSON BYER TALL HUSS KRUSE POWELL DENNING FORREST MCMAHON PETRIK POST LOYAL VETTER KELLY PHILPS WEST YOUNG GRECO ISAAC LACH REYNOLDS SMOTH THOMPSON EPERT MILLER NORIDGE OSMON ROGERS STRIDE CROCI GREEN MALLOW RYAN TALUS WARD HAFER JOHNSON JONES WALTERS ZOLTAN JUDAR

PROGRAM #2 7/01/99 15.55.33 PAGE 1 CA-EASYTRIEVE PLUS-6.2 9904

COMPUTER ASSOCIATES INTL. -FIELD INSTALLATION PROGRAMS AND ALL SUPPORTING MATERIALS COPYRIGHT (C) 1982, 1996 BY COMPUTER ASSOCIATES INTL. INC. 1 PARM LINK(EZTEST10 R) DEBUG (STATE FLOW) 2 FILE PERSNL1 FB (150 1800) 3 REGION 1 1 N 4 BRANCH 2 2 N 5 SSN 4 5 P MASK '999-99-9999' HEADING('SOCIAL' 'SECURITY' 'NUMBER') 6 EMP# 9 5 N HEADING('EMPLOYEE' 'NUMBER')

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

EMPNAME 17 16 A HEADING 'EMPLOYEE NAME' NAME-LAST EMPNAME 8 A HEADING('LAST' 'NAME') NAME-FIRST EMPNAME +8 8 A HEADING('FIRST' 'NAME') ADDRESS 37 39 A ADDR-STREET 37 20 A HEADING 'STREET' ADDR-CITY 57 12 A HEADING 'CITY' ADDR-STATE 69 2 A HEADING 'STATE' ADDR-ZIP 71 5 N HEADING('ZIP' 'CODE') PAY-NET 90 4 P 2 HEADING('NET' 'PAY') PAY-GROSS 94 4 P 2 HEADING('GROSS' 'PAY') DEPT 98 3 N DATE-OF-BIRTH 103 6 N MASK( 'Z9/99/99') HEADING('DATE' 'OF' 'BIRTH') TELEPHONE 117 10 N MASK '(999) 999-9999' HEADING('TELEPHONE' 'NUMBER') SEX 127 1 N HEADING('SEX' 'CODE') * 1 - FEMALE * 2 - MALE MARITAL-STAT 128 1 A HEADING('MARITAL' 'STATUS') * M - MARRIED * S - SINGLE JOB-CATEGORY 132 2 N HEADING('JOB' 'CATEGORY') SALARY-CODE 134 2 N HEADING('SALARY' 'CODE') DATE-OF-HIRE 136 6 N MASK ( 'Z9/99/99') HEADING('DATE' 'OF' 'HIRE') WS-NAME S 8 A JOB INPUT PERSNL1 PRINT RPT1 REPORT RPT1 LINESIZE 80 SUMCTL DTLCOPYALL SEQUENCE REGION BRANCH CONTROL REGION BRANCH TITLE 01 'EZTEST1 - PRINT PERSNL FILE' LINE 01 REGION + BRANCH + NAME-LAST + PAY-GROSS

OPTIONS FOR THIS RUN ABEXIT SNAP DEBUG (FLOW FLOWSIZ 100 STATE FLDCHK NOXREF) LINK (EZTEST10 R) LIST (PARM FILE) PRESIZE 512 SORT (DEVICE SYSDA ALTSEQ NO MSG DEFAULT MEMORY MAX WORK 3) VFM ( 64) DFSMS/MVS V1 R4.0 BINDER 15:55:54 THURSDAY JULY 1, 1999 BATCH EMULATOR JOB(EZTEST2 ) STEP(LKED ) PGM= IEWL 7/01/99 REGION 1 1 1 1 1 1 1 EZTEST1 - PRINT PERSNL FILE BRANCH 01 01 02 02 03 03 04 LAST NAME WIMN BRANDOW BRANDOW BERG NAGLE NAGLE CORNING MANHART MANHART ARNOLD LARSON BYER TALL TALL TALL HUSS HUSS KRUSE POWELL POWELL GROSS PAY 373.60 804.64 1,178.24 759.20 554.40 1,313.60 146.16 344.80 490.96 445.50 283.92 396.68 492.26 1,618.36 4,601.16 360.80 360.80 242.40 243.20 485.60 PAGE 1

1 1 2 2 2 2

04 01 01 02 02

03

2 2 2 2 2 2 3

03 04 04 05 05 01

3 3

01 02

DENNING FORREST MCMAHON PETRIK PETRIK POST POST LOYAL VETTER VETTER VETTER KELLY PHILPS WEST YOUNG YOUNG GRECO ISAAC LACH

135.85 13.80 386.40 220.80 756.85 292.00 292.00 295.20 279.36 574.56 2,469.81 197.60 253.26 736.00 313.60 1,500.46 1,004.00 313.60 310.40 PAGE 2

7/01/99 REGION 3 3 3

EZTEST1 - PRINT PERSNL FILE BRANCH 02 02 03 LAST NAME REYNOLDS SMOTH THOMPSON THOMPSON EPERT MILLER NORIDGE OSMON ROGERS STRIDE STRIDE CROCI GREEN MALLOW MALLOW MALLOW RYAN TALUS WARD WARD HAFER JOHNSON JOHNSON JONES WALTERS ZOLTAN ZOLTAN JUDAR JUDAR JUDAR JUDAR GROSS PAY 174.15 315.20 250.40 2,367.75 310.40 313.60 324.00 628.00 329.00 386.40 2,291.40 376.00 365.60 282.40 1,024.00 7,183.61 399.20 460.80 183.75 1,043.75 121.95 712.80 834.75 804.80 424.00 125.00 1,353.80 591.20 591.20 3,823.50 18,078.08

3 3 3 3 4 4 4 4 4 4 4 4 4 7/01/99 15.55.35 PAGE 1

03 04 04 01 01 02 02 03 03 04 04

CA-EASYTRIEVE PLUS-6.2 9904

COMPUTER ASSOCIATES INTL. -FIELD INSTALLATION PROGRAMS AND ALL SUPPORTING MATERIALS COPYRIGHT (C) 1982, 1996 BY COMPUTER ASSOCIATES INTL. INC. FILE STATISTICS - CA-EASYTRIEVE PLUS 6.2 9904- 7/01/99-15.55-JSN00030 PERSNL1 48 INPUT SAM FIX BLK 150 800 EZTR001 48 INPUT VFM FIX BLK 15 N/A

As you can see, the size of each module increases quite a bit once the link job is run.

Is there a way to process all matching records, even if there are duplicates on the most major file?
The following program shows a method to make CA-Easytrieve's Synchronized File Processing work in a way beyond which it was designed. This program will process all matching records, even if there are duplicates on the most major file (in this example, FILEA). This example ignores any records that do not exist on both files, you may add additional logic to handle this situation, if necessary. This code assumes FILEA is fixed and its record length is 150, FILEB is also fixed with a record length of 100. The array is built assuming that there will be no more than 10 duplicate key records that exist on FILEB.
FILEA FLDA . . FILEB RECB FLDB . .

10

.* key field used in sync processing

1 10

100 10

A A

.* define entire record .* key field used in sync processing

ENTIRE-ARRAY W 1000 A WSB-ARRAY ENTIRE-ARRAY SAVE-KEY WS-RECB W 10

VALUE ' ' .* length times occurs equals this length 100 A OCCURS 10

A .* save the key of FILEA A .* unload array into this area

W 100

. . you may need to define all fields of FILEB here .


ARRAY-CNT ARRAY-SUB W W 2 2 B B 0 0 VALUE 0 VALUE 0

JOB INPUT (FILEA KEY(FLDA) FILEB KEY (FLDB)) IF MATCHED IF FIRST-DUP FILEA ARRAY-CNT = ARRAY-CNT + 1 IF ARRAY-CNT GT 10 DISPLAY 'ARRAY OVERLOAD - CHANGE OCCURS AMOUNT' STOP EXECUTE END-IF WSB-ARRAY (ARRAY-CNT) = RECB END-IF . . other program logic . SAVE-KEY = FLDA END-IF IF NOT MATCHED AND FILEA AND FLDA = SAVE-KEY ARRAY-SUB = 1 DO WHILE ARRAY-SUB LE ARRAY-CNT WS-RECB = WSB-ARRAY (ARRAY-SUB)

. . other program logic .


ARRAY-SUB = ARRAY-SUB + 1

END-DO IF LAST-DUP FILEA MOVE SPACES TO ENTIRE-ARRAY ARRAY-CNT = 0 END-IF END-IF

. . . NOTE: This is just a skeleton program. Additional code should be inserted as required. This example ignores any unmatched records from either file, you could add code to handle this situation as well.

FILEA A A B

FILEB A A A B

Normally, Synchronized File Processing would process the first FILEA key A against all of the FILEB key A records and the second key A record from FILEA would be presented as NOT MATCHED. The above code will read the first key A record from FILEA and the first Key A record from FILEB and present that as a MATCH, it will then read FILEB record 2 and present that as a match with the first record from FILEA. While this processing is going on, the FILEB records are being stored in the array. Once we read the fourth record in FILEB and encounter an unmatched key we then read ahead in FILEA, since the key of FILEA matches the SAVE-KEY we will process the second record from FILEA against the array of FILEB records. Record two from FILEA is the last duplicate which causes the array to be emptied. Processing continues to the next record in FILEA which now matches the current key of FILEB, another MATCH condition.

Das könnte Ihnen auch gefallen