EasyTrieve, a programming language developed by Computer Associates (now Broadcom), has been a staple in the mainframe world for decades. As a data processing and reporting tool, EasyTrieve allows developers to efficiently manage and manipulate data from various sources, including VSAM, DB2, and flat files. If you’re interviewing for a position that requires EasyTrieve expertise, you’ll want to be prepared to showcase your knowledge and problem-solving skills. In this article, we’ll explore some of the most common EasyTrieve interview questions and provide sample answers to help you ace the interview.
1. How can you search a string for a specific character and replace it with another character?
To search a string for a specific character and replace it with another character, you can use a loop to iterate through each byte of the string. Here’s an example:
DEFINE FROM-FIELD W 15 A VALUE 'GOHN 'DEFINE FROM-FIELD-BYTE FROM-FIELD 1 A OCCURS 15DEFINE FROM-SUB W 2 NDEFINE TO-FIELD W 15 ADEFINE TO-FIELD-BYTE TO-FIELD 1 A OCCURS 15 INDEX TO-INDEXDEFINE FIND-FIELD W 1 A VALUE 'G'DEFINE CHANGE-TO W 1 A VALUE 'J'MOVE ' ' TO TO-FIELD FILL ' 'FROM-SUB = 1TO-INDEX = 0DO 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 + 1END-DO
This code defines two fields: FROM-FIELD
and TO-FIELD
. It then loops through each byte of FROM-FIELD
using the FROM-SUB
subscript. If the byte matches the FIND-FIELD
character, it replaces it with the CHANGE-TO
character in the corresponding position of TO-FIELD
. Otherwise, it copies the byte from FROM-FIELD
to TO-FIELD
.
2. How can you use EasyTrieve to get subtotals and a grand total on an amount field in a report?
To get subtotals and a grand total on an amount field in a report, you can use the SEQUENCE
and CONTROL
statements. Here’s an example:
SEQUENCE [non-quantitative field(s)]CONTROL [field(s) to be totaled]
First, choose one or more non-quantitative fields that you want subtotaled. Code a SEQUENCE
statement followed by the field names of the fields you want sorted and subtotaled. Then, code a CONTROL
statement followed by the field(s) you want totaled.
3. How does EasyTrieve Plus handle EBCDIC data format files?
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 also handles ASCII files under UNIX, including ORACLE, INGRES, OPENINGRES, DB2, IDMS, and SYBASE.
On the mainframe, EasyTrieve Plus handles EBCDIC files natively. On UNIX, it handles ASCII files. To convert from EBCDIC to ASCII or from ASCII to EBCDIC, you need a specific product called EasyTrieve/Toolkit, which includes macros like CONVEA
and CONVAE
for conversion.
4. What would cause the “A004 CATASTROPHIC ERROR IN MODULE A140 04136E” error?
This error typically indicates that the EZTVFM file is out of space. You’ll need to increase the EZTVFM space in the JCL. VFM space cannot span multiple disk packs. If more space is needed, you’ll have to use WORK files, which means that spooling is done to the respective WORK file instead of the EZTVFM.
5. How can you process all matching records, even if there are duplicates on the most major file?
EasyTrieve’s Synchronized File Processing is designed to process all matching records, even if there are duplicates on the most major file. Here’s an example:
FILEA FLDA 1 10 A FILEB RECB 1 100 A FLDB 10 10 A ENTIRE-ARRAY W 1000 A VALUE ' 'WSB-ARRAY ENTIRE-ARRAY 100 A OCCURS 10SAVE-KEY W 10 AWS-RECB W 100 AARRAY-CNT W 2 B 0 VALUE 0ARRAY-SUB W 2 B 0 VALUE 0JOB 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 ...
This code assumes that FILEA
is fixed with a record length of 150 and 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
.
The program reads the first key record from FILEA
and the first key record from FILEB
and presents them as a match. It then reads the next record from FILEB
and presents it 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 the fourth record in FILEB
is encountered and an unmatched key is found, the program reads ahead in FILEA
. Since the key of FILEA
matches the SAVE-KEY
, it processes the second record from FILEA
against the array of FILEB
records.
6. What do you do if you receive the “B070 VALUE NOT WITHIN ACCEPTABLE RANGE -LINESIZE” error when using CA-Endevor to manage EasyTrieve programs?
If you receive this error, check the EasyTrieve Plus Options Table and ensure that the LINESIZE
is set to the expected value of 132. Also, check the EasyTrieve program and ensure that the LINESIZE
is either not coded (and thereby using the default of 132) or that it is coded with an acceptable number from 80 to 132.
If there doesn’t seem to be a problem with the EasyTrieve Plus LINESIZE
, try running the program outside of CA-Endevor to see if it runs without error. If it does, the problem is likely due to CA-Endevor’s SYSPRINT
record overriding the LINESIZE
. In this case, you’ll need to consult with your CA-Endevor administrator to correct the SYSPRINT
record.
By mastering these EasyTrieve interview questions and their sample answers, you’ll be better prepared to showcase your knowledge and problem-solving skills during the interview process. Remember, the key is to practice and be familiar with the language’s syntax, features, and best practices.
Easytrieve Tutorial | Chapter 2 – Activity Section, JOB & IF Statements in Easytrieve Program
FAQ
What is the difference between Easytrieve and Easytrieve plus?
What is P in Easytrieve?
How to convert easytrieve to COBOL?
Who owns Easytrieve?