Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
KSDS direct READ clause after READ NEXT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sophia.lee

New User


Joined: 25 Jul 2019
Posts: 2
Location: Repulic of Korea

PostPosted: Tue Oct 01, 2019 10:10 am    Post subject: KSDS direct READ clause after READ NEXT
Reply with quote

Hi, all.

I'd like to ask the correct behavior of START-READ clause like below:

1. READ
No 'KEY IS' option defined. -> READ with its main key.
2. START
AIX is used as a key.
3. READ NEXT
AIX is used as a key for a sequential READ after START.
4. READ
No 'KEY IS' option defined. -> Which KEY should be used, main key or AIX used at the previous READ NEXT clause?


Code:
       IDENTIFICATION                                          DIVISION.
       PROGRAM-ID. DPTLMH.
       ENVIRONMENT                                             DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.

       SELECT IX-DPT-DATA-FILE ASSIGN TO DPTDD
              ACCESS MODE  IS  DYNAMIC
              ORGANIZATION IS  INDEXED
==>           RECORD KEY   IS  IX-DPT-DATA-KEY <==
              ALTERNATE RECORD KEY IS IX-DPT-DATA-ALT-KEY-01
==>           ALTERNATE RECORD KEY IS IX-DPT-DATA-ALT-KEY-02 <==
              FILE STATUS  IS  IX-DPT-DATA-FILE-STATUS.

       DATA DIVISION.
       FILE SECTION.

       FD  IX-DPT-DATA-FILE.
       01  IX-DPT-DATA-REC.
           03 IX-DPT-DATA-KEY.
              05 IX-DPT-DATA-KEY-NUM                       PIC 9(4).
              05 IX-DPT-DATA-KEY-BLOCK                     PIC X(41).
           03 IX-DPT-DATA-ALT-KEY-01.
              05 IX-DPT-DATA-KEY-NUM-01                    PIC 9(4).
              05 IX-DPT-DATA-CTR-01                        PIC 9(8).
           03 IX-DPT-DATA-ALT-KEY-02.
              05 IX-DPT-DATA-KEY-NUM-02                    PIC 9(4).
              05 IX-DPT-DATA-KEY-BLOCK-02                  PIC X(41).
           03 IX-DPT-DATA-BLOCK                            PIC X(512).

       WORKING-STORAGE SECTION.
       01  IX-DPT-DATA-FILE-STATUS              PIC X(02).

       PROCEDURE DIVISION.

           OPEN INPUT IX-DPT-DATA-FILE.

           MOVE 6666 TO IX-DPT-DATA-KEY-NUM.
           DISPLAY '### READ IX-DPT-DATA-FILE'
==>        READ IX-DPT-DATA-FILE <==
                                 INVALID KEY
                 DISPLAY '*** INVALID KEY ***'
           END-READ.

           MOVE 5555 TO IX-DPT-DATA-ALT-KEY-02.

           DISPLAY '### START IX-DPT-DATA-FILE KEY >= AIXKEY'
==>           START IX-DPT-DATA-FILE KEY >= IX-DPT-DATA-ALT-KEY-02 <==
                 INVALID KEY
                 DISPLAY '*** INVALID KEY ***'
           END-START.

           DISPLAY '### READ IX-DPT-DATA-FILE NEXT'
==>       READ IX-DPT-DATA-FILE NEXT AT END <==
                DISPLAY '*** AT END ***'
           NOT AT END
                DISPLAY '*** NOT AT END ***'
           END-READ.

           DISPLAY '### READ IX-DPT-DATA-FILE MAIN KEY'
==>        READ IX-DPT-DATA-FILE <==
                                 INVALID KEY
                 DISPLAY '*** INVALID KEY ***'
           END-READ.

           DISPLAY '### START IX-DPT-DATA-FILE = MAIN KEY'
           START IX-DPT-DATA-FILE KEY = IX-DPT-DATA-KEY

           CLOSE IX-DPT-DATA-FILE.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Issue in NDM : Connect Direct janmejay All Other Mainframe Topics 0 Sat Sep 28, 2019 12:05 pm
No new posts ALTERNATE RECORD KEY usage for KSDS AIX sophia.lee COBOL Programming 1 Thu Jul 25, 2019 7:28 am
No new posts How to force PULL to read user-input ... Andi1982 CLIST & REXX 5 Thu May 09, 2019 6:27 pm
No new posts Need suggestion on CICS READ UPDATE subratarec CICS 8 Fri May 03, 2019 2:23 pm
No new posts Suggestion on KSDS VSAM READ in CICS subratarec CICS 5 Wed Feb 13, 2019 4:42 pm

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