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

Alternate Record key error (VS COBOL 2 COBOL 370 conversion)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sasi Kiran Patha
Warnings : 2

New User


Joined: 19 Nov 2006
Posts: 73
Location: Hyederabad

PostPosted: Mon Dec 11, 2006 4:55 pm
Reply with quote

Hi,
I have a requirement for converting a COBOL program to COBOL370 program.

Error Description:
----------------------

"ALTERNATE RECORD KEY" "AP-ZB-CUST-ID" had the same leftmost character position as that of the "RECORD KEY" for this file. The "ALTERNATE RECORD KEY" was discarded.
&
"KEY" data-name "AP-ZB-CUST-ID (ALPHANUMERIC)" was not defined as a "RECORD KEY" , "ALTERNATE RECORD KEY" or "RELATIVE KEY" for VSAM file "AP-ZB-EXTRACT-FILE". The statement was discarded.


COBOL syntax of Alternate record key :
---------------------------------------------


SELECT AP-ZB-EXTRACT-FILE ASSIGN TO VSAMG-APZBIN
ACCESS MODE IS DYNAMIC
ORGANIZATION IS INDEXED
RECORD KEY IS AP-ZB-KEY
ALTERNATE RECORD KEY IS AP-ZB-CUST-ID OF AP-ZB-KEY
WITH DUPLICATES
ALTERNATE RECORD KEY IS AP-ZB-NM1-SS OF AP-ZB-KEY
WITH DUPLICATES
ALTERNATE RECORD KEY IS AP-ZB-NM2-SS OF AP-ZB-EXTRACT-REC
WITH DUPLICATES
FILE STATUS IS AP-ZB-FILE-STATUS.


FD AP-ZB-EXTRACT-FILE
LABEL RECORDS ARE STANDARD
* BLOCK CONTAINS 0 RECORDS
* RECORD CONTAINS 80 CHARACTERS
DATA RECORD IS AP-ZB-EXTRACT-REC.

01 AP-ZB-EXTRACT-REC.
05 AP-ZB-KEY.
10 AP-ZB-CUST-ID PIC X(10).
10 AP-ZB-NM1-SS PIC X(09).
10 AP-ZB-COMP-CODE PIC X(03).
10 AP-ZB-OFF-NUM PIC X(06).
10 AP-ZB-CONTRACT-NUM.
15 AP-ZB-ACCT-NUM PIC X(06).
15 AP-ZB-CYCLE-DT PIC X(02).
05 FILLER PIC X(35).
05 AP-ZB-NM2-SS PIC X(09).

Please suggest any Approach... I tried removing the "OF" qualifier. I tried using redefines. Neither worked. The alternate record key data items are not declared anywhere else in the program.

Regards,
Sasi patha
Back to top
View user's profile Send private message
cynderilla

New User


Joined: 07 Dec 2006
Posts: 5
Location: chennai

PostPosted: Mon Dec 11, 2006 5:47 pm
Reply with quote

Hi Kiran,

Can u please be more specific to the problem,

i think we cannot define the same key or a part of the key which
was already defined as record key as alternate record key.

correct me if i am wrong.
Back to top
View user's profile Send private message
Sasi Kiran Patha
Warnings : 2

New User


Joined: 19 Nov 2006
Posts: 73
Location: Hyederabad

PostPosted: Mon Dec 11, 2006 5:59 pm
Reply with quote

hi,
Defining alternate record key as part of Record Key is valid. The program
executes fine in its COBOL version.
Problem is the compilation error in its COBOL370 version.

Thanks,
Sasi Patha.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Dec 11, 2006 6:09 pm
Reply with quote

The second error is a result of the first.
The first error is probably your friendly neighborhood compiler doing some commen sense optimizing; The alt key starting at the same character as the pri key is useless, just delete the useless key and recode procedure references to the pri key.
Back to top
View user's profile Send private message
Sasi Kiran Patha
Warnings : 2

New User


Joined: 19 Nov 2006
Posts: 73
Location: Hyederabad

PostPosted: Tue Dec 12, 2006 9:52 am
Reply with quote

Hi, Good morning icon_smile.gif . Thanks for the reply. I have some concerns:

Alternate Key definitely starts at the same character as the primary Key
but not of same length as primary Key. The alternate keys in the program are all part of the Record key.

Reading the file using any of the alternate Record key
Fetches multiple records in the current scenario in the Procedure Division.

If we Change the references to Pri Key in the procedure division,
what will be the FILE STATUS after the READ statement executes.
Will there be a chance for program abend because of multiple records fetched, when the pri key is supposed to fetch a single record.

Even if it works,the defined alternate indices will be obsolete. How does it affect the performance.

Regards,
Sasi Patha.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Dec 12, 2006 3:23 pm
Reply with quote

Where the bad key is used, the read needs to use the pri key with lv in the unused fields, checking for key change in the interested portion.

A little logic change......
Back to top
View user's profile Send private message
Manicka Yazhini T

New User


Joined: 01 Jun 2011
Posts: 7
Location: INDIA

PostPosted: Mon Jun 06, 2011 2:44 pm
Reply with quote

Quote:
Where the bad key is used, the read needs to use the pri key with lv in the unused fields, checking for key change in the interested portion.

A little logic change......



William,

Could you please be more specific to this post? I have the same requirement now to use AIX KEY starting at the left most position of the RECORD KEY. But COBOL compliler do not accept it? What Can I do?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jun 06, 2011 2:52 pm
Reply with quote

William has not posted anything since July last year.

Why don't you start a new topic, with your specific requirement more explicitly stated. Tell us what you want to do, what you have tried, how it failed. Stating that the "compiler do not accept it" is no use, what was the message, did you look it up to see what it means?

Congratulations, by the way, in actually searching the forum first. Doesn't often seem to happen.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 06, 2011 3:00 pm
Reply with quote

Hello,

Quote:
William has not posted anything since July last year.

And this topic has been inactive for 4.5 years. . .

Please start a new topic for your question posting the diagnostic information generated when you tried to compile.

Quote:
But COBOL compliler do not accept it?
Another version of "it didn't work" - which is is the least productive bit of info that can be posted. We accept that "something" didn't work, but the poster needs to provide the specific information as to what error(s) were generated.
Back to top
View user's profile Send private message
Manicka Yazhini T

New User


Joined: 01 Jun 2011
Posts: 7
Location: INDIA

PostPosted: Mon Jun 06, 2011 3:06 pm
Reply with quote

OK I shall do.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Error when install DB2 DB2 2
Search our Forums:

Back to Top