Easytrieve and VSAM KSDS file.

Ask/Clarify the questions on EASYTRIEVE

Moderators: DikDude, Moderator Group

Post Reply
gonzalezw
Member
Posts: 7
Joined: Sat Nov 27, 2010 7:51 am

Easytrieve and VSAM KSDS file.

Post by gonzalezw » Fri Apr 01, 2011 1:32 am

I have a VSAM KSDS file which has defined the first 30 bytes as the record key.

Then I have a sequential file which gets read and match it with the VSAM KSDS file to pull a customer ID. On the output I get no match but I do know for a fact that the records are there. This is where I may have the problem and may be having difficulties writing the correct code:

The VSAM KSDS file is defined as follows:
PARM DEBUG(FLOW)
*
FILE F0MASTR VS
F0-NBR 1 2 B
APPL-CODE 3 3 A
F0ACCT-NBR 6 25 A
CUSTOMER-ID 46 7 P
*

The input sequential file is define as:
FILE F1MASTER FB(3600 3600)
MASTER-IP 1 3600 A
M-F1-NBR 1 3 P
M-F1ACCT-NBR 4 9 P
*

And the output sequential file is define as:
FILE OPMASTRO FB(3600 3600)
MASTER-OP 1 3600 A
O-BANK-NBR 1 3 B
O-ACCOUNT-NBR 4 9 P
0-CUSTOMER-ID 3494 7 P
*
All I need to do is read F1MASTER find a match in the F0MASTER and copy F1MASTER to OPMASTER adding the CUSTOMER-ID from F0MASTER.

In working storage I define the following:
W-REC-KEY W 30 A
W-B-NBR W-REC-KEY 2 B
W-APPL-CODE W-REC-KEY +2 3 A
W-A-NBR W-REC-KEY +5 25 A
*

Please note that the VSAM I/P file F0-NBR is binary field and on the sequential file is a pack field.

The code reads:
GET F1MASTER
WRK-IPDDA-COUNT = WRK-IPDDA-COUNT + 1
IF EOF F1MASTER
PRINT TOT-RPT1
STOP
END-IF
W-B-NBR = M-F1-NBR
W-APPL-CODE = 'DD'
W-A-NBR = M-F1ACCT-NBR
*
READ F0MASTR KEY W-REC-KEY STATUS
IF F0MASTR:FILE-STATUS NOT ZERO
DISPLAY 'ERROR READING VSAM F0 +
FILE WITH KEY: ' W-REC-KEY +
' FILE-STATUS IS ' F0MASTR:FILE-STATUS
GOTO JOB
ELSE
WRK-IPCIF-COUNT = WRK-IPCIF-COUNT + 1
MASTER-OP = MASTER-IP
0-CUSTOMER-ID = CUSTOMER-ID
PUT OPMASTRO
WRK-OPDDA-COUNT = WRK-OPDDA-COUNT + 1
END-IF

When the job runs there is no O/P generated and it displays the error message: for all records.
'ERROR READING VSAM F0 +
FILE WITH KEY: ' W-REC-KEY +
' FILE-STATUS IS ' F0MASTR:FILE-STATUS

What would be the correct way to handle this problem where the VSAM file is already defined with a binary code and the sequential file is packed decimal (if that is the problem)?
Thanks

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Fri Apr 01, 2011 2:18 pm

Why are you posting the same question 3-times?
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others