IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Read last record in ESDS file


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 25, 2008 12:10 am
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jun 25, 2008 12:27 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 2
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top