Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Read last record in ESDS file

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

New User


Joined: 08 Apr 2006
Posts: 14
Location: In front of my PC

PostPosted: Tue Jun 24, 2008 11:25 pm    Post subject: Read last record in ESDS file
Reply with quote

Hi,

Am trying to read the last record in ESDS file. We should move the high values to RIDFIELD to get the last record..right?

In the below code, pls temme wat should i move to ESDS-RBA to get the last record.

Thanks for ur help


Code:


WORKING-STORAGE SECTION.                 
77 ESDS-RBA      PIC S9(8) COMP.         
77 FINAL-REC PIC X(80).                   
77 WK-LEN PIC X(280).                     
                                         
PROCEDURE DIVISION.                       
   MOVE ????  TO ESDS-RBA.         ==========  ?
    MOVE 280  TO WK-LEN.                 
    EXEC CICS READ                       
        DATASET('FILE')               
        INTO(FINAL-REC)                   
        RIDFLD(ESDS-RBA)                 
        LENGTH(WK-LEN)                   
        RBA                               
    END-EXEC.                             
    EXEC CICS                             
        SEND TEXT FROM (FINAL-REC)       
        LENGTH(280)                       
        ERASE                             
       FREEKB       
   END-EXEC.       
   EXEC CICS RETURN
   END-EXEC.       
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Jun 25, 2008 12:10 am    Post subject:
Reply with quote

From the STARTBR command in CICS Application Programming Reference:
Quote:
RIDFLD(data-area)
specifies the record identification field. The contents can be a key, a relative byte address, or relative record number (for VSAM data sets), or a block reference, physical key, and deblocking argument (for BDAM data sets). For a relative byte address or a relative record number, the format of this field must be fullword binary. For a relative byte address, the RIDFLD can be greater than or equal to zero. For a relative record number, the RIDFLD can be greater than or equal to 1.

For VSAM, a full record id of X'FF's indicates that the browse is to be positioned at the end of the data set in preparation for a backwards browse using READPREV commands.


So do a STARTBR with RIDFLD of HIGH-VALUES then a READPREV. I don't think you can do it with just a READ.
Back to top
View user's profile Send private message
vimalonline
Warnings : 1

New User


Joined: 08 Apr 2006
Posts: 14
Location: In front of my PC

PostPosted: Wed Jun 25, 2008 12:16 am    Post subject:
Reply with quote

Robert Sample wrote:
From the STARTBR command in CICS Application Programming Reference:
Quote:
RIDFLD(data-area)
specifies the record identification field. The contents can be a key, a relative byte address, or relative record number (for VSAM data sets), or a block reference, physical key, and deblocking argument (for BDAM data sets). For a relative byte address or a relative record number, the format of this field must be fullword binary. For a relative byte address, the RIDFLD can be greater than or equal to zero. For a relative record number, the RIDFLD can be greater than or equal to 1.

For VSAM, a full record id of X'FF's indicates that the browse is to be positioned at the end of the data set in preparation for a backwards browse using READPREV commands.


So do a STARTBR with RIDFLD of HIGH-VALUES then a READPREV. I don't think you can do it with just a READ.



But We cant use HIGH-VALUES since RBA is declared as s9(8) comp.
Even i cant use X'FF' for this purpose. am getting compilation error.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Wed Jun 25, 2008 12:27 am    Post subject: Re: Read last record in ESDS file
Reply with quote

Set the signed RBA fullword to negative 1 (X'FFFFFFFF') and all will be forgiven. icon_wink.gif

Bill
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Wed Jun 25, 2008 12:42 am    Post subject:
Reply with quote

BILL IS CORRECT,

TRY

MOVE -1 TO RSDS-RBA


EXEC CICS STARTBR

EXEC CICS READPREV
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us