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
 

 

Using Alternate Index in COBOL program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
gretchen

New User


Joined: 29 Jul 2009
Posts: 7
Location: Kansas

PostPosted: Wed Sep 30, 2009 1:50 am    Post subject: Using Alternate Index in COBOL program
Reply with quote

hi everyone,

i have the following:
Code:

SELECT INPUT-FILE           ASSIGN TO  UT-S-INFILE
SELECT REPORT-FILE        ASSIGN TO  UT-S-RPT. 
SELECT FVVE-FILE            ASSIGN FVVE                         
                                      ORGANIZATION INDEXED                 
                                     ACCESS DYNAMIC                       
                                     RECORD KEY FVVE-KEY                 
                   ALTERNATE RECORD KEY IO-NAME WITH DUPLICATES
                                    STATUS FVVE-STATUS.                 

FD  FVVE-FILE                               
    LABEL RECORDS ARE STANDARD                 
    DATA RECORD IS FVVE-RECORD.               
01  FVVE-RECORD.                               
    05  FVVE-KEY.                             
        10  IO-NUMBER             PIC X(9).   
        10  IO-FILLER             PIC X(1).   
        10  IO-SFX                PIC X(2).   
    05  IO-NAME                   PIC X(40).   
    05  EXP-NAME                  PIC X(40). 

FD  REPORT-FILE                                         
    LABEL RECORDS ARE STANDARD                       
    BLOCK CONTAINS 0 RECORDS.                       
01  RPT-REC                           PIC X(133).   
                                                     
FD  INPUT-FILE                                   
    LABEL RECORDS ARE STANDARD                     
    BLOCK CONTAINS 0 RECORDS.                     
01  INPUT-REC                        PIC X(520).

WORKING-STORAGE SECTION.

01  WS-INPUT-REC.                             
    05  SUPP-NUM-1-9                  PIC X(9). 
    05  FILLER                        PIC X(22).
    05  SUPP-NAME                     PIC X(40).
    05  FILLER                        PIC X(25).
    05  ORIG-SUPP-NUM                 PIC X(31).
    05  ORIG-SUPP-NAME                PIC X(65).
    05  ADDRESS1                      PIC X(65).
    05  ADDRESS2                      PIC X(65).
    05  ADDRESS3                      PIC X(65).
    05  CITY                          PIC X(81).
    05  STATE                         PIC X(6). 
    05  FED-ID-NUM                    PIC X(11).
    05  CONFIDENCE                    PIC X(12).
    05  SUPP-CODE                     PIC X(8). 
    05  FILLER                        PIC X(15).


01  DETAIL-LINE.                                               
    05  PM-SUPP-OUT                    PIC X(15) VALUE SPACES.
    05  PM-NAME-OUT                    PIC X(45) VALUE SPACES.
    05  VE-NUMBER-OUT                  PIC X(10) VALUE SPACES.
    05  VE-SFX-OUT                     PIC X(2) VALUE SPACES. 
    05  VE-NAME-OUT                    PIC X(40) VALUE SPACES.

01  WS-MISC.                                             
    05  WS-EOF-PM                      PIC X(1) VALUE 'N'.
    05  FVVE-STATUS                    PIC X(2).         


PROCEDURE DIVISION.         
                             
100-INIT.                   
    OPEN INPUT  INPUT-FILE
                       FVVE-FILE.
    OPEN OUTPUT REPORT-FILE.     

READ INPUT-FILE                   
    AT END MOVE 'Y' TO WS-EOF-PM.   
 
MOVE INPUT-REC TO WS-INPUT-REC.

MOVE SPACES TO FVVE-RECORD.         
MOVE SUPP-NAME TO IO-NAME.         
START FVVE-FILE KEY EQUAL TO IO-NAME.

IF FVVE-STATUS = '00' OR '97' OR '02'
   MOVE ORIG-SUPP-NUM TO PM-SUPP-OUT 
   MOVE ORIG-SUPP-NAME TO PM-NAME-OUT
   MOVE IO-NAME TO VE-NAME-OUT
   MOVE IO-NUMBER TO VE-NUMBER-OUT
   MOVE IO-SFX TO VE-SFX-OUT
   MOVE 'MATCH ON NAME' TO MESSAGE-OUT
   WRITE REPORT-REC FROM DETAIL-LINE.



everything is showing up on the report except IO-NUMBER and IO-SFX.

do i need to do a READ or READ NEXT stmt after the START? or is there something else missing?

thanks in advance.
Back to top
View user's profile Send private message

Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Sep 30, 2009 5:28 am    Post subject:
Reply with quote

The answer is in the Language Reference Manual (START statement).
Back to top
View user's profile Send private message
gretchen

New User


Joined: 29 Jul 2009
Posts: 7
Location: Kansas

PostPosted: Wed Sep 30, 2009 7:31 pm    Post subject: Reply to: Using Alternate Index in COBOL program
Reply with quote

actually, by virtue of trial and error, i ended up using:

Code:

READ FVVE-FILE KEY IS IO-NAME


...when i want to use the alternate index, and just a READ w/o the KEY IS when i want to use the primary key.

why isn't it mentioned anywhere that you can do it this way with READ and not just START? oh well.

thanks for the advice!
Back to top
View user's profile Send private message
gretchen

New User


Joined: 29 Jul 2009
Posts: 7
Location: Kansas

PostPosted: Wed Sep 30, 2009 7:32 pm    Post subject: Reply to: Using Alternate Index in COBOL program
Reply with quote

p.s. to clarify - i took the START out and am using the READ instead.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm


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