Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

CICS :: CICS Question RE: Browse, Readnext and Rewrite of ESDS File

$
0
0
Author: moezbud
Subject: CICS Question RE: Browse, Readnext and Rewrite of ESDS File
Posted: Sun Mar 05, 2017 5:45 am (GMT 5.5)

I've been going around and around all day with trying to make my CICS program update a record on an ESDS file. Essentially, I'm trying to sequentially read an ESDS log file, use it to post a transaction and then I want to flag the record to indicate that I've posted it.

I ended up with the following logic:

Code:

EXEC CICS  STARTBR DATASET (FILE-FORMAT)
                  RIDFLD  (WS-CUR-RBA)
                  RBA
                  END-EXEC.

EXEC CICS  READNEXT DATASET (FILE-FORMAT)
                  INTO    (LOG-REC)
                  LENGTH  (WB-LOGREC-LENGTH)
                  RIDFLD  (WS-CUR-RBA)
                  RBA
                  RESP    (RESP-CODE)
                  RESP2   (RESP2-CODE)
                  END-EXEC.

EXEC CICS  ENDBR  DATASET (FILE-FORMAT)
                  END-EXEC.
.
.
post transaction
.
.
EXEC CICS  READ   DATASET (FILE-FORMAT)
                  INTO    (LOG-REC)
                  LENGTH  (WB-LOGREC-LENGTH)
                  RIDFLD  (WS-CUR-RBA)
                  RBA
                  UPDATE
                  RESP    (RESP-CODE)
                  RESP2   (RESP2-CODE)
                  END-EXEC.

EXEC CICS REWRITE  DATASET (FILE-FORMAT)
                   FROM    (LOG-REC)
                   LENGTH  (WB-LOGREC-LENGTH)
                   RESP    (RESP-CODE)
                   RESP2   (RESP2-CODE)
                   END-EXEC.

ADD WS-LOGREC-LENGTH TO WS-CUR-LOG-RBA
GO BACK UP TO STARTBR...


Please note, that I am NOT a CICS programmer. Everything up there is basically what I was able to garner from my friend Mr. Google... So, I'm fully aware that it may be bogus...

Essentially, after my rewrite, I'm adding the length of the record to my RBA so that I know where to find the next one (The records are all fixed 100 byte records).

Anyway, this actually almost works. The problem came when the RBA got past an address of 32600. At that point, it appears that somehow an additional 68 bytes was added to the address. So, instead of address 32700 following 32600, the next address was 32768.

Code:

RBA OF RECORD -            32600
000000  F0F0F0F0 F0F0F0F0 F0F0F0F
000020  F0F0F0F0 F0F0F0F0 F0F0F0F
000040  F0F0F0F0 F0F0F0F0 F0F0F0F
000060  F8404040

RBA OF RECORD -            32768
000000  F0F0F0F0 F0F0F0F0 F0F0F0F
000020  F0F0F0F0 F0F0F0F0 F0F0F0F
000040  F0F0F0F0 F0F0F0F0 F0F0F0F
000060  F0F0F0F0 F0F0F0F0 F0F0F0F

RBA OF RECORD -            32868


This happened again 36000 bytes later - another 68 bytes popped into the file.

Code:

RBA OF RECORD -            65268

RBA OF RECORD -            65368

RBA OF RECORD -            65536


It was very consistent. So, I added code to add the 68 bytes to the RBA after every 326 records. It all worked.

My question is... Is this a good idea? Can that 68 bytes of padding always be counted on to be there after every 32k of data? Or, should I come up with a plan B? Is there a better way to keep track of the RBA of my next record when I want to read and rewrite the previous one?

Any suggestions that you have will be sincerely appreciated.

Thanks!


Viewing all articles
Browse latest Browse all 8500

Trending Articles