Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
moezbud

New User


Joined: 03 May 2016
Posts: 12
Location: usa

PostPosted: Sun Mar 05, 2017 5:45 am    Post subject: CICS Question RE: Browse, Readnext and Rewrite of ESDS File
Reply with quote

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!
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7992
Location: Bellevue, IA

PostPosted: Sun Mar 05, 2017 11:07 am    Post subject: Reply to: CICS Question RE: Browse, Readnext and Rewrite of ESDS File
Reply with quote

What is the definition of the ESDS data set? I suspect you've got a CI size of 32768 (32K); 327 records of 100 bytes will fill the CI with 68 bytes unused at the end of the CI. This is not really a CICS issue but rather how VSAM works.
Back to top
View user's profile Send private message
moezbud

New User


Joined: 03 May 2016
Posts: 12
Location: usa

PostPosted: Sun Mar 05, 2017 4:30 pm    Post subject: Reply to: CICS Question RE: Browse, Readnext and Rewrite of ESDS File
Reply with quote

Ugh.... Have you ever stared at something so long that you begin to overlook the most obvious things? Unbelievable. icon_redface.gif

Yep.... 32768 CISIZE....

Thanks for your help, Robert!
Back to top
View user's profile Send private message
moezbud

New User


Joined: 03 May 2016
Posts: 12
Location: usa

PostPosted: Sun Mar 05, 2017 5:08 pm    Post subject:
Reply with quote

Actually, let me make one follow-up question now that my "mystery" 68 bytes has been resolved.

Is there a better way for me to handle this scenario than what I've selected (startbr, readnext, endbr, read, rewrite, increment RBA, rinse, repeat)? It seems that my having to calculate the RBA on the fly to be able to read each subsequent record is kind of shaky. That's especially true if I'm depending on the CISIZE to always be constant - the next guy that comes along to tune that file will break my program.

If I were to be able to make this a KSDS file, most of my problems would be able to go away because I'd be able to use GTEQ on the read. But, unfortunately, that is not an option for us.

Any stray thoughts on this?

Thanks!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Sun Mar 05, 2017 6:00 pm    Post subject: Reply to: CICS Question RE: Browse, Readnext and Rewrite of ESDS File
Reply with quote

Where do you get your initial RBA?

Also, you shouldn't need to maintain the RBA in the browse yourself, unless you have a specific requirement to break the sequence. The RBA is maintained for you, in that field. If you leave it alone, all should be well. Only change it if you want to do something "out of sequence" and if you do change it, only ever change it to an RBA that is known to be of a record.
Back to top
View user's profile Send private message
moezbud

New User


Joined: 03 May 2016
Posts: 12
Location: usa

PostPosted: Sun Mar 05, 2017 6:16 pm    Post subject:
Reply with quote

Bill,
I start to read sequentially at the beginning of the ESDS file (RBA = 0) with a startbr and readnext.

After I endbr and rewrite to the file, however, my original readnext has lost its place. Hasn't it? I have to go back to the startbr with the address of the next record on file (which I haven't read yet). At least, that's what seemed to be happening to me when I was testing it. It all started working when I added the record length to the RBA before looping back to my original startbr again.

It's probable that my thinking is hosed here.... But, how else do I get the next RBA so that I can re-start my next browse? If I don't bump it up, the next startbr will just re-read the record that I just finished processing. Won't it?

Thanks!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Mon Mar 06, 2017 2:46 am    Post subject: Reply to: CICS Question RE: Browse, Readnext and Rewrite of ESDS File
Reply with quote

See here

Pay close attention to the description.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 755
Location: Germany

PostPosted: Wed Mar 08, 2017 4:54 pm    Post subject:
Reply with quote

@ moezbud

Just a question:

your processing as you told is: startbr, readnext, endbr, read, rewrite, increment RBA, rinse, repeat ...

Why not: open, startbr, loop-until-eof (readnext,rewrite), endbr, close

Or am i missing somewhat
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 1 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us